diff options
author | Urban Müller | 2009-12-15 14:34:29 +0000 |
---|---|---|
committer | Urban Müller | 2009-12-15 14:34:29 +0000 |
commit | 19a05d54ff55808411458e7c516df2f3e8ac0f92 (patch) | |
tree | 9c272fc431169f8d04e2211ff09f6406d58027a2 | |
parent | 03d36e13aacddb6b1ece2931fb283e4c4c277ccb (diff) | |
download | itools-19a05d54ff55808411458e7c516df2f3e8ac0f92.tar.gz itools-19a05d54ff55808411458e7c516df2f3e8ac0f92.tar.bz2 itools-19a05d54ff55808411458e7c516df2f3e8ac0f92.zip |
make U() a global func, regroup funcs
-rw-r--r-- | auto_prepend.php | 95 |
1 files changed, 60 insertions, 35 deletions
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 @@ <?php -/** - * 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 -} +/****************** 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/ */ |