mlanthaler: Bugfix: Invalid code caused an parse error.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41834 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 00:19:29 +00:00
parent fc26c64f63
commit 3444cf28e8

View File

@ -101,9 +101,15 @@ function _($class, $entity, $string="", $priority=40, $context="") {
global $lang;
$locale = i18n::getLocale();
$class = ereg_replace('.*([/\\]+)', "", $class);
if (substr($class,-4) == '.php') $class = substr($class,0,-4);
if (isset(!$lang[$locale][$class])) i18n::includeByClass($class);
if(substr($class, -4) == '.php')
$class = substr($class, 0, -4);
if(isset($lang[$locale][$class]) == false)
i18n::includeByClass($class);
$transEntity = $lang[i18n::getLocale()][$class][$entity];
return (is_array($transEntity) ? $transEntity[0] : $transEntity);
}
?>