Add auto-guessing of application abbreviation
authorMatthias Schmidt <gravatronics@live.com>
Tue, 2 Sep 2014 18:50:32 +0000 (20:50 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 2 Sep 2014 18:50:32 +0000 (20:50 +0200)
These changes are relevant for application's `*Core` classes, category types, deleted content providers and taggables.

wcfsetup/install/files/lib/system/application/AbstractApplication.class.php
wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php
wcfsetup/install/files/lib/system/category/SmileyCategoryType.class.php
wcfsetup/install/files/lib/system/moderation/AbstractDeletedContentProvider.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/search/AbstractSearchableObjectType.class.php
wcfsetup/install/files/lib/system/tagging/AbstractTaggable.class.php [new file with mode: 0644]

index bc8803ecb985d29a70fdf2fb0903810e7bb2b3d7..26f23e7d6b47646b9ab76cf807a44bcc816f0734 100644 (file)
@@ -43,7 +43,11 @@ abstract class AbstractApplication extends SingletonFactory implements IApplicat
         * @see \wcf\system\SingletonFactory::init()
         */
        protected final function init() {
-               if (empty($this->abbreviation) || $this->abbreviation == 'wcf') {
+               if (empty($this->abbreviation)) {
+                       $classParts = explode('\\', get_called_class());
+                       $this->abbreviation = $classParts[0];
+               }
+               else if ($this->abbreviation == 'wcf') {
                        throw new SystemException("Unable to determine application, abbreviation is missing");
                }
                
index 07cd527165d1c67e399efb5d3f934d77d98d6b37..b4e17d9c66f7023cb6cd9a6fc8a89b967cb02910 100644 (file)
@@ -109,7 +109,8 @@ abstract class AbstractCategoryType extends SingletonFactory implements ICategor
         * @see \wcf\system\category\ICategoryType::getApplication()
         */
        public function getApplication() {
-               return 'wcf';
+               $classParts = explode('\\', get_called_class());
+               return $classParts[0];
        }
        
        /**
index 639664233b0c0e4057d3d5b8b2511b536dc1fb27..b9c7cb4d83e76bc1c89d6f24e6e3958b941e6d0a 100644 (file)
@@ -29,13 +29,6 @@ class SmileyCategoryType extends AbstractCategoryType {
         */
        protected $maximumNestingLevel = 0;
        
-       /**
-        * @see \wcf\system\category\ICategoryType::getApplication()
-        */
-       public function getApplication() {
-               return 'wcf';
-       }
-       
        /**
         * @see \wcf\system\category\ICategoryType::canAddCategory()
         */
diff --git a/wcfsetup/install/files/lib/system/moderation/AbstractDeletedContentProvider.class.php b/wcfsetup/install/files/lib/system/moderation/AbstractDeletedContentProvider.class.php
new file mode 100644 (file)
index 0000000..05cb196
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace wcf\system\moderation;
+use wcf\data\object\type\AbstractObjectTypeProcessor;
+
+/**
+ * Abstract implementation of a deleted content provider.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.moderation
+ * @category   Community Framework
+ */
+abstract class AbstractDeletedContentProvider extends AbstractObjectTypeProcessor implements IDeletedContentProvider {
+       /**
+        * @see \wcf\system\moderation\IDeletedContentProvider::getApplication()
+        */
+       public function getApplication() {
+               $classParts = explode('\\', get_called_class());
+               return $classParts[0];
+       }
+}
index 6a25675f6a1145f75f5dd414bcda8f9010053a03..4545ef8aeac233cf5fe38c952503ef2926ce4f8b 100644 (file)
@@ -30,7 +30,8 @@ abstract class AbstractSearchableObjectType extends AbstractObjectTypeProcessor
         * @see \wcf\system\search\ISearchableObjectType::getApplication()
         */
        public function getApplication() {
-               return 'wcf';
+               $classParts = explode('\\', get_called_class());
+               return $classParts[0];
        }
        
        /**
diff --git a/wcfsetup/install/files/lib/system/tagging/AbstractTaggable.class.php b/wcfsetup/install/files/lib/system/tagging/AbstractTaggable.class.php
new file mode 100644 (file)
index 0000000..1b2fa62
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace wcf\system\tagging;
+use wcf\data\object\type\AbstractObjectTypeProcessor;
+
+/**
+ * Abstract implementation of a taggable.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.tagging
+ * @category   Community Framework
+ */
+abstract class AbstractTaggable extends AbstractObjectTypeProcessor implements ITaggable {
+       /**
+        * @see \wcf\system\tagging\ITaggable::getApplication()
+        */
+       public function getApplication() {
+               $classParts = explode('\\', get_called_class());
+               return $classParts[0];
+       }
+}