MetaTagHandler no longer creates empty default tags
authorMarcel Werk <burntime@woltlab.com>
Tue, 28 Jun 2016 20:50:43 +0000 (22:50 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 28 Jun 2016 20:50:43 +0000 (22:50 +0200)
wcfsetup/install/files/lib/system/MetaTagHandler.class.php

index a4cb12ccfdc4799c9e1d75ca6a7b3cfc99bc4e29..29f5b168b31932f235f89e8ebe8d77999316147b 100644 (file)
@@ -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);
+               }       
        }
        
        /**