diff --git a/src/sys/common.php b/src/sys/common.php index 37e6eed..aea85bc 100644 --- a/src/sys/common.php +++ b/src/sys/common.php @@ -354,7 +354,49 @@ function site_url($segment) // -------------------------------------------------------------------------- +/** + * Prints out the contents of the object + * + * @param object/array $data + * @param string $method + * @return string + */ +function to_string($data, $method='print_r') +{ + $output = '
'; + + if($method == "var_dump") + { + ob_start(); + var_dump($data); + $output .= ob_get_contents(); + ob_end_clean(); + } + else if($method == "var_export") + { + ob_start(); + var_export($data); + $output .= ob_get_contents(); + ob_end_clean(); + } + else + { + $output .= print_r($data, TRUE); + } + + return $output . ''; +} + +// -------------------------------------------------------------------------- + +// Wrapper workaround for PHP < 5.4 +function do_include($path) +{ + require_once($path); +} + // Load Most Common libraries -array_map('require_once', glob(SYS_PATH.'*.php')); +array_map('do_include', glob(SYS_PATH.'*.php')); + // End of common.php \ No newline at end of file