summaryrefslogtreecommitdiff
path: root/auto_prepend.php
diff options
context:
space:
mode:
authorUrban Müller2007-07-26 13:02:24 +0000
committerUrban Müller2007-07-26 13:02:24 +0000
commit806a5297e7e99d455b97a4f0acaba2f40f470584 (patch)
treeb9fc43ef227da87d873cf3676c08c49fa0dc1240 /auto_prepend.php
parentc3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4 (diff)
downloaditools-806a5297e7e99d455b97a4f0acaba2f40f470584.tar.gz
itools-806a5297e7e99d455b97a4f0acaba2f40f470584.tar.bz2
itools-806a5297e7e99d455b97a4f0acaba2f40f470584.zip
renamed files for autoloader
Diffstat (limited to 'auto_prepend.php')
-rw-r--r--auto_prepend.php139
1 files changed, 139 insertions, 0 deletions
diff --git a/auto_prepend.php b/auto_prepend.php
new file mode 100644
index 0000000..ddb6012
--- /dev/null
+++ b/auto_prepend.php
@@ -0,0 +1,139 @@
+<?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
+ */
+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
+}
+
+/**
+ * Return string containing names and values of all arguments
+ */
+function D()
+{
+ $args = func_get_args();
+ return it_debug::dump($args);
+}
+
+/**
+ * Echo string containing names and values of all arguments
+ */
+function ED()
+{
+ $args = func_get_args();
+ echo it_debug::dump($args);
+ return $args[0];
+}
+
+/**
+ * Same as ED(), but first argument is string that must be in $_REQUEST['debug']
+ */
+function EDC()
+{
+ $args = func_get_args();
+ $var = array_shift($args);
+ $GLOBALS['ULTRADEBUGVARS'][$var] = 1;
+
+ if (($result = $GLOBALS["debug_$var"]) && $args)
+ echo it_debug::dump($args);
+
+ if (!$result || $result === true) # Compatibility with old map relying on 0|1
+ $result = intval($result);
+
+ return $result;
+}
+
+/**
+ * Echo string containing names and values of all arguments, then exit
+ */
+function EDX()
+{
+ $args = func_get_args();
+ exit(it_debug::dump($args));
+}
+
+/**
+ * Shortcut to $it_text->Text()
+ */
+function T($label, $raw = null, $language = null)
+{
+ it_text::init();
+ return $GLOBALS['it_text']->text($label, $raw, $language);
+}
+
+
+/**
+ * Shortcut to $it_text->etext()
+ */
+function ET($label, $values = null, $language = null)
+{
+ it_text::init();
+ return $GLOBALS['it_text']->etext($label, $values, $language);
+}
+
+/**
+ * Return "db4" or "db2" depending on availability
+ */
+function db_version()
+{
+ return in_array("db4", dba_handlers()) ? "db4" : "db2";
+}
+
+/**
+ * Shortcut to $it_text->get_language()
+ */
+function T_lang()
+{
+ it_text::init();
+ return isset($GLOBALS['it_text']) ? $GLOBALS['it_text']->get_language() : "de";
+}
+
+/**
+ * Shortcut to $it_text->get_language()
+ */
+function T_set_language($language, $setcookie = true)
+{
+ it_text::init();
+ return $GLOBALS['it_text']->set_language($language, $setcookie);
+}
+
+/**
+ * Shortcut to $it_text->text_exists()
+ */
+function T_exists($label, $language = null)
+{
+ it_text::init();
+ return $GLOBALS['it_text']->text_exists($label, $language);
+}
+
+?>