Source for file init.php

Documentation is available at init.php

  1. <?php
  2. /**
  3. * Initialize all defines and includes necessary files
  4. *
  5. @package  jelix
  6. @subpackage core
  7. @author   Jouanneau Laurent
  8. @contributor Loic Mathaud, Julien Issler
  9. @copyright 2005-2007 Jouanneau laurent
  10. @copyright 2007 Julien Issler
  11. @link     http://www.jelix.org
  12. @licence  GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  13. */
  14.  
  15.  
  16. /**
  17.  * Version number of Jelix
  18.  * @name  JELIX_VERSION
  19.  */
  20. define ('JELIX_VERSION''1.1.12');
  21.  
  22. /**
  23.  * base of namespace path used in xml files of jelix
  24.  * @name  JELIX_NAMESPACE_BASE
  25.  */
  26. define ('JELIX_NAMESPACE_BASE' 'http://jelix.org/ns/');
  27.  
  28. define ('JELIX_LIB_PATH',         dirname (__FILE__).'/');
  29. define ('JELIX_LIB_CORE_PATH',    JELIX_LIB_PATH.'core/');
  30. define ('JELIX_LIB_UTILS_PATH',   JELIX_LIB_PATH.'utils/');
  31. define ('LIB_PATH',               dirname(JELIX_LIB_PATH).'/');
  32.  
  33. define ('BYTECODE_CACHE_EXISTS'function_exists('apc_cache_info'|| function_exists('eaccelerator_info'|| function_exists('xcache_info'));
  34.  
  35. if(!defined('E_DEPRECATED'))
  36.     define ('E_DEPRECATED',8192);
  37. if(!defined('E_USER_DEPRECATED'))
  38.     define ('E_USER_DEPRECATED',16384);
  39. error_reporting (E_ALL E_STRICT);
  40.  
  41.  
  42. require (JELIX_LIB_CORE_PATH 'jICoordPlugin.iface.php');
  43. require (JELIX_LIB_CORE_PATH 'jISelector.iface.php');
  44. require (JELIX_LIB_CORE_PATH 'jIUrlEngine.iface.php');
  45. require (JELIX_LIB_CORE_PATH 'jErrorHandler.lib.php');
  46. require (JELIX_LIB_CORE_PATH 'jException.lib.php');
  47. require (JELIX_LIB_CORE_PATH 'jContext.class.php');
  48. require (JELIX_LIB_CORE_PATH 'jConfig.class.php');
  49. require (JELIX_LIB_CORE_PATH 'jSelector.class.php');
  50. require (JELIX_LIB_CORE_PATH 'selector/jSelectorModule.class.php');
  51. require (JELIX_LIB_CORE_PATH 'selector/jSelectorActFast.class.php');
  52. require (JELIX_LIB_CORE_PATH 'selector/jSelectorAct.class.php');
  53. require (JELIX_LIB_CORE_PATH 'selector/jSelectorClass.class.php');
  54. require (JELIX_LIB_CORE_PATH 'selector/jSelectorDao.class.php');
  55. require (JELIX_LIB_CORE_PATH 'selector/jSelectorForm.class.php');
  56. require (JELIX_LIB_CORE_PATH 'selector/jSelectorIface.class.php');
  57. require (JELIX_LIB_CORE_PATH 'selector/jSelectorLoc.class.php');
  58. require (JELIX_LIB_CORE_PATH 'selector/jSelectorTpl.class.php');
  59. require (JELIX_LIB_CORE_PATH 'selector/jSelectorZone.class.php');
  60. require (JELIX_LIB_CORE_PATH 'selector/jSelectorSimpleFile.class.php');
  61. require (JELIX_LIB_CORE_PATH 'selector/jSelectorFile.lib.php');
  62. require (JELIX_LIB_CORE_PATH 'jUrlBase.class.php');
  63. require (JELIX_LIB_CORE_PATH 'jUrlAction.class.php');
  64. require (JELIX_LIB_CORE_PATH 'jUrl.class.php');
  65. require (JELIX_LIB_CORE_PATH 'jCoordinator.class.php');
  66. require (JELIX_LIB_CORE_PATH 'jController.class.php');
  67. require (JELIX_LIB_CORE_PATH 'jRequest.class.php');
  68. require (JELIX_LIB_CORE_PATH 'jResponse.class.php');
  69. require (JELIX_LIB_CORE_PATH 'jBundle.class.php');
  70. require (JELIX_LIB_CORE_PATH 'jLocale.class.php');
  71. require (JELIX_LIB_CORE_PATH 'jIncluder.class.php');
  72. require (JELIX_LIB_CORE_PATH 'jSession.class.php');
  73.  
  74. /**
  75.  * The main object of Jelix which process all things
  76.  * @global jCoordinator $gJCoord 
  77.  * @name $gJCoord
  78.  */
  79. $gJCoord null;
  80.  
  81. /**
  82.  * Object that contains all configuration values
  83.  * @global stdobject $gJConfig 
  84.  * @name $gJConfig
  85.  */
  86. $gJConfig null;
  87.  
  88. /**
  89.  * contains path for __autoload function
  90.  * @global array $gLibPath 
  91.  * @name $gLibPath
  92.  * @see __autoload()
  93.  */
  94. $gLibPath=array('Db'=>JELIX_LIB_PATH.'db/''Dao'=>JELIX_LIB_PATH.'dao/',
  95.  'Forms'=>JELIX_LIB_PATH.'forms/''Event'=>JELIX_LIB_PATH.'events/',
  96.  'Tpl'=>JELIX_LIB_PATH.'tpl/''Acl'=>JELIX_LIB_PATH.'acl/''Controller'=>JELIX_LIB_PATH.'controllers/',
  97.  'Auth'=>JELIX_LIB_PATH.'auth/''Installer'=>JELIX_LIB_PATH.'installer/');
  98.  
  99. /**
  100.  * function used by php to try to load an unknown class
  101.  */
  102. function jelix_autoload($class{
  103.     if(preg_match('/^j(Dao|Tpl|Acl|Event|Db|Controller|Forms|Auth|Installer).*/i'$class$m)){
  104.         $f=$GLOBALS['gLibPath'][$m[1]].$class.'.class.php';
  105.     }elseif(preg_match('/^cDao(?:Record)?_(.+)_Jx_(.+)_Jx_(.+)$/'$class$m)){
  106.         // for DAO which are stored in sessions for example
  107.         $s new jSelectorDao($m[1].'~'.$m[2]$m[3]false);
  108.         if($GLOBALS['gJConfig']->compilation['checkCacheFiletime']){
  109.             // if it is needed to check the filetime, then we use jIncluder
  110.             // because perhaps we will have to recompile the dao before the include
  111.             jIncluder::inc($s);
  112.         }else{
  113.             $f $s->getCompiledFilePath();
  114.             // we should verify that the file is here and if not, we recompile
  115.             // (case where the temp has been cleaned, see bug #6062 on berlios.de)
  116.             if (!file_exists($f)) {
  117.                 jIncluder::inc($s);
  118.             }
  119.             else
  120.                 require($f);
  121.         }
  122.         return;
  123.     }else{
  124.         $f JELIX_LIB_UTILS_PATH.$class.'.class.php';
  125.     }
  126.  
  127.     if(file_exists($f)){
  128.         require($f);
  129.     }
  130. }
  131.  
  132. spl_autoload_register("jelix_autoload");

Documentation generated on Thu, 22 Mar 2012 22:13:45 +0100 by phpDocumentor 1.4.3