From: Alexander Ebert Date: Sun, 15 Feb 2015 11:33:12 +0000 (+0100) Subject: Improved handling of optional language items X-Git-Tag: 2.1.0_RC_1~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5d83a9d8a431021759985f6df85a0f4268147c8a;p=GitHub%2FWoltLab%2FWCF.git Improved handling of optional language items --- diff --git a/wcfsetup/install/files/lib/data/language/Language.class.php b/wcfsetup/install/files/lib/data/language/Language.class.php index 5ac83f30d1..ccfe948594 100644 --- a/wcfsetup/install/files/lib/data/language/Language.class.php +++ b/wcfsetup/install/files/lib/data/language/Language.class.php @@ -8,7 +8,7 @@ use wcf\system\WCF; * Represents a language. * * @author Alexander Ebert - * @copyright 2001-2014 WoltLab GmbH + * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.language @@ -103,8 +103,12 @@ class Language extends DatabaseObject { return $this->items[$item]; } - // return plain variable - if ($optional) return ''; + // do not output value if there was no match and the item looks like a valid language item + if ($optional && preg_match('~^([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]+$~', $item)) { + return ''; + } + + // return plain input return $item; }