From 19a05d54ff55808411458e7c516df2f3e8ac0f92 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 15 Dec 2009 14:34:29 +0000 Subject: make U() a global func, regroup funcs --- auto_prepend.php | 95 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 35 deletions(-) (limited to 'auto_prepend.php') diff --git a/auto_prepend.php b/auto_prepend.php index 08ed7b1..09092ca 100644 --- a/auto_prepend.php +++ b/auto_prepend.php @@ -1,40 +1,6 @@ debug($text, $level); -} - -/** - * Convert a htmlentities-encoded string back to normal - */ -function it_htmlentities_decode($string) -{ - return strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES))); -} - -/** - * Clone an object and return copy, works for all PHP versions - */ -function &it_clone(&$object) -{ - $result = (is_object($object) && version_compare(zend_version(), 2, '>=')) ? clone($object) : $object; - return $result; # PHP internals need a tmp var to return by ref -} +/****************** functions for class it_debug **********************/ /** * Return string containing names and values of all arguments @@ -90,6 +56,10 @@ function EDX() exit(it_debug::dump($args)); } + + +/****************** functions for class it_text **********************/ + /** * Return a text in the selected language * @param $label Label of text to return @@ -171,6 +141,61 @@ function db_version() return in_array("db4", dba_handlers()) ? "db4" : "db2"; } + + + +/****************** functions for class it_text **********************/ + +/** + * Build an url + */ +function U(/* ... */) +{ + $args = func_get_args(); + return call_user_func_array(array('it_html', 'U'), $args); +} + + + + +/************************** other functions ***************************/ + +/** + * Print an error message and end page + */ +function fail($text) +{ + trigger_error($text, E_USER_ERROR); + it::fatal($text); +} + +/** + * Global shortcut for $it_debug::debug() + * @see it_debug::debug() + */ +function debug($text, $level=0) +{ + if (isset($GLOBALS['it_debug'])) + $GLOBALS['it_debug']->debug($text, $level); +} + +/** + * Convert a htmlentities-encoded string back to normal + */ +function it_htmlentities_decode($string) +{ + return strtr($string, array_flip(get_html_translation_table(HTML_ENTITIES))); +} + +/** + * Clone an object and return copy, works for all PHP versions + */ +function &it_clone(&$object) +{ + $result = (is_object($object) && version_compare(zend_version(), 2, '>=')) ? clone($object) : $object; + return $result; # PHP internals need a tmp var to return by ref +} + /** * Experimental PHP taint support, see ftp://ftp.porcupine.org/pub/php/ */ -- cgit v1.2.3