Changeset 248

Show
Ignore:
Timestamp:
09/04/06 01:01:42 (2 years ago)
Author:
laurentj
Message:

- travail sur la documentation dans les sources
- gJContext n'existe plus, remplacé par une propriété statique dans jContext
- jIncluder::inc ou incAll ne retournent plus le tableau d'états de la compilation (inutile)
- renommage de CopixBinary? en jBinaryData (xmlrpc)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/auth/jAuth.class.php

    r194 r248  
    1717 
    1818/** 
    19  * interface pour les classes de drivers d'authentification 
     19 * interface for auth drivers 
     20 * @package    jelix 
     21 * @subpackage auth 
    2022 */ 
    21  
    2223interface jIAuthDriver { 
    23  
     24    /** 
     25     * constructor 
     26     * @param array $params driver parameters, written in the ini file of the auth plugin 
     27     */ 
    2428    function __construct($params); 
     29 
     30    /** 
     31     * creates a new user object, with some first datas.. 
     32     * @param string $login the user login 
     33     * @param string $password the user password 
     34     * @return jAuthUser|object the returned object depends on the driver 
     35     */ 
    2536    public function createUser($login, $password); 
     37 
     38    /** 
     39    * store a new user. 
     40    * 
     41    * should be call after a call of createUser and after settinfg some of its properties... 
     42    * @param jAuthUser|object $user the user data container 
     43    */ 
    2644    public function saveNewUser($user); 
     45 
     46    /** 
     47     * Erase user datas of the user $login 
     48     * @param string $login the login of the user to remove 
     49     */ 
    2750    public function removeUser($login); 
     51 
     52    /** 
     53    * save updated datas of a user 
     54    * warning : should not save the password ! 
     55    * @param jAuthUser|object $user the user data container 
     56    */ 
    2857    public function updateUser($user); 
     58 
     59    /** 
     60     * return user data corresponding to the given login 
     61     * @param string $login the login of the user 
     62     * @return jAuthUser|object the user data container 
     63     */ 
    2964    public function getUser($login); 
     65 
     66    /** 
     67     * construct the user list 
     68     * @param string $pattern '' for all users 
     69     * @return array array of jAuthUser|object 
     70     */ 
    3071    public function getUserList($pattern); 
     72 
     73    /** 
     74     * change a user password 
     75     * 
     76     * @param string $login the login of the user 
     77     * @param string $newpassword 
     78     */ 
    3179    public function changePassword($login, $newpassword); 
     80 
     81    /** 
     82     * verify that the password correspond to the login 
     83     * @param string $login the login of the user 
     84     * @param string $password the password to test 
     85     * @return boolean 
     86     */ 
    3287    public function verifyPassword($login, $password); 
    3388} 
     
    3691 
    3792/** 
    38 * This is the main class for authentification process 
    39 */ 
     93 * This is the main class for authentification process 
     94 * @package    jelix 
     95 * @subpackage auth 
     96 */ 
    4097class jAuth { 
    4198 
     
    111168    } 
    112169 
     170    /** 
     171     * 
     172     */ 
    113173    public static function createUser($login,$password){ 
    114174        $dr = self::_getDriver(); 
  • trunk/lib/jelix/auth/jAuthDriverDb.class.php

    r194 r248  
    1919/** 
    2020* driver base de donn�pour l'authentification 
     21* @package    jelix 
     22* @subpackage auth 
    2123*/ 
    2224class jAuthDriverDb implements jIAuthDriver { 
  • trunk/lib/jelix/auth/jAuthUser.class.php

    r155 r248  
    1010*/ 
    1111 
    12 // pas de m�ode pour cet objet, car le user peut ne pas etre 
    13 // une instance de jAuthUser, tout d�nd du driver.. 
     12/** 
     13 * default object to represent a user 
     14 * 
     15 * this is only a data container. In fact, auth drivers can provide 
     16 * other object to embed user data. 
     17 * @package    jelix 
     18 * @subpackage auth 
     19 */ 
    1420class jAuthUser { 
    1521    public $login = ''; 
  • trunk/lib/jelix/controllers/jControllerCmdLine.class.php

    r156 r248  
    1212*/ 
    1313 
     14/** 
     15 * 
     16 * @package    jelix 
     17 * @subpackage controllers 
     18 */ 
    1419class jControllerCmdLine extends jController { 
    15      
     20 
    1621    protected $_options; 
    1722    protected $_parameters; 
    18      
     23 
    1924    protected $allowed_options; 
    2025    protected $allowed_parameters; 
     
    2227    /** 
    2328    * 
    24     * @param 
     29    * @param jRequest $request 
    2530    */ 
    2631    function __construct ($request){ 
     
    3136        $action = new jSelectorAct($this->request->params['action']); 
    3237        list($this->_options,$this->_parameters) = jCmdUtils::getOptionsAndParams($params,$this->allowed_options[$action->method] , $this->allowed_parameters[$action->method]); 
    33          
     38 
    3439    } 
    3540 
     
    4146        } 
    4247    } 
    43      
     48 
    4449    protected function option($name) { 
    4550        if (isset($this->_options[$name])) { 
  • trunk/lib/jelix/core/jConfig.class.php

    r191 r248  
    1111*/ 
    1212 
    13  
     13/** 
     14 * static class which loads the configuration 
     15 * @package  jelix 
     16 * @subpackage core 
     17 */ 
    1418class jConfig { 
    1519 
    16  
     20    /** 
     21     * this is a static class, so private constructor 
     22     */ 
    1723    private function __construct (){ } 
    1824 
    1925    /** 
    20      * lecture de la configuration du framework 
     26     * load and read the configuration of the application 
     27     * The combination of all configuration files (the given file 
     28     * and the defaultconfig.ini.php) is stored 
     29     * in a single temporary file. So it calls the jConfigCompiler 
     30     * class if needed 
     31     * @param string $configFile the config file name 
     32     * @return object it contains all configuration options 
     33     * @see jConfigCompiler 
    2134     */ 
    22  
    2335    static public function load($configFile){ 
    2436        $config=array(); 
     
    5466    } 
    5567 
     68    /** 
     69     * verify the existance of a path 
     70     */ 
    5671    private static function _verifpath($list, $time){ 
    5772        $list = split(' *, *',$list); 
  • trunk/lib/jelix/core/jConfigCompiler.class.php

    r231 r248  
    1111*/ 
    1212 
    13  
     13/** 
     14 * jConfigCompiler merge two ini file in a single array and store it in a temporary file 
     15 * This is a static class 
     16 * @package  jelix 
     17 * @subpackage core 
     18 */ 
    1419class jConfigCompiler { 
    1520 
     
    1722 
    1823    /** 
    19      * lecture de la configuration du framework 
     24     * read the given ini file. Merge it with the content of defaultconfig.ini.php 
     25     * It also calculates some options. It stores the result in a temporary file 
     26     * @param string $configFile the config file name 
     27     * @return object an object which contains configuration values 
    2028     */ 
    2129    static public function read($configFile){ 
     
    6674 
    6775    /** 
    68      * compilation et mise en cache de liste de chemins 
     76     * Analyse and check the "lib:" and "app:" path. 
     77     * @param array $list list of "lib:*" and "app:*" path 
     78     * @return array list of full path 
    6979     */ 
    7080    static private function _loadPathList($list){ 
     
    90100 
    91101    /** 
    92      * compilation et mise en cache de liste de chemins des plugins de templates 
     102     * Analyse and check the "lib:" and "app:" path for plugins 
     103     * @param array $list list of "lib:*" and "app:*" path 
     104     * @return array list of full path 
    93105     */ 
    94106    static private function _loadTplPathList(&$config,  $var){ 
     
    111123    } 
    112124 
     125    /** 
     126     * merge two array which are the result of a parse_ini_file call 
     127     * @param $array the main array 
     128     * @param $tomerge the array to merge in the first one 
     129     */ 
    113130    static private function _mergeConfig(&$array, $tomerge){ 
    114131 
     
    129146    } 
    130147 
     148    /** 
     149     * store an ini array in a file (contrary of parse_ini_file) 
     150     * @param $array the array to store 
     151     * @param $filename the file name 
     152     */ 
    131153    static private function _saveToIni($array,$filename){ 
    132154 
     
    152174    } 
    153175 
     176    /** 
     177     * format a value to store in a ini file 
     178     * @param string $value the value 
     179     * @return string the formated value 
     180     */ 
    154181    static private function _iniValue($value){ 
    155182        if($value=='' || is_numeric($value) || preg_match("/^[\w]*$/", $value)) 
     
    160187} 
    161188 
    162  
    163189?> 
  • trunk/lib/jelix/core/jContext.class.php

    r1 r248  
    1616*/ 
    1717 
     18/** 
     19 * Module context manager 
     20 * Its goal is to manage a stack of module context 
     21 * @package  jelix 
     22 * @subpackage core 
     23 */ 
    1824class jContext { 
    1925 
     26    static protected $context = array(); 
     27 
    2028    /** 
    21     * Empilement d'un contexte. 
    22     * @param string $module  le nom du module dont on empile le context
     29    * set the context to the given module 
     30    * @param string $module  the module nam
    2331    */ 
    2432    static function push ($module){ 
    25         array_push ($GLOBALS['gJContext'], $module); 
     33        array_push (self::$context, $module); 
    2634    } 
    2735 
    2836    /** 
    29     * D�lement d'un contexte. 
    30     * @return string element d�l�(le contexte qui n'est plus d'actualit� 
     37    * cancel the current context and set the context to the previous module 
     38    * @return string the obsolet module name 
    3139    */ 
    3240    static function pop (){ 
    33        return array_pop ($GLOBALS['gJContext']); 
     41       return array_pop (self::$context); 
    3442    } 
    3543 
    3644    /** 
    37     * r�p� le contexte actuel 
    38     * @return string le nom du contexte actuel si d�ni, sinon retourne fals
     45    * get the module name of the current context 
     46    * @return string name of the current modul
    3947    */ 
    4048    static function get (){ 
    41         return end($GLOBALS['gJContext']); 
     49        return end(self::$context); 
    4250    } 
    4351 
    4452    /** 
    45     * r�itialise le contexte. 
     53    * clear the context 
    4654    */ 
    4755    static function clear (){ 
    48         $GLOBALS['gJContext'] = array (); 
     56        self::$context = array (); 
    4957    } 
    5058} 
  • trunk/lib/jelix/core/jController.class.php

    r235 r248  
    1414/** 
    1515 * interface for controllers used for RESTFull request/response 
     16 * @package  jelix 
     17 * @subpackage core 
    1618 */ 
    1719interface jIRestController{ 
     
    2527/** 
    2628 * class base for controllers 
    27  *  
     29 * 
    2830 * A controller is used to implement one or many actions, one method for each action. 
     31 * @package  jelix 
     32 * @subpackage core 
    2933 */ 
    3034abstract class jController{ 
     
    8589    protected function intParam ($parName, $parDefaultValue=null, $useDefaultIfEmpty=false){ 
    8690       $value = $this->request->getParam($parName, $parDefaultValue, $useDefaultIfEmpty); 
    87        if(is_numeric($value))  
     91       if(is_numeric($value)) 
    8892            return intval($value); 
    8993       else 
     
    101105    protected function floatParam ($parName, $parDefaultValue=null, $useDefaultIfEmpty=false){ 
    102106       $value = $this->request->getParam($parName, $parDefaultValue, $useDefaultIfEmpty); 
    103        if(is_numeric($value))  
     107       if(is_numeric($value)) 
    104108            return floatval($value); 
    105109       else 
     
    117121    protected function boolParam ($parName, $parDefaultValue=null, $useDefaultIfEmpty=false){ 
    118122       $value = $this->request->getParam($parName, $parDefaultValue, $useDefaultIfEmpty); 
    119        if($value=="true" || $value == "1" || $value=="on" || $value=="yes")  
     123       if($value=="true" || $value == "1" || $value=="on" || $value=="yes") 
    120124            return true; 
    121        elseif($value=="false" || $value == "0" || $value=="off" || $value=="no")  
     125       elseif($value=="false" || $value == "0" || $value=="off" || $value=="no") 
    122126            return false; 
    123127       else 
  • trunk/lib/jelix/core/jCoordinator.class.php

    r247 r248  
    1717 * to load the configuration, to get the request parameters 
    1818 * used to instancie the correspondant controllers and to run the right method. 
     19 * @package  jelix 
     20 * @subpackage core 
    1921 */ 
    2022class jCoordinator { 
  • trunk/lib/jelix/core/jErrorHandler.lib.php

    r243 r248  
    1616*/ 
    1717 
    18 error_reporting (E_ALL); 
    19  
    2018/** 
    21 * Gestionnaire d'erreur du framework 
    22 * Remplace le gestionnaire par defaut du moteur PHP 
    23 * @param   integer     $errno      code erreur 
    24 * @param   string      $errmsg     message d'erreur 
    25 * @param   string      $filename   nom du fichier o�st produit l'erreur 
    26 * @param   integer     $linenum    numero de ligne 
    27 * @param   array       $vars       variables de contexte 
     19* Error handler for the framework. 
     20* Replace the default PHP error handler 
     21* @param   integer     $errno      error code 
     22* @param   string      $errmsg     error message 
     23* @param   string      $filename   filename where the error appears 
     24* @param   integer     $linenum    line number where the error appears 
     25* @param   array       $errcontext 
    2826*/ 
    2927function jErrorHandler($errno, $errmsg, $filename, $linenum, $errcontext){ 
  • trunk/lib/jelix/core/jException.lib.php

    r243 r248  
    1111*/ 
    1212 
    13  
     13/** 
     14* Exception handler for the framework. 
     15* Replace the default PHP Exception handler 
     16* @param   Exception   $exception  the exception object 
     17*/ 
    1418function jExceptionHandler($exception){ 
    1519    global $gJConfig, $gJCoord; 
     
    7175 
    7276 
     77/** 
     78 * Jelix Exception 
     79 * It handles locale messages. 
     80 * message property contains the locale key, and a new property 
     81 * contains the localized message 
     82 * @package  jelix 
     83 * @subpackage core 
     84 */ 
     85class jException extends Exception { 
    7386 
    74 class jException extends Exception { 
    75    public $localeParams = array(); 
    76    public $localizedMessage = ''; 
     87    /** 
     88     * parameters for the locale key 
     89     */ 
     90    public $localeParams = array(); 
    7791 
    78    public function __construct($localekey, $localeParams=array(), $code = 1) { 
    79       try{ 
    80          $this->localizedMessage = jLocale::get($localekey, $localeParams); 
    81       }catch(Exception $e){ 
    82          $this->localizedMessage = $localekey; 
    83       } 
    84       if(preg_match('/^\s*\((\d+)\)(.+)$/',$this->localizedMessage,$m)){ 
    85           $code = $m[1]; 
    86           $this->localizedMessage = $m[2]; 
    87       } 
    88       parent::__construct($localekey, $code); 
    89       $this->localeParams=$localeParams; 
     92    /** 
     93     * the localized message 
     94     * @var string 
     95     */ 
     96    public $localizedMessage = ''; 
    9097 
    91    } 
     98    /** 
     99     * @param string $localekey a locale key 
     100     * @param array $localeParams parameters for the message (for sprintf) 
     101     * @param integer $code error code (can be provided by the localized message) 
     102     */ 
     103    public function __construct($localekey, $localeParams=array(), $code = 1) { 
     104        try{ 
     105            $this->localizedMessage = jLocale::get($localekey, $localeParams); 
     106        }catch(Exception $e){ 
     107            $this->localizedMessage = $localekey; 
     108        } 
     109        if(preg_match('/^\s*\((\d+)\)(.+)$/',$this->localizedMessage,$m)){ 
     110            $code = $m[1]; 
     111            $this->localizedMessage = $m[2]; 
     112        } 
     113        parent::__construct($localekey, $code); 
     114        $this->localeParams=$localeParams; 
     115    } 
    92116 
    93    public function __toString() { 
    94       return $this->localizedMessage; 
    95    } 
     117    /** 
     118     * magic function for echo 
     119     * @return string localized message 
     120     */ 
     121    public function __toString() { 
     122        return $this->localizedMessage; 
     123    } 
    96124 
    97    public function getLocaleMessage(){ 
    98       return $this->localizedMessage; 
    99    } 
     125    /** 
     126     * getter for the localized message 
     127     * @return string 
     128     */ 
     129    public function getLocaleMessage(){ 
     130        return $this->localizedMessage; 
     131    } 
    100132 
    101133} 
    102134 
    103  
    104  
    105135?> 
  • trunk/lib/jelix/core/jIncluder.class.php

    r231 r248  
    1717 
    1818 
    19 // pour les compilations avec 1 fichier source 
     19/** 
     20 * interface for compiler which needs only one source file 
     21 * @package  jelix 
     22 * @subpackage core 
     23 */ 
    2024interface jISimpleCompiler { 
     25    /** 
     26     * parse the given file, and store the result in a cache file 
     27     * @param jSelector $aSelector the file selector 
     28     * @return boolean true : process ok 
     29     */ 
    2130    public function compile($aSelector); 
    2231} 
    2332 
    24 //  pour les compilations avec plusieurs fichiers sources 
     33/** 
     34 * interface for compiler which needs many source files 
     35 * @package  jelix 
     36 * @subpackage core 
     37 */ 
    2538interface jIMultiFileCompiler { 
     39 
     40    /** 
     41     * parse one of needed file 
     42     * @param string $sourceFile the file selector 
     43     * @param string $module    the module name of the file 
     44     * @return boolean true : process ok 
     45     */ 
    2646    public function compileItem($sourceFile, $module); 
     47 
     48    /** 
     49     * save the results in a temporary file 
     50     * called at the end of the compilation. 
     51     * @param string $cachefile the name of cache file 
     52     */ 
    2753    public function endCompile($cachefile); 
    2854} 
    2955 
    30  
     56/** 
     57 * This object is responsible to load cache files 
     58 * Some jelix files needs to be compiled in PHP (templates, daos etc..) and their 
     59 * correspondant php content are stored in a cache file. 
     60 * jIncluder verify that cache file exists, is not obsolete, and if not, 
     61 * it calls the correspondant compiler. 
     62 * And then include the cache. 
     63 * @package  jelix 
     64 * @subpackage core 
     65 */ 
    3166class jIncluder { 
     67    /** 
     68     * list of loaded cache file. 
     69     * It avoids to do all verification when a file is include many time 
     70     * @var array 
     71     */ 
    3272    protected static $_includedFiles = array(); 
    3373 
    34     public static function EVENT(){ 
    35         return  array('jEventCompiler', 
    36                     'events/jEventCompiler.class.php', 
    37                     'events.xml', 
    38                     'events.php' 
    39         ); 
    40     } 
    41  
     74    /** 
     75     * This is a static class, so private constructor 
     76     */ 
    4277    private function __construct(){} 
    4378 
    4479    /** 
    45      * @param    jISelector   $aSelectorId    selecteur du fichier �ompiler 
    46      * @return   array    contenant l'objet selecteur correspondant �aSelectorId, et 2 booleans indiquant si il a fallu compiler et si la compilation s'est bien pass�    */ 
     80     * includes cache of the correspondant file selector 
     81     * check the cache, compile if needed, and include the cache 
     82     * @param    jISelector   $aSelectorId    the selector corresponding to the file 
     83    */ 
    4784    public static function inc($aSelector=''){ 
    4885       global $gJConfig,$gJCoord; 
    4986 
    5087        if(is_string($aSelector)){ 
    51             try{ 
    52                 $aSelector = jSelectorFactory::create($aSelector); 
    53             }catch(jExceptionSelector $e){ 
    54                 return array('selector'=>$aSelector, 'compilation'=>false, 'compileok'=>false); 
    55             } 
     88            $aSelector = jSelectorFactory::create($aSelector); 
    5689        } 
    5790 
     
    5992 
    6093        if($cachefile == '' || isset(jIncluder::$_includedFiles[$cachefile])){ 
    61             return array('selector'=>$aSelector, 'compilation'=>false, 'compileok'=>true)
     94            return
    6295        } 
    6396 
     
    6699 
    67100        if($sourcefile == '' || !file_exists($sourcefile)){ 
    68            trigger_error(jLocale::get('jelix~errors.includer.source.missing',array( $aSelector->toString(true))), E_USER_ERROR); 
    69            return array('selector'=>$aSelector, 'compilation'=>false, 'compileok'=>false); 
     101            throw new jException('jelix~errors.includer.source.missing',array( $aSelector->toString(true))); 
    70102        } 
    71103 
     
    89121        } 
    90122 
    91         return array('selector'=>$aSelector, 'compilation'=>$mustCompile, 'compileok'=>$compileok); 
    92123    } 
    93124 
    94         /** 
    95          * @param    array    aType 
    96             = array( 
    97             'nom classe compilateur', 
    98             'chemin compilateur relatif �ib/jelix/', 
    99             'foo.xml', // nom du fichier �ompiler 
    100             'foo.php',  //fichier cache 
    101             ); 
    102         * @return   array    contenant 2 booleans indiquant si il a fallu compiler et si la compilation s'est bien pass�        */ 
     125    /** 
     126     * include a cache file which is the results of the compilation of multiple file sotred in multiple modules 
     127    * @param    array    aType 
     128    *    = array( 
     129    *    'compilator class name', 
     130    *    'relative path of the compilator class file to lib/jelix/', 
     131    *    'foo.xml', // file name to compile (in each modules) 
     132    *    'foo.php',  //cache filename 
     133    *    ); 
     134    */ 
    103135    public static function incAll($aType){ 
    104136 
     
    106138        $cachefile = JELIX_APP_TEMP_PATH.'compiled/'.$aType[3]; 
    107139        if(isset(jIncluder::$_includedFiles[$cachefile])){ 
    108             return array('compilation'=>false, 'compileok'=>true)
     140            return
    109141        } 
    110142 
     
    144176            jIncluder::$_includedFiles[$cachefile]=true; 
    145177        } 
    146         return array('compilation'=>$mustCompile, 'compileok'=>$compileok); 
    147178    } 
    148179} 
  • trunk/lib/jelix/core/jIPlugin.iface.php

    r98 r248  
    1414/** 
    1515* interface that should implement all coordinator plugins 
     16* @package  jelix 
     17* @subpackage core 
    1618*/ 
    17  
    1819interface jIPlugin { 
    1920 
    2021    /** 
    21      * @param    array  $config  list of configuration parameters 
     22     * @param    array  $config  content of the config ini file of the plugin 
    2223     */ 
    2324    public function __construct($config); 
    2425 
    2526    /** 
     27     * this method is called before each action 
    2628     * @param    array  $params   plugin parameters for the current action 
    2729     * @return null or jSelectorAct  if action should change 
     
    3032 
    3133    /** 
    32      * 
     34     * this method is called after the execution of the action, and before the output of the response 
    3335     */ 
    3436    public function beforeOutput(); 
    3537 
     38    /** 
     39     * this method is called after the output. 
     40     */ 
    3641    public function afterProcess (); 
    3742} 
  • trunk/lib/jelix/core/jLocale.class.php

    r246 r248  
    1919 
    2020/** 
    21 * a bundle content all readed properties ina a given langage, and for all charsets 
     21* a bundle contains all readed properties in a given language, and for all charsets 
     22* @package  jelix 
     23* @subpackage core 
    2224*/ 
    2325class jBundle { 
     
    4042    /** 
    4143    * get the translation 
     44    * @param string $key the locale key 
     45    * @param string $charset 
     46    * @return string the localized string 
    4247    */ 
    4348    public function get ($key, $charset = null){ 
     
    104109    * loads a given resource from its path. 
    105110    */ 
    106     function _loadResources ($fichier, $charset){ 
     111    private function _loadResources ($fichier, $charset){ 
    107112 
    108113        if (($f = fopen ($fichier, 'r')) !== false) { 
     
    156161/** 
    157162 * static class to get a localized string 
     163 * @package  jelix 
     164 * @subpackage core 
    158165 */ 
    159166class jLocale { 
     167    /** 
     168     * 
     169     */ 
    160170    static $bundles = array(); 
     171 
     172    /** 
     173     * static class... 
     174     */ 
     175    private function __construct(){} 
    161176 
    162177    /** 
  • trunk/lib/jelix/core/jRequest.class.php

    r247 r248  
    2121 * author : Gerald Croes, Laurent Jouanneau 
    2222 * http://www.copix.org 
     23 * @package  jelix 
     24 * @subpackage core 
    2325 */ 
    2426abstract class jRequest { 
  • trunk/lib/jelix/core/jResponse.class.php

    r240 r248  
    1313 
    1414/** 
    15 * classe de base pour l'objet  charg�e controler et de formater 
    16 * la r�nse renvoy�au navigateur 
     15* class base for response object 
     16* A response object is responsible to generate a content in a specific format. 
     17* @package  jelix&nbs