diff --git a/phpgwapi/inc/common_functions.inc.php b/phpgwapi/inc/common_functions.inc.php index cc06d332c3..c5be0ee671 100755 --- a/phpgwapi/inc/common_functions.inc.php +++ b/phpgwapi/inc/common_functions.inc.php @@ -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)