diff options
| author | Christian Weber | 2007-01-19 23:55:35 +0000 | 
|---|---|---|
| committer | Christian Weber | 2007-01-19 23:55:35 +0000 | 
| commit | e1575289bfca4b6817a19ac36f636d3504439b53 (patch) | |
| tree | a603014c5ba7ef76c5f2274203782f6c69c1fe03 | |
| parent | a263faa1b126c27ea3666578b222e24849274c89 (diff) | |
| download | itools-e1575289bfca4b6817a19ac36f636d3504439b53.tar.gz itools-e1575289bfca4b6817a19ac36f636d3504439b53.tar.bz2 itools-e1575289bfca4b6817a19ac36f636d3504439b53.zip | |
If a text is undefined in our language, use language_failsafe instead of error in non-debug mode
| -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];  } |