diff options
Diffstat (limited to 'text.class')
-rw-r--r-- | text.class | 61 |
1 files changed, 14 insertions, 47 deletions
@@ -104,9 +104,23 @@ function it_text($p = null) # And finally, record the name of our active language. $this->actlanguagename = $this->languages[$this->actlanguage]; + # Make this object available under $GLOBALS['it_text'], or add my texts to $GLOBALS['it_text'] if it exists + if (!$GLOBALS['it_text']) + $GLOBALS['it_text'] =& $this; + else + $GLOBALS['it_text']->statictext += $this->statictext; + debug("Used language is {$this->actlanguagename}, default language is {$this->defaultlanguage}.", 6); } +/** + * Instanciate singleton if necessary + */ +function init() +{ + if (!$GLOBALS['it_text']) + new it_text; +} /** * Return a text in the selected language. @@ -361,51 +375,4 @@ function dump_php() } } /* End class it_text */ - - -/* - * Globally available functions without need for object - */ - - -/* - * Shortcut to $it_text->Text() - */ -function T($label, $raw = null, $language = null) -{ - return $GLOBALS['it_text']->text($label, $raw, $language); -} - - -/* - * Shortcut to $it_text->etext() - */ -function ET($label, $values = null, $language = null) -{ - return $GLOBALS['it_text']->etext($label, $values, $language); -} - -/** - * Shortcut to $it_text->get_language() - */ -function T_lang() -{ - return isset($GLOBALS['it_text']) ? $GLOBALS['it_text']->get_language() : "de"; -} - -/** - * Shortcut to $it_text->get_language() - */ -function T_set_language($language, $setcookie = true) -{ - return $GLOBALS['it_text']->set_language($language, $setcookie); -} - -/** - * Shortcut to $it_text->text_exists() - */ -function T_exists($label, $language = null) -{ - return $GLOBALS['it_text']->text_exists($label, $language); -} ?> |