From 9008414fffe473cb4df07896a29ca4c0ac0c03a5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 17 May 2008 07:34:16 +0000 Subject: [PATCH] "- 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" --- phpgwapi/inc/common_functions.inc.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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)