Project

General

Profile

Bug #19779 » readLLfile.diff

Administrator Admin, 2009-01-09 09:50

View differences:

t3lib/class.t3lib_div.php (copie de travail)
* @param string Input is a file-reference (see t3lib_div::getFileAbsFileName). That file is expected to be a 'locallang.php' file containing a $LOCAL_LANG array (will be included!) or a 'locallang.xml' file conataining a valid XML TYPO3 language structure.
* @param string Language key
* @param string Character set (option); if not set, determined by the language key
* @return array Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array
* @param integer Error mode (when file could not be found): 0 - call debug(), 1 - do nothing, 2 - raise an exception
* @return array Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array and it is FALSE in error case.
*/
public static function readLLfile($fileRef, $langKey, $charset='') {
public static function readLLfile($fileRef, $langKey, $charset='', $errorMode=0) {
$file = t3lib_div::getFileAbsFileName($fileRef);
if ($file) {
......
$LOCAL_LANG = array('default'=>$LOCAL_LANG['default'], $langKey=>$LOCAL_LANG[$langKey]); }
}
} else {
die('File "' . $fileRef. '" not found!');
$errorMsg = 'File "' . $fileRef. '" not found!';
if ($errorMode == 2) {
throw new Exception($errorMsg);
} elseif(!$errorMode) {
debug($errorMsg, 1);
}
$rc = FALSE;
}
}
return is_array($LOCAL_LANG) ? $LOCAL_LANG : array();
if ($rc !== FALSE) {
$rc = is_array($LOCAL_LANG) ? $LOCAL_LANG : array();
}
return $rc;
}
/**
(1-1/2)