From ebaf5f5641c11bdb1af30597ced13e284d929a1f Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 28 Jun 2016 22:50:43 +0200 Subject: [PATCH] MetaTagHandler no longer creates empty default tags --- .../files/lib/system/MetaTagHandler.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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); + } } /** -- 2.20.1