diff options
-rw-r--r-- | text.class | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -19,7 +19,7 @@ class it_text var $actlanguagename; # Name of selected language var $languages = array(); # Active languages var $languages_available = array(); # Available languages - var $language_failsafe; # First available language + var $language_failsafe; # First available language. Must be complete (used as fallback) var $statictext = array(); # Text array, read from php file on init var $debug; # Non-empty if debug mode is desired var $cookiename; # Name of the language cookie, default is "LANGUAGE" @@ -33,7 +33,7 @@ class it_text * @param $db Optional database object, defaults to global $it_db * @param $cookiename Optional cookie name (default: 'LANGUAGE') */ -function it_text($defaultlanguage = 'de', $tablename = 'it_texts', $debug = '', $db = 0, $cookiename = 'LANGUAGE') +function it_text($defaultlanguage = 'de', $tablename = 'it_texts', $debug = false, $db = null, $cookiename = 'LANGUAGE') { $this->phpfile = isset($phpfile) ? $phpfile : ($GLOBALS['ULTRAHOME'] . '/phpinclude/texts.php'); $this->debug = $debug; @@ -148,22 +148,11 @@ function text($label, $raw = null, $language = null) if (!isset($language)) $language = $this->actlanguage; - if (isset($this->statictext[$label][$language])) + if ($this->statictext[$label][$language] !== '') return $this->statictext[$label][$language]; $this->unknown_labels[] = $label; - return $this->debug ? "<blink>$label ($language)</blink>" : $this->label_unknown($label); -} - - -/** - * Localized function called when a label is not found - * overload this if for example you want to have a silent error behaviour - * @param $label Text label that was not found in database - */ -function label_unknown($label) -{ - internal_error("No text found for label \"$label\""); + return $this->debug ? "<blink>$label ($language)</blink>" : $this->statictext[$label][$this->language_failsafe]; } |