From: Marcel Werk Date: Tue, 28 Jun 2016 20:50:43 +0000 (+0200) Subject: MetaTagHandler no longer creates empty default tags X-Git-Tag: 3.0.0_Beta_1~1324 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ebaf5f5641c11bdb1af30597ced13e284d929a1f;p=GitHub%2FWoltLab%2FWCF.git MetaTagHandler no longer creates empty default tags --- diff --git a/wcfsetup/install/files/lib/system/MetaTagHandler.class.php b/wcfsetup/install/files/lib/system/MetaTagHandler.class.php index a4cb12ccfd..29f5b168b3 100644 --- a/wcfsetup/install/files/lib/system/MetaTagHandler.class.php +++ b/wcfsetup/install/files/lib/system/MetaTagHandler.class.php @@ -21,7 +21,7 @@ class MetaTagHandler extends SingletonFactory implements \Countable, \Iterator { * list of index to object relation * @var integer[] */ - protected $indexToObject = null; + protected $indexToObject = []; /** * list of meta tags @@ -34,9 +34,15 @@ class MetaTagHandler extends SingletonFactory implements \Countable, \Iterator { */ protected function init() { // set default tags - $this->addTag('description', 'description', WCF::getLanguage()->get(META_DESCRIPTION)); - $this->addTag('keywords', 'keywords', WCF::getLanguage()->get(META_KEYWORDS)); - $this->addTag('og:site_name', 'og:site_name', WCF::getLanguage()->get(PAGE_TITLE), true); + if ($value = WCF::getLanguage()->get(META_DESCRIPTION)) { + $this->addTag('description', 'description', $value); + } + if ($value = WCF::getLanguage()->get(META_KEYWORDS)) { + $this->addTag('keywords', 'keywords', $value); + } + if ($value = WCF::getLanguage()->get(PAGE_TITLE)) { + $this->addTag('og:site_name', 'og:site_name', $value, true); + } } /**