summaryrefslogtreecommitdiff
path: root/text.class
diff options
context:
space:
mode:
authorUrban Müller2007-07-18 11:58:42 +0000
committerUrban Müller2007-07-18 11:58:42 +0000
commit8f61176da8e3f215cec70b3320c956d3e3ace73f (patch)
tree7cb66b951918fd67c9aa15078c46821912b01cf4 /text.class
parent4c3b61356b9fe001c5637c30f6105a208f4dffc3 (diff)
downloaditools-8f61176da8e3f215cec70b3320c956d3e3ace73f.tar.gz
itools-8f61176da8e3f215cec70b3320c956d3e3ace73f.tar.bz2
itools-8f61176da8e3f215cec70b3320c956d3e3ace73f.zip
compatibility with auto-startup, some cleanups
Diffstat (limited to 'text.class')
-rw-r--r--text.class61
1 files changed, 14 insertions, 47 deletions
diff --git a/text.class b/text.class
index de5e906..d96fb74 100644
--- a/text.class
+++ b/text.class
@@ -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);
-}
?>