mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
PSR-0 autoloading eg. for PEAR or Horde classes
This commit is contained in:
parent
ab4873553b
commit
c8f1e75165
@ -1438,7 +1438,7 @@ if (ini_get('register_globals'))
|
||||
unregister_globals();
|
||||
}
|
||||
|
||||
if (!function_exists('lang')) // setup declares an own version
|
||||
if (!function_exists('lang') || defined('NO_LANG')) // setup declares an own version
|
||||
{
|
||||
/**
|
||||
* function to handle multilanguage support
|
||||
@ -1493,7 +1493,7 @@ function try_lang($key,$vars=null)
|
||||
function __autoload($class)
|
||||
{
|
||||
// fixing warnings generated by php 5.3.8 is_a($obj) trying to autoload huge strings
|
||||
if (strlen($class) > 64) return;
|
||||
if (strlen($class) > 64 || strpos($class, '.') !== false) return;
|
||||
|
||||
if ($class == 'etemplate_new') $class = 'etemplate';
|
||||
|
||||
@ -1508,9 +1508,9 @@ function __autoload($class)
|
||||
// eGW api classes containing multiple classes in on file, eg. egw_exception
|
||||
isset($components[0]) && file_exists($file = EGW_API_INC.'/class.'.$app.'_'.$components[0].'.inc.php') ||
|
||||
// eGW eTemplate classes using the old naming schema, eg. etemplate
|
||||
file_exists($file = EGW_INCLUDE_ROOT.'/etemplate/inc/class.'.$class.'.inc.php'))// ||
|
||||
// classes of the current application using the old naming schema
|
||||
// file_exists($file = EGW_INCLUDE_ROOT.'/'.$GLOBALS['egw_info']['flags']['currentapp'].'/inc/class.'.$class.'.inc.php'))
|
||||
file_exists($file = EGW_INCLUDE_ROOT.'/etemplate/inc/class.'.$class.'.inc.php') ||
|
||||
// include PEAR and PSR0 classes from include_path
|
||||
!isset($GLOBALS['egw_info']['apps'][$app]) && @include_once($file = strtr($class, array('_'=>'/','\\'=>'/')).'.php'))
|
||||
{
|
||||
//error_log("autoloaded class $class from $file");
|
||||
include_once($file);
|
||||
|
Loading…
Reference in New Issue
Block a user