From: Matthias Schmidt Date: Sat, 26 Mar 2016 21:31:18 +0000 (+0100) Subject: Fix code/documentation issues X-Git-Tag: 3.0.0_Beta_1~1286^2~26 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=83aa1dc131afed003ab9be3f914b05b3a4dafe7e;p=GitHub%2FWoltLab%2FWCF.git Fix code/documentation issues --- diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php index 5666c88087..6a00acef07 100755 --- a/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php @@ -4,6 +4,7 @@ use wcf\data\user\group\UserGroupAction; use wcf\data\user\group\UserGroupEditor; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; +use wcf\system\option\user\group\UserGroupOptionHandler; use wcf\system\WCF; use wcf\system\WCFACP; use wcf\util\StringUtil; @@ -12,7 +13,7 @@ use wcf\util\StringUtil; * Shows the group add form. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage acp.form @@ -20,28 +21,28 @@ use wcf\util\StringUtil; */ class UserGroupAddForm extends AbstractOptionListForm { /** - * @see \wcf\page\AbstractPage::$activeMenuItem + * @inheritDoc */ public $activeMenuItem = 'wcf.acp.menu.link.group.add'; /** - * @see \wcf\page\AbstractPage::$neededPermissions + * @inheritDoc */ - public $neededPermissions = array('admin.user.canAddGroup'); + public $neededPermissions = ['admin.user.canAddGroup']; /** * option tree * @var array */ - public $optionTree = array(); + public $optionTree = []; /** - * @see \wcf\acp\form\AbstractOptionListForm::$optionHandlerClassName + * @inheritDoc */ - public $optionHandlerClassName = 'wcf\system\option\user\group\UserGroupOptionHandler'; + public $optionHandlerClassName = UserGroupOptionHandler::class; /** - * @see \wcf\acp\form\AbstractOptionListForm::$supportI18n + * @inheritDoc */ public $supportI18n = false; @@ -61,7 +62,7 @@ class UserGroupAddForm extends AbstractOptionListForm { * list of values of group 'Anyone' * @var array */ - public $defaultValues = array(); + public $defaultValues = []; /** * group priority @@ -82,7 +83,7 @@ class UserGroupAddForm extends AbstractOptionListForm { protected $showOnTeamPage = 0; /** - * @see \wcf\page\IPage::readParameters() + * @inheritDoc */ public function readParameters() { parent::readParameters(); @@ -92,7 +93,7 @@ class UserGroupAddForm extends AbstractOptionListForm { } /** - * @see \wcf\form\IForm::readFormParameters() + * @inheritDoc */ public function readFormParameters() { parent::readFormParameters(); @@ -108,7 +109,7 @@ class UserGroupAddForm extends AbstractOptionListForm { } /** - * @see \wcf\form\IForm::validate() + * @inheritDoc */ public function validate() { // validate dynamic options @@ -138,24 +139,24 @@ class UserGroupAddForm extends AbstractOptionListForm { } /** - * @see \wcf\form\IForm::save() + * @inheritDoc */ public function save() { parent::save(); $optionValues = $this->optionHandler->save(); - $data = array( - 'data' => array_merge($this->additionalFields, array( + $data = [ + 'data' => array_merge($this->additionalFields, [ 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'priority' => $this->priority, 'userOnlineMarking' => $this->userOnlineMarking, 'showOnTeamPage' => $this->showOnTeamPage - )), + ]), 'options' => $optionValues - ); - $this->objectAction = new UserGroupAction(array(), 'create', $data); + ]; + $this->objectAction = new UserGroupAction([], 'create', $data); $this->objectAction->executeAction(); $returnValues = $this->objectAction->getReturnValues(); $groupID = $returnValues['returnValues']->groupID; @@ -165,36 +166,35 @@ class UserGroupAddForm extends AbstractOptionListForm { // update group name $groupEditor = new UserGroupEditor($returnValues['returnValues']); - $groupEditor->update(array( + $groupEditor->update([ 'groupName' => 'wcf.acp.group.group'.$groupID - )); + ]); } if (!I18nHandler::getInstance()->isPlainValue('groupDescription')) { I18nHandler::getInstance()->save('groupDescription', 'wcf.acp.group.groupDescription'.$groupID, 'wcf.acp.group', 1); // update group name $groupEditor = new UserGroupEditor($returnValues['returnValues']); - $groupEditor->update(array( + $groupEditor->update([ 'groupDescription' => 'wcf.acp.group.groupDescription'.$groupID - )); + ]); } $this->saved(); // show success message - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); // reset values $this->groupName = ''; - $this->optionValues = array(); I18nHandler::getInstance()->reset(); } /** - * @see \wcf\page\IPage::readData() + * @inheritDoc */ public function readData() { parent::readData(); @@ -206,14 +206,14 @@ class UserGroupAddForm extends AbstractOptionListForm { } /** - * @see \wcf\page\IPage::assignVariables() + * @inheritDoc */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'optionTree' => $this->optionTree, @@ -221,11 +221,11 @@ class UserGroupAddForm extends AbstractOptionListForm { 'priority' => $this->priority, 'userOnlineMarking' => $this->userOnlineMarking, 'showOnTeamPage' => $this->showOnTeamPage - )); + ]); } /** - * @see \wcf\form\IForm::show() + * @inheritDoc */ public function show() { // check master password diff --git a/wcfsetup/install/files/lib/data/category/CategoryNodeTree.class.php b/wcfsetup/install/files/lib/data/category/CategoryNodeTree.class.php index efc7d22edd..a23a3d4c10 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryNodeTree.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryNodeTree.class.php @@ -14,6 +14,18 @@ use wcf\system\exception\SystemException; * @category Community Framework */ class CategoryNodeTree implements \IteratorAggregate { + /** + * list of ids of categories which will not be inluded in the node tree + * @var integer[] + */ + protected $excludedCategoryIDs = []; + + /** + * if true, disabled categories are also included in the node tree + * @var boolean + */ + protected $includeDisabledCategories = false; + /** * maximum depth considered when building the node tree * @var integer diff --git a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php index 0fdd1075af..ef1255bd39 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php @@ -124,7 +124,7 @@ class CommentAction extends AbstractDatabaseObjectAction { $likeObjectIDs = array_merge($likeObjectIDs, $objectIDs); // delete notifications - $objectType = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID); + $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID); if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.notification')) { UserNotificationHandler::getInstance()->removeNotifications($objectType->objectType.'.notification', $objectIDs); } diff --git a/wcfsetup/install/files/lib/data/media/MediaAction.class.php b/wcfsetup/install/files/lib/data/media/MediaAction.class.php index 6f224f1335..d968ec3610 100644 --- a/wcfsetup/install/files/lib/data/media/MediaAction.class.php +++ b/wcfsetup/install/files/lib/data/media/MediaAction.class.php @@ -388,7 +388,6 @@ class MediaAction extends AbstractDatabaseObjectAction implements ISearchAction, if (!empty($this->parameters['fileType'])) { $mediaList->addDefaultFileTypeFilter($this->parameters['fileType']); } - $mediaList->getConditionBuilder()->add($searchConditionBuilder->__toString(), $searchConditionBuilder->getParameters()); if (!empty($this->parameters['fileTypeFilters'])) { $mediaList->addFileTypeFilters($this->parameters['fileTypeFilters']); } diff --git a/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php b/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php index 2d8055b607..904f132607 100644 --- a/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php +++ b/wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php @@ -10,7 +10,7 @@ use wcf\system\WCF; * Executes user notification-related actions. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage data.user.notification @@ -19,12 +19,12 @@ use wcf\system\WCF; class UserNotificationAction extends AbstractDatabaseObjectAction { /** * notification editor object - * @var \wcf\data\user\notification\UserNotificationEditor + * @var UserNotificationEditor */ public $notificationEditor = null; /** - * @see \wcf\data\AbstractDatabaseObjectAction::create() + * @inheritDoc */ public function create() { $notification = parent::create(); @@ -33,10 +33,10 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { (notificationID, userID) VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $notification->notificationID, $notification->userID - )); + ]); return $notification; } @@ -47,15 +47,16 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { * @return array */ public function createDefault() { + $notifications = []; foreach ($this->parameters['recipients'] as $recipient) { $this->parameters['data']['userID'] = $recipient->userID; $this->parameters['data']['mailNotified'] = (($recipient->mailNotificationType == 'none' || $recipient->mailNotificationType == 'instant') ? 1 : 0); $notification = $this->create(); - $notifications[$recipient->userID] = array( + $notifications[$recipient->userID] = [ 'isNew' => true, 'object' => $notification - ); + ]; } // insert author @@ -66,11 +67,11 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { WCF::getDB()->beginTransaction(); foreach ($notifications as $notificationData) { - $statement->execute(array( + $statement->execute([ $notificationData['object']->notificationID, $this->parameters['authorID'] ?: null, TIME_NOW - )); + ]); } WCF::getDB()->commitTransaction(); @@ -85,17 +86,17 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { public function createStackable() { // get existing notifications $notificationList = new UserNotificationList(); - $notificationList->getConditionBuilder()->add("eventID = ?", array($this->parameters['data']['eventID'])); - $notificationList->getConditionBuilder()->add("eventHash = ?", array($this->parameters['data']['eventHash'])); - $notificationList->getConditionBuilder()->add("userID IN (?)", array(array_keys($this->parameters['recipients']))); - $notificationList->getConditionBuilder()->add("confirmTime = ?", array(0)); + $notificationList->getConditionBuilder()->add("eventID = ?", [$this->parameters['data']['eventID']]); + $notificationList->getConditionBuilder()->add("eventHash = ?", [$this->parameters['data']['eventHash']]); + $notificationList->getConditionBuilder()->add("userID IN (?)", [array_keys($this->parameters['recipients'])]); + $notificationList->getConditionBuilder()->add("confirmTime = ?", [0]); $notificationList->readObjects(); - $existingNotifications = array(); + $existingNotifications = []; foreach ($notificationList as $notification) { $existingNotifications[$notification->userID] = $notification; } - $notifications = array(); + $notifications = []; foreach ($this->parameters['recipients'] as $recipient) { $notification = (isset($existingNotifications[$recipient->userID]) ? $existingNotifications[$recipient->userID] : null); $isNew = ($notification === null); @@ -106,10 +107,10 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { $notification = $this->create(); } - $notifications[$recipient->userID] = array( + $notifications[$recipient->userID] = [ 'isNew' => $isNew, 'object' => $notification - ); + ]; } uasort($notifications, function ($a, $b) { @@ -131,11 +132,11 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { WCF::getDB()->beginTransaction(); foreach ($notifications as $notificationData) { - $statement->execute(array( + $statement->execute([ $notificationData['object']->notificationID, $this->parameters['authorID'] ?: null, TIME_NOW - )); + ]); } WCF::getDB()->commitTransaction(); @@ -148,11 +149,11 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { WCF::getDB()->beginTransaction(); foreach ($notifications as $notificationData) { - $statement->execute(array( + $statement->execute([ 1, $this->parameters['authorID'] ? 0 : 1, $notificationData['object']->notificationID - )); + ]); } WCF::getDB()->commitTransaction(); @@ -173,14 +174,14 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { */ public function getOutstandingNotifications() { $notifications = UserNotificationHandler::getInstance()->getMixedNotifications(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'notifications' => $notifications - )); + ]); - return array( + return [ 'template' => WCF::getTPL()->fetch('notificationListUserPanel'), 'totalCount' => $notifications['notificationCount'] - ); + ]; } /** @@ -201,19 +202,23 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { public function markAsConfirmed() { UserNotificationHandler::getInstance()->markAsConfirmedByID($this->notificationEditor->notificationID); - return array( + return [ 'markAsRead' => $this->notificationEditor->notificationID, 'totalCount' => UserNotificationHandler::getInstance()->getNotificationCount(true) - ); + ]; } /** * Validates parameters to mark all notifications of current user as confirmed. */ - public function validateMarkAllAsConfirmed() { /* does nothing */ } + public function validateMarkAllAsConfirmed() { + // does nothing + } /** * Marks all notifications of current user as confirmed. + * + * @return boolean[] */ public function markAllAsConfirmed() { // remove notifications for this user @@ -221,22 +226,22 @@ class UserNotificationAction extends AbstractDatabaseObjectAction { SET confirmTime = ? WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ TIME_NOW, WCF::getUser()->userID - )); + ]); // delete notification_to_user assignments (mimic legacy notification system) $sql = "DELETE FROM wcf".WCF_N."_user_notification_to_user WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); // reset notification count - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'userNotificationCount'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'userNotificationCount'); - return array( + return [ 'markAllAsRead' => true - ); + ]; } } diff --git a/wcfsetup/install/files/lib/form/AbstractModerationForm.class.php b/wcfsetup/install/files/lib/form/AbstractModerationForm.class.php index 0d9a97d141..f5fa8446e3 100644 --- a/wcfsetup/install/files/lib/form/AbstractModerationForm.class.php +++ b/wcfsetup/install/files/lib/form/AbstractModerationForm.class.php @@ -1,8 +1,10 @@ * @package com.woltlab.wcf * @subpackage form @@ -24,14 +24,14 @@ use wcf\util\StringUtil; */ class UserSearchForm extends UserOptionListForm { /** - * @see \wcf\page\AbstractPage::$activeMenuItem + * @inheritDoc */ public $activeMenuItem = 'wcf.user.search'; /** - * @see \wcf\page\AbstractPage::$neededModules + * @inheritDoc */ - public $neededModules = array('MODULE_MEMBERS_LIST'); + public $neededModules = ['MODULE_MEMBERS_LIST']; /** * username @@ -41,9 +41,9 @@ class UserSearchForm extends UserOptionListForm { /** * matches - * @var array + * @var integer[] */ - public $matches = array(); + public $matches = []; /** * condition builder object @@ -64,7 +64,13 @@ class UserSearchForm extends UserOptionListForm { public $maxResults = 1000; /** - * @see \wcf\form\IForm::readFormParameters() + * option tree + * @var array + */ + public $optionTree = []; + + /** + * @inheritDoc */ public function readFormParameters() { parent::readFormParameters(); @@ -73,7 +79,7 @@ class UserSearchForm extends UserOptionListForm { } /** - * @see \wcf\acp\form\AbstractOptionListForm::initOptionHandler() + * @inheritDoc */ protected function initOptionHandler() { $this->optionHandler->enableSearchMode(); @@ -81,7 +87,7 @@ class UserSearchForm extends UserOptionListForm { } /** - * @see \wcf\page\IPage::readData() + * @inheritDoc */ public function readData() { parent::readData(); @@ -100,47 +106,47 @@ class UserSearchForm extends UserOptionListForm { } /** - * @see \wcf\page\IPage::assignVariables() + * @inheritDoc */ public function assignVariables() { parent::assignVariables(); DashboardHandler::getInstance()->loadBoxes('com.woltlab.wcf.user.MembersListPage', $this); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'username' => $this->username, 'optionTree' => $this->optionTree, 'sidebarCollapsed' => UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'com.woltlab.wcf.user.MembersListPage'), 'sidebarName' => 'com.woltlab.wcf.user.MembersListPage' - )); + ]); } /** - * @see \wcf\form\IForm::save() + * @inheritDoc */ public function save() { parent::save(); // store search result in database - $search = SearchEditor::create(array( + $search = SearchEditor::create([ 'userID' => WCF::getUser()->userID ?: null, - 'searchData' => serialize(array('matches' => $this->matches)), + 'searchData' => serialize(['matches' => $this->matches]), 'searchTime' => TIME_NOW, 'searchType' => 'users' - )); + ]); // get new search id $this->searchID = $search->searchID; $this->saved(); // forward to result page - $url = LinkHandler::getInstance()->getLink('MembersList', array('id' => $this->searchID)); + $url = LinkHandler::getInstance()->getLink('MembersList', ['id' => $this->searchID]); HeaderUtil::redirect($url); exit; } /** - * @see \wcf\form\IForm::validate() + * @inheritDoc */ public function validate() { AbstractForm::validate(); @@ -157,7 +163,7 @@ class UserSearchForm extends UserOptionListForm { * Search for users which fit to the search values. */ protected function search() { - $this->matches = array(); + $this->matches = []; $sql = "SELECT user_table.userID FROM wcf".WCF_N."_user user_table LEFT JOIN wcf".WCF_N."_user_option_value option_value @@ -190,7 +196,7 @@ class UserSearchForm extends UserOptionListForm { */ protected function buildStaticConditions() { if (!empty($this->username)) { - $this->conditions->add("user_table.username LIKE ?", array('%'.addcslashes($this->username, '_%').'%')); + $this->conditions->add("user_table.username LIKE ?", ['%'.addcslashes($this->username, '_%').'%']); } } diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php index 9f2f612256..8192cb668f 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php @@ -18,12 +18,6 @@ use wcf\util\StringUtil; * @since 2.2 */ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction { - /** - * email text - * @var string - */ - public $email = ''; - /** * is 1 if HTML for the email is enabled * @var integer @@ -42,6 +36,12 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction */ public $mailID = ''; + /** + * email subject + * @var string + */ + public $subject = ''; + /** * email text * @var string diff --git a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php index 130d850223..ea2101d2b4 100644 --- a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php +++ b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php @@ -20,7 +20,7 @@ use wcf\system\WCF; * Provides methods for comment object handling. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.comment @@ -34,13 +34,13 @@ class CommentHandler extends SingletonFactory { protected $cache = null; /** - * @see \wcf\system\SingletonFactory::init() + * @inheritDoc */ protected function init() { - $this->cache = array( - 'objectTypes' => array(), - 'objectTypeIDs' => array() - ); + $this->cache = [ + 'objectTypes' => [], + 'objectTypeIDs' => [] + ]; $cache = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.comment.commentableContent'); foreach ($cache as $objectType) { @@ -67,7 +67,7 @@ class CommentHandler extends SingletonFactory { * Returns the object type for a given object type id. * * @param integer $objectTypeID - * @return \wcf\data\object\type\ObjectType + * @return ObjectType */ public function getObjectType($objectTypeID) { if (isset($this->cache['objectTypes'][$objectTypeID])) { @@ -81,7 +81,7 @@ class CommentHandler extends SingletonFactory { * Returns comment manager object for given object type. * * @param string $objectType - * @return \wcf\system\comment\manager\ICommentManager + * @return ICommentManager */ public function getCommentManager($objectType) { $objectTypeID = $this->getObjectTypeID($objectType); @@ -96,11 +96,11 @@ class CommentHandler extends SingletonFactory { /** * Returns a comment list for a given object type and object id. * - * @param \wcf\data\comment\manager\ICommentManager $commentManager - * @param integer $objectTypeID - * @param integer $objectID - * @param boolean $readObjects - * @return \wcf\data\comment\StructuredCommentList + * @param ICommentManager $commentManager + * @param integer $objectTypeID + * @param integer $objectID + * @param boolean $readObjects + * @return StructuredCommentList */ public function getCommentList(ICommentManager $commentManager, $objectTypeID, $objectID, $readObjects = true) { $commentList = new StructuredCommentList($commentManager, $objectTypeID, $objectID); @@ -115,7 +115,7 @@ class CommentHandler extends SingletonFactory { * Removes all comments for given objects. * * @param string $objectType - * @param array $objectIDs + * @param integer[] $objectIDs */ public function deleteObjects($objectType, array $objectIDs) { $objectTypeID = $this->getObjectTypeID($objectType); @@ -123,8 +123,8 @@ class CommentHandler extends SingletonFactory { // get comment ids $commentList = new CommentList(); - $commentList->getConditionBuilder()->add('comment.objectTypeID = ?', array($objectTypeID)); - $commentList->getConditionBuilder()->add('comment.objectID IN (?)', array($objectIDs)); + $commentList->getConditionBuilder()->add('comment.objectTypeID = ?', [$objectTypeID]); + $commentList->getConditionBuilder()->add('comment.objectID IN (?)', [$objectIDs]); $commentList->readObjectIDs(); $commentIDs = $commentList->getObjectIDs(); @@ -133,12 +133,12 @@ class CommentHandler extends SingletonFactory { // get response ids $responseList = new CommentResponseList(); - $responseList->getConditionBuilder()->add('comment_response.commentID IN (?)', array($commentIDs)); + $responseList->getConditionBuilder()->add('comment_response.commentID IN (?)', [$commentIDs]); $responseList->readObjectIDs(); $responseIDs = $responseList->getObjectIDs(); // delete likes - $notificationObjectTypes = array(); + $notificationObjectTypes = []; if (UserNotificationHandler::getInstance()->getObjectTypeID($objectTypeObj->objectType.'.like.notification')) { $notificationObjectTypes[] = $objectTypeObj->objectType.'.like.notification'; } @@ -156,7 +156,7 @@ class CommentHandler extends SingletonFactory { if (!empty($responseIDs)) { // delete likes (for responses) - $notificationObjectTypes = array(); + $notificationObjectTypes = []; if (UserNotificationHandler::getInstance()->getObjectTypeID($objectTypeObj->objectType.'.response.like.notification')) { $notificationObjectTypes[] = $objectTypeObj->objectType.'.response.like.notification'; } @@ -190,9 +190,9 @@ class CommentHandler extends SingletonFactory { $lastCommentTime = WCF::getSession()->getVar('lastCommentTime'); if ($lastCommentTime && $lastCommentTime + WCF::getSession()->getPermission('user.comment.floodControlTime') > TIME_NOW) { - throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', array( + throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', [ 'lastCommentTime' => $lastCommentTime - ))); + ])); } return; @@ -205,12 +205,12 @@ class CommentHandler extends SingletonFactory { AND time > ? ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array( + $statement->execute([ WCF::getUser()->userID, (TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime')) - )); + ]); if (($row = $statement->fetchArray()) !== false) { - throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', array('lastCommentTime' => $row['time']))); + throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', ['lastCommentTime' => $row['time']])); } else { // check for comment response @@ -220,12 +220,12 @@ class CommentHandler extends SingletonFactory { AND time > ? ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array( + $statement->execute([ WCF::getUser()->userID, (TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime')) - )); + ]); if (($row = $statement->fetchArray()) !== false) { - throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', array('lastCommentTime' => $row['time']))); + throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', ['lastCommentTime' => $row['time']])); } } } @@ -240,7 +240,7 @@ class CommentHandler extends SingletonFactory { if (ENABLE_CENSORSHIP) { $result = Censorship::getInstance()->test($text); if ($result) { - throw new UserInputException('text', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', array('censoredWords' => $result))); + throw new UserInputException('text', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', ['censoredWords' => $result])); } } } diff --git a/wcfsetup/install/files/lib/system/email/Email.class.php b/wcfsetup/install/files/lib/system/email/Email.class.php index dbebae4ae8..86c26c3de8 100644 --- a/wcfsetup/install/files/lib/system/email/Email.class.php +++ b/wcfsetup/install/files/lib/system/email/Email.class.php @@ -189,7 +189,7 @@ class Email { throw new SystemException("The given message id '".$messageID."' is invalid. Note: You must not specify the part right of the at sign (@)."); } if (strlen($messageID) > 50) { - throw new SystemException("The given message id '".$message."' is not allowed. The maximum allowed length is 50 bytes."); + throw new SystemException("The given message id '".$messageID."' is not allowed. The maximum allowed length is 50 bytes."); } $this->messageID = $messageID; diff --git a/wcfsetup/install/files/lib/system/language/I18nHandler.class.php b/wcfsetup/install/files/lib/system/language/I18nHandler.class.php index 659cb45ced..6b13da2833 100644 --- a/wcfsetup/install/files/lib/system/language/I18nHandler.class.php +++ b/wcfsetup/install/files/lib/system/language/I18nHandler.class.php @@ -1,5 +1,6 @@ * @package com.woltlab.wcf * @subpackage system.language @@ -20,42 +21,42 @@ use wcf\util\StringUtil; class I18nHandler extends SingletonFactory { /** * list of available languages - * @var array<\wcf\data\language\Language> + * @var Language[] */ - protected $availableLanguages = array(); + protected $availableLanguages = []; /** * list of element ids - * @var array + * @var string[] */ - protected $elementIDs = array(); + protected $elementIDs = []; /** * list of plain values for elements - * @var array + * @var string[] */ - protected $plainValues = array(); + protected $plainValues = []; /** * i18n values for elements - * @var array + * @var string[][] */ - protected $i18nValues = array(); + protected $i18nValues = []; /** * element options * @var array */ - protected $elementOptions = array(); + protected $elementOptions = []; /** * language variable regex object - * @var \wcf\system\Regex + * @var Regex */ protected $regex = null; /** - * @see \wcf\system\SingletonFactory::init() + * @inheritDoc */ protected function init() { $this->availableLanguages = LanguageFactory::getInstance()->getLanguages(); @@ -64,7 +65,7 @@ class I18nHandler extends SingletonFactory { /** * Registers a new element id, returns false if element id is already set. * - * @param string elementID + * @param string $elementID * @return boolean */ public function register($elementID) { @@ -89,7 +90,7 @@ class I18nHandler extends SingletonFactory { $i18nElementID = $elementID . '_i18n'; if (isset($_POST[$i18nElementID]) && is_array($_POST[$i18nElementID])) { - $this->i18nValues[$elementID] = array(); + $this->i18nValues[$elementID] = []; foreach ($_POST[$i18nElementID] as $languageID => $value) { $this->i18nValues[$elementID][$languageID] = StringUtil::unifyNewlines(StringUtil::trim($value)); @@ -105,7 +106,7 @@ class I18nHandler extends SingletonFactory { /** * Returns true if given element has disabled i18n functionality. * - * @param string elementID + * @param string $elementID * @return boolean */ public function isPlainValue($elementID) { @@ -118,6 +119,8 @@ class I18nHandler extends SingletonFactory { /** * Returns true if given element has enabled i18n functionality. + * + * @return boolean */ public function hasI18nValues($elementID) { if (isset($this->i18nValues[$elementID])) { @@ -130,7 +133,7 @@ class I18nHandler extends SingletonFactory { /** * Returns the plain value for the given element. * - * @param string elementID + * @param string $elementID * @return string * @see \wcf\system\language\I18nHandler::isPlainValue() */ @@ -143,8 +146,8 @@ class I18nHandler extends SingletonFactory { * the multilingual values are returned, otherweise the plain value is * returned for each language id. * - * @param string elementID - * @return array + * @param string $elementID + * @return string[] */ public function getValues($elementID) { if ($this->hasI18nValues($elementID)) { @@ -153,7 +156,7 @@ class I18nHandler extends SingletonFactory { $plainValue = $this->getValue($elementID); - $values = array(); + $values = []; foreach ($this->availableLanguages as $language) { $values[$language->languageID] = $plainValue; } @@ -173,7 +176,7 @@ class I18nHandler extends SingletonFactory { throw new SystemException('Invalid argument for parameter $plainValue', 0, 'Expected string. '.ucfirst(gettype($plainValue)).' given.'); } if (!$this->isPlainValue($elementID)) { - $i18nValues = array(); + $i18nValues = []; foreach ($this->availableLanguages as $language) { $i18nValues[$language->languageID] = StringUtil::trim($plainValue); } @@ -260,7 +263,7 @@ class I18nHandler extends SingletonFactory { FROM wcf".WCF_N."_language_category WHERE languageCategory = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($languageCategory)); + $statement->execute([$languageCategory]); $row = $statement->fetchArray(); $languageCategoryID = $row['languageCategoryID']; @@ -272,20 +275,20 @@ class I18nHandler extends SingletonFactory { } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("languageID IN (?)", array($languageIDs)); - $conditions->add("languageItem = ?", array($languageVariable)); + $conditions->add("languageID IN (?)", [$languageIDs]); + $conditions->add("languageItem = ?", [$languageVariable]); $sql = "SELECT languageItemID, languageID FROM wcf".WCF_N."_language_item ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $languageItemIDs = array(); + $languageItemIDs = []; while ($row = $statement->fetchArray()) { $languageItemIDs[$row['languageID']] = $row['languageItemID']; } - $insertLanguageIDs = $updateLanguageIDs = array(); + $insertLanguageIDs = $updateLanguageIDs = []; foreach ($languageIDs as $languageID) { if (isset($languageItemIDs[$languageID])) { $updateLanguageIDs[] = $languageID; @@ -303,14 +306,14 @@ class I18nHandler extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); foreach ($insertLanguageIDs as $languageID) { - $statement->execute(array( + $statement->execute([ $languageID, $languageVariable, (isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID]), 0, $languageCategoryID, $packageID - )); + ]); } } @@ -323,11 +326,11 @@ class I18nHandler extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); foreach ($updateLanguageIDs as $languageID) { - $statement->execute(array( + $statement->execute([ (isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID]), 0, $languageItemIDs[$languageID] - )); + ]); } } @@ -344,7 +347,7 @@ class I18nHandler extends SingletonFactory { $sql = "DELETE FROM wcf".WCF_N."_language_item WHERE languageItem = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($languageVariable)); + $statement->execute([$languageVariable]); // reset language cache LanguageFactory::getInstance()->deleteLanguageCache(); @@ -354,15 +357,16 @@ class I18nHandler extends SingletonFactory { * Sets additional options for elements, required if updating values. * * @param integer $elementID + * @param integer $pckageID * @param string $value * @param string $pattern */ public function setOptions($elementID, $packageID, $value, $pattern) { - $this->elementOptions[$elementID] = array( + $this->elementOptions[$elementID] = [ 'packageID' => $packageID, 'pattern' => $pattern, 'value' => $value - ); + ]; } /** @@ -372,12 +376,12 @@ class I18nHandler extends SingletonFactory { * @param boolean $useRequestData */ public function assignVariables($useRequestData = true) { - $elementValues = array(); - $elementValuesI18n = array(); + $elementValues = []; + $elementValuesI18n = []; foreach ($this->elementIDs as $elementID) { $value = ''; - $i18nValues = array(); + $i18nValues = []; // use POST values instead of querying database if ($useRequestData) { @@ -393,7 +397,7 @@ class I18nHandler extends SingletonFactory { } } else { - $i18nValues = array(); + $i18nValues = []; } } } @@ -410,9 +414,9 @@ class I18nHandler extends SingletonFactory { FROM wcf".WCF_N."_language_item WHERE languageItem = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->elementOptions[$elementID]['value'] - )); + ]); while ($row = $statement->fetchArray()) { $languageItemValue = StringUtil::unifyNewlines($row['languageItemValue']); $i18nValues[$row['languageID']] = StringUtil::encodeJS($languageItemValue); @@ -437,18 +441,18 @@ class I18nHandler extends SingletonFactory { $elementValuesI18n[$elementID] = $i18nValues; } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'availableLanguages' => $this->availableLanguages, 'i18nPlainValues' => $elementValues, 'i18nValues' => $elementValuesI18n - )); + ]); } /** * Resets internally stored data after creating a new object through a form. */ public function reset() { - $this->i18nValues = $this->plainValues = array(); + $this->i18nValues = $this->plainValues = []; } /** diff --git a/wcfsetup/install/files/lib/system/option/ISearchableUserOption.class.php b/wcfsetup/install/files/lib/system/option/ISearchableUserOption.class.php index 7f66c83617..c5a3cf7d75 100644 --- a/wcfsetup/install/files/lib/system/option/ISearchableUserOption.class.php +++ b/wcfsetup/install/files/lib/system/option/ISearchableUserOption.class.php @@ -7,7 +7,7 @@ use wcf\system\database\util\PreparedStatementConditionBuilder; * Any searchable option type should implement this interface. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.option @@ -17,18 +17,18 @@ interface ISearchableUserOption { /** * Returns the html code for the search form element of this option. * - * @param \wcf\data\option\Option $option - * @param string $value - * @return string html + * @param Option $option + * @param string $value + * @return string html */ public function getSearchFormElement(Option $option, $value); /** * Returns a condition for search sql query. * - * @param \wcf\system\database\condition\PreparedStatementConditionBuilder $conditions - * @param \wcf\data\option\Option $option - * @param mixed $value + * @param PreparedStatementConditionBuilder $conditions + * @param Option $option + * @param mixed $value * @return boolean */ public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value); diff --git a/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php index f1a4c41a4c..af195827e1 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php @@ -160,7 +160,7 @@ class PackageUninstallationDispatcher extends PackageInstallationDispatcher { * @param string $targetDir * @param string $files * @param boolean $deleteEmptyDirectories - * @param booelan $deleteEmptyTargetDir + * @param boolean $deleteEmptyTargetDir */ public function deleteFiles($targetDir, $files, $deleteEmptyTargetDir = false, $deleteEmptyDirectories = true) { new Uninstaller($targetDir, $files, $deleteEmptyTargetDir, $deleteEmptyDirectories); diff --git a/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php index 0122ea7d1c..93eef24058 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php @@ -20,7 +20,7 @@ use wcf\util\StringUtil; * {pages page=8 pages=10 link='page-%d.html' assign='output' print=true} * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.template.plugin @@ -60,18 +60,18 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin { protected function makeLink($link, $pageNo, $activePage, $pages) { // first page if ($activePage != $pageNo) { - return '
  • '.StringUtil::formatInteger($pageNo).'
  • '."\n"; + return '
  • '.StringUtil::formatInteger($pageNo).'
  • '."\n"; } else { - return '
  • '.StringUtil::formatInteger($pageNo).'
  • '."\n"; + return '
  • '.StringUtil::formatInteger($pageNo).'
  • '."\n"; } } /** * Generates HTML code for 'previous' link. * - * @param type $link - * @param type $pageNo + * @param string $link + * @param integer $pageNo * @return string */ protected function makePreviousLink($link, $pageNo) { @@ -86,8 +86,8 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin { /** * Generates HTML code for 'next' link. * - * @param type $link - * @param type $pageNo + * @param string $link + * @param integer $pageNo * @return string */ protected function makeNextLink($link, $pageNo, $pages) { @@ -100,7 +100,7 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin { } /** - * @see \wcf\system\template\IFunctionTemplatePlugin::execute() + * @inheritDoc */ public function execute($tagArgs, TemplateEngine $tplObj) { // needed params: controller, link, page, pages @@ -116,7 +116,7 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin { if ($tagArgs['pages'] > 1) { // create and encode route link - $parameters = array(); + $parameters = []; if (isset($tagArgs['id'])) $parameters['id'] = $tagArgs['id']; if (isset($tagArgs['title'])) $parameters['title'] = $tagArgs['title']; if (isset($tagArgs['object'])) $parameters['object'] = $tagArgs['object'];