add article category sitemap
authorJoshua Rüsweg <josh@bastelstu.be>
Fri, 9 Jun 2017 10:41:13 +0000 (12:41 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Fri, 9 Jun 2017 10:42:40 +0000 (12:42 +0200)
See #2286

com.woltlab.wcf/objectType.xml
wcfsetup/install/files/lib/system/sitemap/object/ArticleCategorySitemapObject.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index bf8c891891051af56826797409bf106633d89b9b..22a7c9e4e8d17ef246abcdec1ea3197aff1f9360 100644 (file)
                        <changeFreq>monthly</changeFreq>
                        <rebuildTime>259200</rebuildTime>
                </type>
+               <type>
+                       <name>com.woltlab.wcf.sitemap.object.articleCategory</name>
+                       <definitionname>com.woltlab.wcf.sitemap.object</definitionname>
+                       <classname>wcf\system\sitemap\object\ArticleCategorySitemapObject</classname>
+                       <priority>0.5</priority>
+                       <changeFreq>weekly</changeFreq>
+                       <rebuildTime>2592000</rebuildTime>
+               </type>
                <!-- /sitemap -->
                
                <!-- deprecated -->
diff --git a/wcfsetup/install/files/lib/system/sitemap/object/ArticleCategorySitemapObject.class.php b/wcfsetup/install/files/lib/system/sitemap/object/ArticleCategorySitemapObject.class.php
new file mode 100644 (file)
index 0000000..4fb53c4
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+namespace wcf\system\sitemap\object;
+use wcf\data\article\category\ArticleCategory;
+use wcf\data\category\CategoryList;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\DatabaseObject;
+
+/**
+ * Article category sitemap implementation.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2017 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Data\Sitemap\Object
+ * @since      3.1
+ */
+class ArticleCategorySitemapObject extends AbstractSitemapObjectObjectType {
+       /**
+        * @inheritDoc
+        */
+       public function getObjectClass() {
+               throw new \LogicException('Unreachable');
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function getObjectList() {
+               $categoryList = new CategoryList();
+               $categoryList->decoratorClassName = ArticleCategory::class;
+               $categoryList->getConditionBuilder()->add('objectTypeID = ?', [ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.category', ArticleCategory::OBJECT_TYPE_NAME)]);
+               
+               return $categoryList;
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function canView(DatabaseObject $object) {
+               /** @var $object ArticleCategory */
+               return $object->isAccessible(self::getGuestUserProfile()->getDecoratedObject());
+       }
+}
index 8e2dfbcc1de9ff62a5f3295de44d4b08ff7ff36c..4590be15cc0171196667b2c32923aa36f15d97bc 100644 (file)
@@ -1599,6 +1599,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
                <item name="wcf.acp.sitemap.enabled"><![CDATA[Sitemap aktiviert]]></item>
                <item name="wcf.acp.sitemap.edit"><![CDATA[Sitemap bearbeiten]]></item>
                <item name="wcf.acp.sitemap.objectType.com.woltlab.wcf.sitemap.object.user"><![CDATA[Benutzer]]></item>
+               <item name="wcf.acp.sitemap.objectType.com.woltlab.wcf.sitemap.object.articleCategory"><![CDATA[Artikel-Kategorien]]></item>
        </category>
        
        <category name="wcf.acp.stat">
index f615c559754c0198c2166681864690b588ef5ac8..0d4cd1b9cd7de482997cdc574f76a37f29f13946 100644 (file)
                <item name="wcf.acp.sitemap.enabled"><![CDATA[Sitemap enabled]]></item>
                <item name="wcf.acp.sitemap.edit"><![CDATA[Edit Sitemap]]></item>
                <item name="wcf.acp.sitemap.objectType.com.woltlab.wcf.sitemap.object.user"><![CDATA[User]]></item>
+               <item name="wcf.acp.sitemap.objectType.com.woltlab.wcf.sitemap.object.articleCategory"><![CDATA[Article categories]]></item>
        </category>
        
        <category name="wcf.acp.stat">