"- array2string() to format arrays (or objects) as string, eg. for error_log()

- allow apps to specify their own autoload handler, only tried after the standard one does not find the class"
This commit is contained in:
Ralf Becker 2008-05-17 07:34:16 +00:00
parent dfc7176959
commit 9008414fff

View File

@ -30,6 +30,17 @@ function bytes($str)
return $func_overload & 2 ? mb_strlen($str,'ascii') : strlen($str);
}
/**
* Format array or other types as (one-line) string, eg. for error_log statements
*
* @param mixed $arr
* @return string
*/
function array2string($arr)
{
return str_replace(array("\n",' '),'',print_r($arr,true));
}
/**
* @internal Not to be used directly. Should only be used by print_debug()
*/
@ -1351,6 +1362,11 @@ function __autoload($class)
//error_log("autoloaded class $class from $file");
include_once($file);
}
// allow apps to define onw autoload method
elseif (isset($GLOBALS['egw_info']['flags']['autoload']) && is_callable($GLOBALS['egw_info']['flags']['autoload']))
{
call_user_func($GLOBALS['egw_info']['flags']['autoload'],$class);
}
elseif (is_array($GLOBALS['egw_info']['apps']))
{
foreach(array_keys($GLOBALS['egw_info']['apps']) as $app)