Add default page titles for category management pages
authorMatthias Schmidt <gravatronics@live.com>
Sat, 26 Dec 2015 07:37:17 +0000 (08:37 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 26 Dec 2015 07:37:17 +0000 (08:37 +0100)
wcfsetup/install/files/lib/acp/form/AbstractCategoryAddForm.class.php
wcfsetup/install/files/lib/acp/form/AbstractCategoryEditForm.class.php
wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php

index f07cf96ede13ef1d3d78f87a450378068ffc7869..7e0a0c440efa44ee3c3111cccc82f44c5ae2c3ed 100644 (file)
@@ -41,11 +41,11 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
         * additional category data
         * @var array
         */
-       public $additionalData = array();
+       public $additionalData = [];
        
        /**
         * tree with the category nodes
-        * @var \wcf\data\category\CategoryNodeTree
+        * @var UncachedCategoryNodeTree
         */
        public $categoryNodeTree = null;
        
@@ -69,7 +69,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        
        /**
         * category object type object
-        * @var \wcf\data\object\type\ObjectType
+        * @var ObjectType
         */
        public $objectType = null;
        
@@ -89,7 +89,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
         * language item with the page title
         * @var string
         */
-       public $pageTitle = '';
+       public $pageTitle = 'wcf.category.add';
        
        /**
         * id of the parent category id
@@ -104,12 +104,12 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        public $showOrder = 0;
        
        /**
-        * @see \wcf\page\AbstractPage::$templateName
+        * @inheritDoc
         */
        public $templateName = 'categoryAdd';
        
        /**
-        * @see \wcf\page\AbstractPage::__run()
+        * @inheritDoc
         */
        public function __run() {
                $classNameParts = explode('\\', get_called_class());
@@ -117,20 +117,20 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
                
                // autoset controllers
                if (empty($this->addController)) {
-                       $this->addController = str_replace(array('AddForm', 'EditForm'), 'Add', $className);
+                       $this->addController = str_replace(['AddForm', 'EditForm'], 'Add', $className);
                }
                if (empty($this->editController)) {
-                       $this->editController = str_replace(array('AddForm', 'EditForm'), 'Edit', $className);
+                       $this->editController = str_replace(['AddForm', 'EditForm'], 'Edit', $className);
                }
                if (empty($this->listController)) {
-                       $this->listController = str_replace(array('AddForm', 'EditForm'), 'List', $className);
+                       $this->listController = str_replace(['AddForm', 'EditForm'], 'List', $className);
                }
                
                parent::__run();
        }
        
        /**
-        * @see \wcf\page\IPage::assignVariables()
+        * @inheritDoc
         */
        public function assignVariables() {
                parent::assignVariables();
@@ -140,7 +140,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
                        ACLHandler::getInstance()->assignVariables($this->aclObjectTypeID);
                }
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'aclObjectTypeID' => $this->aclObjectTypeID,
                        'action' => 'add',
                        'addController' => $this->addController,
@@ -152,7 +152,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
                        'objectType' => $this->objectType,
                        'parentCategoryID' => $this->parentCategoryID,
                        'showOrder' => $this->showOrder
-               ));
+               ]);
                
                if ($this->pageTitle) {
                        WCF::getTPL()->assign('pageTitle', $this->pageTitle);
@@ -176,7 +176,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        }
        
        /**
-        * @see \wcf\page\IPage::readData()
+        * @inheritDoc
         */
        public function readData() {
                $this->objectType = CategoryHandler::getInstance()->getObjectTypeByName($this->objectTypeName);
@@ -209,7 +209,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        }
        
        /**
-        * @see \wcf\page\IForm::readFormParameters()
+        * @inheritDoc
         */
        public function readFormParameters() {
                parent::readFormParameters();
@@ -231,13 +231,13 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        }
        
        /**
-        * @see \wcf\page\IForm::save()
+        * @inheritDoc
         */
        public function save() {
                parent::save();
                
-               $this->objectAction = new CategoryAction(array(), 'create', array(
-                       'data' => array_merge($this->additionalFields, array(
+               $this->objectAction = new CategoryAction([], 'create', [
+                       'data' => array_merge($this->additionalFields, [
                                'additionalData' => serialize($this->additionalData),
                                'description' => ($this->objectType->getProcessor()->hasDescription() && I18nHandler::getInstance()->isPlainValue('description')) ? I18nHandler::getInstance()->getValue('description') : '',
                                'isDisabled' => $this->isDisabled,
@@ -245,15 +245,15 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
                                'parentCategoryID' => $this->parentCategoryID,
                                'showOrder' => $this->showOrder > 0 ? $this->showOrder : null,
                                'title' => I18nHandler::getInstance()->isPlainValue('title') ? I18nHandler::getInstance()->getValue('title') : ''
-                       ))
-               ));
+                       ])
+               ]);
                $this->objectAction->executeAction();
                $returnValues = $this->objectAction->getReturnValues();
                
                if (($this->objectType->getProcessor()->hasDescription() && !I18nHandler::getInstance()->isPlainValue('description')) || !I18nHandler::getInstance()->isPlainValue('title')) {
                        $categoryID = $returnValues['returnValues']->categoryID;
                        
-                       $updateData = array();
+                       $updateData = [];
                        if ($this->objectType->getProcessor()->hasDescription() && !I18nHandler::getInstance()->isPlainValue('description')) {
                                $updateData['description'] = $this->objectType->getProcessor()->getI18nLangVarPrefix().'.description.category'.$categoryID;
                                I18nHandler::getInstance()->save('description', $updateData['description'], $this->objectType->getProcessor()->getDescriptionLangVarCategory(), $this->packageID);
@@ -282,7 +282,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
                // reset values
                $this->parentCategoryID = 0;
                $this->showOrder = 0;
-               $this->additionalData = array();
+               $this->additionalData = [];
                
                $this->saved();
                
@@ -294,7 +294,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        }
        
        /**
-        * @see \wcf\page\IForm::validate()
+        * @inheritDoc
         */
        public function validate() {
                parent::validate();
@@ -321,7 +321,7 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
        }
        
        /**
-        * Validates the parent category.
+        * @inheritDoc
         */
        protected function validateParentCategory() {
                if ($this->parentCategoryID) {
index 407b302689772aaa903dde2382c3845acbf8ba0f..919aa2c49ad4e62e673cecb9bced7655d3fd48a3 100644 (file)
@@ -26,7 +26,7 @@ use wcf\system\WCF;
 class AbstractCategoryEditForm extends AbstractCategoryAddForm {
        /**
         * edited category
-        * @var \wcf\data\category\Category
+        * @var Category
         */
        public $category = null;
        
@@ -37,7 +37,12 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
        public $categoryID = 0;
        
        /**
-        * @see \wcf\page\IPage::assignVariables()
+        * @inheritDoc
+        */
+       public $pageTitle = 'wcf.category.edit';
+       
+       /**
+        * @inheritDoc
         */
        public function assignVariables() {
                parent::assignVariables();
@@ -45,15 +50,15 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
                I18nHandler::getInstance()->assignVariables(!empty($_POST));
                
                $availableCategories = new CategoryNodeTree($this->objectType->objectType, 0, true);
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'action' => 'edit',
                        'category' => $this->category,
                        'availableCategories' => $availableCategories->getIterator()
-               ));
+               ]);
        }
        
        /**
-        * @see \wcf\acp\form\AbstractCategoryAddForm::checkCategoryPermissions()
+        * @inheritDoc
         */
        protected function checkCategoryPermissions() {
                if (!$this->objectType->getProcessor()->canEditCategory()) {
@@ -62,14 +67,14 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
        }
        
        /**
-        * @see \wcf\acp\form\AbstractCategoryAddForm::readCategories()
+        * @inheritDoc
         */
        protected function readCategories() {
-               $this->categoryNodeTree = new CategoryNodeTree($this->objectType->objectType, 0, true, array($this->category->categoryID));
+               $this->categoryNodeTree = new CategoryNodeTree($this->objectType->objectType, 0, true, [$this->category->categoryID]);
        }
        
        /**
-        * @see \wcf\page\IPage::readParameters()
+        * @inheritDoc
         */
        public function readParameters() {
                parent::readParameters();
@@ -84,7 +89,7 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
        }
        
        /**
-        * @see \wcf\page\IPage::readData()
+        * @inheritDoc
         */
        public function readData() {
                parent::readData();
@@ -103,7 +108,7 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
        }
        
        /**
-        * @see \wcf\form\IForm::save()
+        * @inheritDoc
         */
        public function save() {
                AbstractForm::save();
@@ -132,16 +137,16 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
                }
                
                // update category
-               $this->objectAction = new CategoryAction(array($this->category), 'update', array(
-                       'data' => array_merge($this->additionalFields, array(
+               $this->objectAction = new CategoryAction([$this->category], 'update', [
+                       'data' => array_merge($this->additionalFields, [
                                'additionalData' => serialize($this->additionalData),
                                'description' => $description,
                                'isDisabled' => $this->isDisabled,
                                'parentCategoryID' => $this->parentCategoryID,
                                'showOrder' => $this->showOrder,
                                'title' => $title
-                       ))
-               ));
+                       ])
+               ]);
                $this->objectAction->executeAction();
                
                // update acl
@@ -160,7 +165,7 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm {
        }
        
        /**
-        * @see \wcf\acp\form\AbstractCategoryAddForm::validateParentCategory()
+        * @inheritDoc
         */
        protected function validateParentCategory() {
                parent::validateParentCategory();
index 5ad8431c8c6e6b43ad774413a2e6d71cb2b71136..c31e14c95d3d15f6a083fb6625ab3d43aed12822 100644 (file)
@@ -28,13 +28,13 @@ abstract class AbstractCategoryListPage extends AbstractPage {
        
        /**
         * category node tree
-        * @var \wcf\data\category\CategoryNodeTree
+        * @var CategoryNodeTree
         */
        public $categoryNodeTree = null;
        
        /**
         * ids of collapsed categories
-        * @var array<integer>
+        * @var integer[]
         */
        public $collapsedCategoryIDs = null;
        
@@ -54,11 +54,11 @@ abstract class AbstractCategoryListPage extends AbstractPage {
         * language item with the page title
         * @var string
         */
-       public $pageTitle = '';
+       public $pageTitle = 'wcf.category.list';
        
        /**
         * category object type object
-        * @var \wcf\data\object\type\ObjectType
+        * @var ObjectType
         */
        public $objectType = null;
        
@@ -69,12 +69,12 @@ abstract class AbstractCategoryListPage extends AbstractPage {
        public $objectTypeName = '';
        
        /**
-        * @see \wcf\page\AbstractPage::$templateName
+        * @inheritDoc
         */
        public $templateName = 'categoryList';
        
        /**
-        * @see \wcf\page\AbstractPage::__run()
+        * @inheritDoc
         */
        public function __run() {
                $classNameParts = explode('\\', get_called_class());
@@ -92,7 +92,7 @@ abstract class AbstractCategoryListPage extends AbstractPage {
        }
        
        /**
-        * @see \wcf\page\IPage::assignVariables()
+        * @inheritDoc
         */
        public function assignVariables() {
                parent::assignVariables();
@@ -128,7 +128,7 @@ abstract class AbstractCategoryListPage extends AbstractPage {
        }
        
        /**
-        * @see \wcf\page\IPage::readData()
+        * @inheritDoc
         */
        public function readData() {
                $this->objectType = CategoryHandler::getInstance()->getObjectTypeByName($this->objectTypeName);