From c8f1e75165bd37e76f4bd5966965dd3791d07f8d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 22 Oct 2013 08:25:55 +0000 Subject: [PATCH] PSR-0 autoloading eg. for PEAR or Horde classes --- phpgwapi/inc/common_functions.inc.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/common_functions.inc.php b/phpgwapi/inc/common_functions.inc.php index 6d062bf1f3..48be1ea9aa 100755 --- a/phpgwapi/inc/common_functions.inc.php +++ b/phpgwapi/inc/common_functions.inc.php @@ -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);