From: Matthias Schmidt Date: Sat, 21 May 2016 08:54:22 +0000 (+0200) Subject: Replace old array syntax with new syntax X-Git-Tag: 3.0.0_Beta_1~1693 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=058cbd6a9e3de5a1bc076f44b37a2b03c14713e4;p=GitHub%2FWoltLab%2FWCF.git Replace old array syntax with new syntax --- diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 3da6367ac2..622b83f699 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -19,7 +19,7 @@ set_exception_handler('handleException'); set_error_handler('handleError', E_ALL); // define list of needed file -$neededFilesPattern = array( +$neededFilesPattern = [ '!^setup/.*!', '!^install/files/acp/images/wcfLogo.*!', '!^install/files/acp/style/setup/.*!', @@ -29,7 +29,7 @@ $neededFilesPattern = array( '!^install/files/lib/system/.*!', '!^install/files/lib/util/.*!', '!^install/lang/.*!', - '!^install/packages/.*!'); + '!^install/packages/.*!']; // define needed functions and classes /** @@ -383,7 +383,7 @@ class BasicFileUtil { */ class Tar { protected $archiveName = ''; - protected $contentList = array(); + protected $contentList = []; protected $opened = false; protected $read = false; protected $file = null; @@ -588,7 +588,7 @@ class Tar { * This does not get the entire to memory but only parts of it. */ protected function readContent() { - $this->contentList = array(); + $this->contentList = []; $this->read = true; $i = 0; @@ -636,7 +636,7 @@ class Tar { return false; } - $header = array(); + $header = []; $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) { diff --git a/wcfsetup/install/files/font/getFont.php b/wcfsetup/install/files/font/getFont.php index 94ccf37e8e..5d8af3ff74 100644 --- a/wcfsetup/install/files/font/getFont.php +++ b/wcfsetup/install/files/font/getFont.php @@ -12,12 +12,12 @@ */ // list of known font types -$types = array( +$types = [ 'eot' => 'application/vnd.ms-fontobject', 'ttf' => 'application/octet-stream', 'woff' => 'application/x-woff', // best supported, but this is not the right one according to http://www.w3.org/TR/WOFF/#appendix-b 'woff2' => 'font/woff2' // the specs at http://dev.w3.org/webfonts/WOFF2/spec/ are not perfectly clear, but font/woff2 seems to be the most sane one and is currently used by Google Fonts -); +]; // get parameters $type = $_GET['type']; diff --git a/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php b/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php index 4358363adb..a7059a5619 100644 --- a/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php @@ -21,7 +21,7 @@ class CacheClearAction extends AbstractAction { /** * @see \wcf\action\AbstractAction::$neededPermissions */ - public $neededPermissions = array('admin.management.canViewLog'); + public $neededPermissions = ['admin.management.canViewLog']; /** * @see \wcf\action\IAction::execute() diff --git a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php index 02e79e386c..46620c15a7 100755 --- a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php @@ -74,14 +74,14 @@ class InstallPackageAction extends AbstractDialogAction { $queueID = $this->installation->nodeBuilder->getQueueByNode($this->installation->queue->processNo, $step->getNode()); if ($step->hasDocument()) { - $this->data = array( + $this->data = [ 'currentAction' => $this->getCurrentAction($queueID), 'innerTemplate' => $step->getTemplate(), 'node' => $step->getNode(), 'progress' => $this->installation->nodeBuilder->calculateProgress($this->node), 'step' => 'install', 'queueID' => $queueID - ); + ]; } else { if ($step->getNode() == '') { @@ -115,7 +115,7 @@ class InstallPackageAction extends AbstractDialogAction { FROM wcf".WCF_N."_application WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); + $statement->execute([$packageID]); $application = $statement->fetchObject('wcf\data\application\Application'); // build redirect location @@ -124,25 +124,25 @@ class InstallPackageAction extends AbstractDialogAction { WCF::resetZendOpcache(); // show success - $this->data = array( + $this->data = [ 'currentAction' => $this->getCurrentAction(null), 'progress' => 100, 'redirectLocation' => $location, 'step' => 'success' - ); + ]; return; } WCF::resetZendOpcache(); // continue with next node - $this->data = array( + $this->data = [ 'currentAction' => $this->getCurrentAction($queueID), 'step' => 'install', 'node' => $step->getNode(), 'progress' => $this->installation->nodeBuilder->calculateProgress($this->node), 'queueID' => $queueID - ); + ]; } } @@ -161,19 +161,19 @@ class InstallPackageAction extends AbstractDialogAction { $nextNode = $this->installation->nodeBuilder->getNextNode(); $queueID = $this->installation->nodeBuilder->getQueueByNode($this->installation->queue->processNo, $nextNode); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'installationType' => $this->queue->action, 'packageName' => $this->installation->queue->packageName - )); + ]); - $this->data = array( + $this->data = [ 'template' => WCF::getTPL()->fetch($this->templateName), 'step' => 'install', 'node' => $nextNode, 'currentAction' => $this->getCurrentAction($queueID), 'progress' => 0, 'queueID' => $queueID - ); + ]; } /** @@ -182,10 +182,10 @@ class InstallPackageAction extends AbstractDialogAction { * @return array */ protected function stepRollback() { - $this->data = array( + $this->data = [ 'packageID' => $this->queue->packageID, 'step' => 'rollback' - ); + ]; } /** @@ -220,7 +220,7 @@ class InstallPackageAction extends AbstractDialogAction { // build package name $packageName = $this->installation->nodeBuilder->getPackageNameByQueue($queueID); $installationType = $this->installation->nodeBuilder->getInstallationTypeByQueue($queueID); - $currentAction = WCF::getLanguage()->getDynamicVariable('wcf.acp.package.installation.step.'.$installationType, array('packageName' => $packageName)); + $currentAction = WCF::getLanguage()->getDynamicVariable('wcf.acp.package.installation.step.'.$installationType, ['packageName' => $packageName]); } return $currentAction; diff --git a/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php index 7993a3f8c9..b3a7b3fb7a 100644 --- a/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php @@ -67,13 +67,13 @@ class UninstallPackageAction extends InstallPackageAction { $processNo = PackageInstallationQueue::getNewProcessNo(); // create queue - $queue = PackageInstallationQueueEditor::create(array( + $queue = PackageInstallationQueueEditor::create([ 'processNo' => $processNo, 'userID' => WCF::getUser()->userID, 'packageName' => $package->getName(), 'packageID' => $package->packageID, 'action' => 'uninstall' - )); + ]); // initialize uninstallation $this->installation = new PackageUninstallationDispatcher($queue); @@ -81,19 +81,19 @@ class UninstallPackageAction extends InstallPackageAction { $this->installation->nodeBuilder->purgeNodes(); $this->installation->nodeBuilder->buildNodes(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'queue' => $queue - )); + ]); $queueID = $this->installation->nodeBuilder->getQueueByNode($queue->processNo, $this->installation->nodeBuilder->getNextNode()); - $this->data = array( + $this->data = [ 'template' => WCF::getTPL()->fetch($this->templateName), 'step' => 'uninstall', 'node' => $this->installation->nodeBuilder->getNextNode(), 'currentAction' => $this->getCurrentAction($queueID), 'progress' => 0, 'queueID' => $queueID - ); + ]; } /** @@ -131,30 +131,30 @@ class UninstallPackageAction extends InstallPackageAction { FROM wcf".WCF_N."_application WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); + $statement->execute([$packageID]); $application = $statement->fetchObject('wcf\data\application\Application'); // build redirect location $location = $application->getPageURL() . 'acp/index.php?package-list/'; // show success - $this->data = array( + $this->data = [ 'currentAction' => WCF::getLanguage()->get('wcf.acp.package.uninstallation.step.success'), 'progress' => 100, 'redirectLocation' => $location, 'step' => 'success' - ); + ]; return; } // continue with next node $queueID = $this->installation->nodeBuilder->getQueueByNode($this->installation->queue->processNo, $this->installation->nodeBuilder->getNextNode($this->node)); - $this->data = array( + $this->data = [ 'step' => 'uninstall', 'node' => $node, 'progress' => $this->installation->nodeBuilder->calculateProgress($this->node), 'queueID' => $queueID - ); + ]; } /** @@ -185,7 +185,7 @@ class UninstallPackageAction extends InstallPackageAction { // build package name $packageName = $this->installation->nodeBuilder->getPackageNameByQueue($queueID); $installationType = $this->installation->nodeBuilder->getInstallationTypeByQueue($queueID); - $currentAction = WCF::getLanguage()->getDynamicVariable('wcf.acp.package.uninstallation.step.'.$installationType, array('packageName' => $packageName)); + $currentAction = WCF::getLanguage()->getDynamicVariable('wcf.acp.package.uninstallation.step.'.$installationType, ['packageName' => $packageName]); } return $currentAction; diff --git a/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php b/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php index 4acc62fcde..04314614d0 100644 --- a/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/UserQuickSearchAction.class.php @@ -22,7 +22,7 @@ class UserQuickSearchAction extends AbstractAction { /** * @see \wcf\action\AbstractAction::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditUser'); + public $neededPermissions = ['admin.user.canEditUser']; /** * search mode @@ -34,7 +34,7 @@ class UserQuickSearchAction extends AbstractAction { * matches * @var integer[] */ - public $matches = array(); + public $matches = []; /** * results per page @@ -46,7 +46,7 @@ class UserQuickSearchAction extends AbstractAction { * shown columns * @var string[] */ - public $columns = array('registrationDate', 'lastActivityTime'); + public $columns = ['registrationDate', 'lastActivityTime']; /** * sort field @@ -96,7 +96,7 @@ class UserQuickSearchAction extends AbstractAction { ON (option_value.userID = user_table.userID) WHERE banned = ?"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); - $statement->execute(array(1)); + $statement->execute([1]); $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; @@ -124,7 +124,7 @@ class UserQuickSearchAction extends AbstractAction { WHERE activationCode <> ? ORDER BY user_table.registrationDate DESC"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); - $statement->execute(array(0)); + $statement->execute([0]); $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; @@ -135,7 +135,7 @@ class UserQuickSearchAction extends AbstractAction { ON (option_value.userID = user_table.userID) WHERE disableAvatar = ?"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); - $statement->execute(array(1)); + $statement->execute([1]); $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; @@ -146,7 +146,7 @@ class UserQuickSearchAction extends AbstractAction { ON (option_value.userID = user_table.userID) WHERE disableSignature = ?"; $statement = WCF::getDB()->prepareStatement($sql, $this->maxResults); - $statement->execute(array(1)); + $statement->execute([1]); $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN); break; } @@ -156,22 +156,22 @@ class UserQuickSearchAction extends AbstractAction { } // store search result in database - $data = serialize(array( + $data = serialize([ 'matches' => $this->matches, 'itemsPerPage' => $this->itemsPerPage, 'columns' => $this->columns - )); + ]); - $search = SearchEditor::create(array( + $search = SearchEditor::create([ 'userID' => WCF::getUser()->userID, 'searchData' => $data, 'searchTime' => TIME_NOW, 'searchType' => 'users' - )); + ]); $this->executed(); // forward to result page - $url = LinkHandler::getInstance()->getLink('UserList', array('id' => $search->searchID), 'sortField='.rawurlencode($this->sortField).'&sortOrder='.rawurlencode($this->sortOrder)); + $url = LinkHandler::getInstance()->getLink('UserList', ['id' => $search->searchID], 'sortField='.rawurlencode($this->sortField).'&sortOrder='.rawurlencode($this->sortOrder)); HeaderUtil::redirect($url); exit; } diff --git a/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php b/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php index 401a65400f..0e6a84a928 100644 --- a/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php @@ -32,7 +32,7 @@ class WorkerProxyAction extends AJAXInvokeAction { * parameters for worker action * @var array */ - protected $parameters = array(); + protected $parameters = []; /** * worker object @@ -40,7 +40,7 @@ class WorkerProxyAction extends AJAXInvokeAction { */ protected $worker = null; - public static $allowInvoke = array(); + public static $allowInvoke = []; /** * @see \wcf\action\IAction::readParameters() @@ -108,13 +108,13 @@ class WorkerProxyAction extends AJAXInvokeAction { if ($parameters === null) $parameters = $this->parameters; // build return values - $returnValues = array( + $returnValues = [ 'className' => $this->className, 'loopCount' => ($this->loopCount + 1), 'parameters' => $parameters, 'proceedURL' => $proceedURL, 'progress' => $progress - ); + ]; // include template on startup if ($this->loopCount == -1) { diff --git a/wcfsetup/install/files/lib/acp/form/AbstractBulkProcessingForm.class.php b/wcfsetup/install/files/lib/acp/form/AbstractBulkProcessingForm.class.php index 8574c0d709..e94fc78090 100644 --- a/wcfsetup/install/files/lib/acp/form/AbstractBulkProcessingForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AbstractBulkProcessingForm.class.php @@ -24,7 +24,7 @@ abstract class AbstractBulkProcessingForm extends AbstractForm { * object action object type types * @var ObjectType[] */ - public $actions = array(); + public $actions = []; /** * number of objects affected by bulk processing @@ -36,7 +36,7 @@ abstract class AbstractBulkProcessingForm extends AbstractForm { * object condition object type types * @var ObjectType[] */ - public $conditions = array(); + public $conditions = []; /** * list with bulk processed objects diff --git a/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php b/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php index 56c5cf8a13..e0a7f786d1 100755 --- a/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php @@ -17,12 +17,12 @@ abstract class AbstractOptionListForm extends AbstractForm { /** * @see \wcf\form\AbstractForm::$errorField */ - public $errorField = array(); + public $errorField = []; /** * @see \wcf\form\AbstractForm::$errorType */ - public $errorType = array(); + public $errorType = []; /** * name of the active option category diff --git a/wcfsetup/install/files/lib/acp/form/AdAddForm.class.php b/wcfsetup/install/files/lib/acp/form/AdAddForm.class.php index 44ac49b26c..cbdf84488c 100644 --- a/wcfsetup/install/files/lib/acp/form/AdAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AdAddForm.class.php @@ -29,12 +29,12 @@ class AdAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.ad.canManageAd'); + public $neededPermissions = ['admin.ad.canManageAd']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_WCF_AD'); + public $neededModules = ['MODULE_WCF_AD']; /** * html code of the ad @@ -52,7 +52,7 @@ class AdAddForm extends AbstractForm { * grouped ad condition object types * @var array */ - public $groupedConditionObjectTypes = array(); + public $groupedConditionObjectTypes = []; /** * 1 if the ad is disabled @@ -64,13 +64,13 @@ class AdAddForm extends AbstractForm { * list of available location object types * @var ObjectType[] */ - public $locationObjectTypes = array(); + public $locationObjectTypes = []; /** * list of available locations * @var string[] */ - public $locations = array(); + public $locations = []; /** * id of the selected location's object type @@ -90,7 +90,7 @@ class AdAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'ad' => $this->ad, 'adName' => $this->adName, @@ -100,7 +100,7 @@ class AdAddForm extends AbstractForm { 'groupedConditionObjectTypes' => $this->groupedConditionObjectTypes, 'objectTypeID' => $this->objectTypeID, 'showOrder' => $this->showOrder - )); + ]); } /** @@ -112,12 +112,12 @@ class AdAddForm extends AbstractForm { if (!$objectType->conditionobject) continue; if (!isset($this->groupedConditionObjectTypes[$objectType->conditionobject])) { - $this->groupedConditionObjectTypes[$objectType->conditionobject] = array(); + $this->groupedConditionObjectTypes[$objectType->conditionobject] = []; } if ($objectType->conditiongroup) { if (!isset($this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup])) { - $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup] = array(); + $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup] = []; } $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup][$objectType->objectTypeID] = $objectType; @@ -167,19 +167,19 @@ class AdAddForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new AdAction(array(), 'create', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new AdAction([], 'create', [ + 'data' => array_merge($this->additionalFields, [ 'ad' => $this->ad, 'adName' => $this->adName, 'isDisabled' => $this->isDisabled, 'objectTypeID' => $this->objectTypeID, 'showOrder' => $this->showOrder - )) - )); + ]) + ]); $returnValues = $this->objectAction->executeAction(); // transform conditions array into one-dimensional array - $conditions = array(); + $conditions = []; foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) { foreach ($groupedObjectTypes as $objectTypes) { if (is_array($objectTypes)) { diff --git a/wcfsetup/install/files/lib/acp/form/AdEditForm.class.php b/wcfsetup/install/files/lib/acp/form/AdEditForm.class.php index 2bccc3fa3b..b35033cffe 100644 --- a/wcfsetup/install/files/lib/acp/form/AdEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AdEditForm.class.php @@ -41,10 +41,10 @@ class AdEditForm extends AdAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'adObject' => $this->adObject - )); + ]); } /** @@ -61,7 +61,7 @@ class AdEditForm extends AdAddForm { $this->showOrder = $this->adObject->showOrder; $conditions = $this->adObject->getConditions(); - $conditionsByObjectTypeID = array(); + $conditionsByObjectTypeID = []; foreach ($conditions as $condition) { $conditionsByObjectTypeID[$condition->objectTypeID] = $condition; } @@ -102,19 +102,19 @@ class AdEditForm extends AdAddForm { public function save() { AbstractForm::save(); - $this->objectAction = new AdAction(array($this->adObject), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new AdAction([$this->adObject], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'ad' => $this->ad, 'adName' => $this->adName, 'isDisabled' => $this->isDisabled, 'objectTypeID' => $this->objectTypeID, 'showOrder' => $this->showOrder - )) - )); + ]) + ]); $this->objectAction->executeAction(); // transform conditions array into one-dimensional array - $conditions = array(); + $conditions = []; foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) { foreach ($groupedObjectTypes as $objectTypes) { if (is_array($objectTypes)) { diff --git a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php index 7f949879be..d8099c5e32 100644 --- a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php @@ -56,7 +56,7 @@ class ApplicationEditForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.canManageApplication'); + public $neededPermissions = ['admin.configuration.canManageApplication']; /** * application package id @@ -149,11 +149,11 @@ class ApplicationEditForm extends AbstractForm { AND domainPath = ? AND packageID <> ?"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array( + $statement->execute([ $this->domainName, $this->domainPath, $this->application->packageID - )); + ]); $row = $statement->fetchArray(); if ($row) { WCF::getTPL()->assign('conflictApplication', PackageCache::getInstance()->getPackage($row['packageID'])); @@ -168,11 +168,11 @@ class ApplicationEditForm extends AbstractForm { parent::save(); // save application - $this->objectAction = new ApplicationAction(array($this->application->getDecoratedObject()), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new ApplicationAction([$this->application->getDecoratedObject()], 'update', ['data' => array_merge($this->additionalFields, [ 'cookieDomain' => $this->cookieDomain, 'domainName' => $this->domainName, 'domainPath' => $this->domainPath - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -181,9 +181,9 @@ class ApplicationEditForm extends AbstractForm { ApplicationHandler::rebuild(); // show success. - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -192,12 +192,12 @@ class ApplicationEditForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'application' => $this->application, 'cookieDomain' => $this->cookieDomain, 'domainName' => $this->domainName, 'domainPath' => $this->domainPath, 'packageID' => $this->packageID - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php b/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php index cd0af3a3b3..b696f50ca1 100644 --- a/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderAddForm.class.php @@ -32,7 +32,7 @@ class BBCodeMediaProviderAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.bbcode.canManageBBCode'); + public $neededPermissions = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\page\AbstractPage::$templateName @@ -93,11 +93,11 @@ class BBCodeMediaProviderAddForm extends AbstractForm { parent::save(); // save media provider - $this->objectAction = new BBCodeMediaProviderAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new BBCodeMediaProviderAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, 'regex' => $this->regex, 'html' => $this->html - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -105,9 +105,9 @@ class BBCodeMediaProviderAddForm extends AbstractForm { $this->title = $this->regex = $this->html = ''; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -116,11 +116,11 @@ class BBCodeMediaProviderAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'title' => $this->title, 'regex' => $this->regex, 'html' => $this->html - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderEditForm.class.php b/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderEditForm.class.php index 8e8d8a8495..f3a696eab8 100644 --- a/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BBCodeMediaProviderEditForm.class.php @@ -25,7 +25,7 @@ class BBCodeMediaProviderEditForm extends BBCodeMediaProviderAddForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.bbcode.canManageBBCode'); + public $neededPermissions = ['admin.content.bbcode.canManageBBCode']; /** * id of the edited media provider @@ -59,19 +59,19 @@ class BBCodeMediaProviderEditForm extends BBCodeMediaProviderAddForm { AbstractForm::save(); // update media-provider - $this->objectAction = new BBCodeMediaProviderAction(array($this->providerID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new BBCodeMediaProviderAction([$this->providerID], 'update', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, 'regex' => $this->regex, 'html' => $this->html - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -93,9 +93,9 @@ class BBCodeMediaProviderEditForm extends BBCodeMediaProviderAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'mediaProvider' => $this->mediaProvider, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/CaptchaQuestionAddForm.class.php b/wcfsetup/install/files/lib/acp/form/CaptchaQuestionAddForm.class.php index 74d48972af..70b82ae817 100644 --- a/wcfsetup/install/files/lib/acp/form/CaptchaQuestionAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/CaptchaQuestionAddForm.class.php @@ -40,7 +40,7 @@ class CaptchaQuestionAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.captcha.canManageCaptchaQuestion'); + public $neededPermissions = ['admin.captcha.canManageCaptchaQuestion']; /** * @see \wcf\page\IPage::assignVariables() @@ -50,11 +50,11 @@ class CaptchaQuestionAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'isDisabled' => $this->isDisabled, 'invalidRegex' => $this->invalidRegex - )); + ]); } /** @@ -84,18 +84,18 @@ class CaptchaQuestionAddForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new CaptchaQuestionAction(array(), 'create', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new CaptchaQuestionAction([], 'create', [ + 'data' => array_merge($this->additionalFields, [ 'answers' => I18nHandler::getInstance()->isPlainValue('answers') ? I18nHandler::getInstance()->getValue('answers') : '', 'isDisabled' => $this->isDisabled, 'question' => I18nHandler::getInstance()->isPlainValue('question') ? I18nHandler::getInstance()->getValue('question') : '' - )) - )); + ]) + ]); $returnValues = $this->objectAction->executeAction(); $questionID = $returnValues['returnValues']->questionID; // set i18n values - $questionUpdates = array(); + $questionUpdates = []; if (!I18nHandler::getInstance()->isPlainValue('question')) { I18nHandler::getInstance()->save('question', 'wcf.captcha.question.question.question'.$questionID, 'wcf.captcha.question', 1); diff --git a/wcfsetup/install/files/lib/acp/form/CaptchaQuestionEditForm.class.php b/wcfsetup/install/files/lib/acp/form/CaptchaQuestionEditForm.class.php index f0ad07675a..6b61974fc6 100644 --- a/wcfsetup/install/files/lib/acp/form/CaptchaQuestionEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/CaptchaQuestionEditForm.class.php @@ -43,10 +43,10 @@ class CaptchaQuestionEditForm extends CaptchaQuestionAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'captchaQuestion' => $this->captchaQuestion - )); + ]); } /** @@ -100,13 +100,13 @@ class CaptchaQuestionEditForm extends CaptchaQuestionAddForm { I18nHandler::getInstance()->save('answers', 'wcf.captcha.question.question.answers'.$this->captchaQuestion->questionID, 'wcf.captcha.question', 1); } - $this->objectAction = new CaptchaQuestionAction(array($this->captchaQuestion), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new CaptchaQuestionAction([$this->captchaQuestion], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'answers' => I18nHandler::getInstance()->isPlainValue('answers') ? I18nHandler::getInstance()->getValue('answers') : 'wcf.captcha.question.question.answers'.$this->captchaQuestion->questionID, 'isDisabled' => $this->isDisabled, 'question' => I18nHandler::getInstance()->isPlainValue('question') ? I18nHandler::getInstance()->getValue('question') : 'wcf.captcha.question.question.question'.$this->captchaQuestion->questionID - )) - )); + ]) + ]); $this->objectAction->executeAction(); $this->saved(); diff --git a/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php b/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php index d724baffe3..316e79cfe1 100755 --- a/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php @@ -29,7 +29,7 @@ class CronjobAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canManageCronjob'); + public $neededPermissions = ['admin.management.canManageCronjob']; /** * cronjob class name @@ -151,7 +151,7 @@ class CronjobAddForm extends AbstractForm { parent::save(); // save cronjob - $data = array_merge($this->additionalFields, array( + $data = array_merge($this->additionalFields, [ 'className' => $this->className, 'packageID' => $this->packageID, 'description' => $this->description, @@ -160,9 +160,9 @@ class CronjobAddForm extends AbstractForm { 'startDom' => $this->startDom, 'startMonth' => $this->startMonth, 'startDow' => $this->startDow - )); + ]); - $this->objectAction = new CronjobAction(array(), 'create', array('data' => $data)); + $this->objectAction = new CronjobAction([], 'create', ['data' => $data]); $this->objectAction->executeAction(); if (!I18nHandler::getInstance()->isPlainValue('description')) { @@ -172,9 +172,9 @@ class CronjobAddForm extends AbstractForm { // update group name $cronjobEditor = new CronjobEditor($returnValues['returnValues']); - $cronjobEditor->update(array( + $cronjobEditor->update([ 'description' => 'wcf.acp.cronjob.description.cronjob'.$cronjobID - )); + ]); } $this->saved(); @@ -185,9 +185,9 @@ class CronjobAddForm extends AbstractForm { I18nHandler::getInstance()->reset(); // show success. - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -198,7 +198,7 @@ class CronjobAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'className' => $this->className, 'description' => $this->description, 'startMinute' => $this->startMinute, @@ -207,6 +207,6 @@ class CronjobAddForm extends AbstractForm { 'startMonth' => $this->startMonth, 'startDow' => $this->startDow, 'action' => 'add' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php b/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php index f0734791ca..dc10e890ed 100755 --- a/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php @@ -66,7 +66,7 @@ class CronjobEditForm extends CronjobAddForm { } // update cronjob - $data = array_merge($this->additionalFields, array( + $data = array_merge($this->additionalFields, [ 'className' => $this->className, 'description' => $this->description, 'startMinute' => $this->startMinute, @@ -74,17 +74,17 @@ class CronjobEditForm extends CronjobAddForm { 'startDom' => $this->startDom, 'startMonth' => $this->startMonth, 'startDow' => $this->startDow - )); + ]); - $this->objectAction = new CronjobAction(array($this->cronjobID), 'update', array('data' => $data)); + $this->objectAction = new CronjobAction([$this->cronjobID], 'update', ['data' => $data]); $this->objectAction->executeAction(); $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -114,9 +114,9 @@ class CronjobEditForm extends CronjobAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'cronjobID' => $this->cronjobID, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php b/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php index 25806aa3a1..4987a9d9b5 100644 --- a/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/DataImportForm.class.php @@ -25,7 +25,7 @@ class DataImportForm extends AbstractForm { * additional data * @var array */ - public $additionalData = array(); + public $additionalData = []; /** * @see \wcf\page\AbstractPage::$activeMenuItem @@ -35,13 +35,13 @@ class DataImportForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canImportData'); + public $neededPermissions = ['admin.management.canImportData']; /** * list of available exporters * @var array */ - public $exporters = array(); + public $exporters = []; /** * exporter name @@ -59,19 +59,19 @@ class DataImportForm extends AbstractForm { * list of available importers * @var string[] */ - public $importers = array(); + public $importers = []; /** * list of supported data types * @var array */ - public $supportedData = array(); + public $supportedData = []; /** * selected data types * @var array */ - public $selectedData = array(); + public $selectedData = []; /** * database host name @@ -247,7 +247,7 @@ class DataImportForm extends AbstractForm { $queue = $this->exporter->getQueue(); // save import data - WCF::getSession()->register('importData', array( + WCF::getSession()->register('importData', [ 'exporterName' => $this->exporterName, 'dbHost' => $this->dbHost, 'dbUser' => $this->dbUser, @@ -257,7 +257,7 @@ class DataImportForm extends AbstractForm { 'fileSystemPath' => $this->fileSystemPath, 'userMergeMode' => $this->userMergeMode, 'additionalData' => $this->additionalData - )); + ]); WCF::getTPL()->assign('queue', $queue); } @@ -298,7 +298,7 @@ class DataImportForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'exporter' => $this->exporter, 'importers' => $this->importers, 'exporterName' => $this->exporterName, @@ -315,6 +315,6 @@ class DataImportForm extends AbstractForm { 'showInnoDBWarning' => $this->showInnoDBWarning, 'showMappingNotice' => $this->showMappingNotice, 'additionalData' => $this->additionalData - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/LabelEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LabelEditForm.class.php index 5e0234cc3a..a5547d1cb4 100644 --- a/wcfsetup/install/files/lib/acp/form/LabelEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LabelEditForm.class.php @@ -27,7 +27,7 @@ class LabelEditForm extends LabelAddForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.label.canManageLabel'); + public $neededPermissions = ['admin.content.label.canManageLabel']; /** * label id @@ -70,12 +70,12 @@ class LabelEditForm extends LabelAddForm { } // update label - $this->objectAction = new LabelAction(array($this->labelID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new LabelAction([$this->labelID], 'update', ['data' => array_merge($this->additionalFields, [ 'label' => $this->label, 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName), 'groupID' => $this->groupID, 'showOrder' => $this->showOrder - )))); + ])]); $this->objectAction->executeAction(); $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.objectType'); @@ -89,9 +89,9 @@ class LabelEditForm extends LabelAddForm { if ($this->cssClassName != 'custom') $this->customCssClassName = ''; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -123,9 +123,9 @@ class LabelEditForm extends LabelAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'label' => $this->labelObj, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/LabelGroupAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LabelGroupAddForm.class.php index 2a75f9ccdc..2a632e23ea 100644 --- a/wcfsetup/install/files/lib/acp/form/LabelGroupAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LabelGroupAddForm.class.php @@ -31,7 +31,7 @@ class LabelGroupAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.label.canManageLabel'); + public $neededPermissions = ['admin.content.label.canManageLabel']; /** * force users to select a label @@ -55,19 +55,19 @@ class LabelGroupAddForm extends AbstractForm { * list of label object type handlers * @var ILabelObjectTypeHandler[] */ - public $labelObjectTypes = array(); + public $labelObjectTypes = []; /** * list of label object type containers * @var LabelObjectTypeContainer[] */ - public $labelObjectTypeContainers = array(); + public $labelObjectTypeContainers = []; /** * list of label group to object type relations * @var array */ - public $objectTypes = array(); + public $objectTypes = []; /** * object type id @@ -160,12 +160,12 @@ class LabelGroupAddForm extends AbstractForm { parent::save(); // save label - $this->objectAction = new LabelGroupAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new LabelGroupAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'forceSelection' => ($this->forceSelection ? 1 : 0), 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'showOrder' => $this->showOrder - )))); + ])]); $returnValues = $this->objectAction->executeAction(); if (!I18nHandler::getInstance()->isPlainValue('groupName')) { @@ -173,9 +173,9 @@ class LabelGroupAddForm extends AbstractForm { // update group name $groupEditor = new LabelGroupEditor($returnValues['returnValues']); - $groupEditor->update(array( + $groupEditor->update([ 'groupName' => 'wcf.acp.label.group'.$returnValues['returnValues']->groupID - )); + ]); } // save acl @@ -194,14 +194,14 @@ class LabelGroupAddForm extends AbstractForm { // reset values $this->forceSelection = false; $this->groupName = $this->groupDescription = ''; - $this->objectTypes = array(); + $this->objectTypes = []; $this->showOrder = 0; $this->setObjectTypeRelations(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); I18nHandler::getInstance()->reset(); } @@ -215,7 +215,7 @@ class LabelGroupAddForm extends AbstractForm { ACLHandler::getInstance()->assignVariables($this->objectTypeID); I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'forceSelection' => $this->forceSelection, 'groupName' => $this->groupName, @@ -223,7 +223,7 @@ class LabelGroupAddForm extends AbstractForm { 'labelObjectTypeContainers' => $this->labelObjectTypeContainers, 'objectTypeID' => $this->objectTypeID, 'showOrder' => $this->showOrder - )); + ]); } /** @@ -239,7 +239,7 @@ class LabelGroupAddForm extends AbstractForm { $sql = "DELETE FROM wcf".WCF_N."_label_group_to_object WHERE groupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($groupID)); + $statement->execute([$groupID]); } // insert new relations @@ -254,11 +254,11 @@ class LabelGroupAddForm extends AbstractForm { // use "0" (stored as NULL) for simple true/false states if (!$objectID) $objectID = null; - $statement->execute(array( + $statement->execute([ $groupID, $objectTypeID, $objectID - )); + ]); } } } diff --git a/wcfsetup/install/files/lib/acp/form/LabelGroupEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LabelGroupEditForm.class.php index 0a4e4b1381..179c0697a9 100644 --- a/wcfsetup/install/files/lib/acp/form/LabelGroupEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LabelGroupEditForm.class.php @@ -27,7 +27,7 @@ class LabelGroupEditForm extends LabelGroupAddForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.label.canManageLabel'); + public $neededPermissions = ['admin.content.label.canManageLabel']; /** * group id @@ -70,12 +70,12 @@ class LabelGroupEditForm extends LabelGroupAddForm { } // update label - $this->objectAction = new LabelGroupAction(array($this->groupID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new LabelGroupAction([$this->groupID], 'update', ['data' => array_merge($this->additionalFields, [ 'forceSelection' => ($this->forceSelection ? 1 : 0), 'groupName' => $this->groupName, 'groupDescription' => $this->groupDescription, 'showOrder' => $this->showOrder - )))); + ])]); $this->objectAction->executeAction(); // update acl @@ -92,9 +92,9 @@ class LabelGroupEditForm extends LabelGroupAddForm { $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -121,11 +121,11 @@ class LabelGroupEditForm extends LabelGroupAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'groupID' => $this->groupID, 'labelGroup' => $this->group - )); + ]); } /** @@ -138,12 +138,12 @@ class LabelGroupEditForm extends LabelGroupAddForm { FROM wcf".WCF_N."_label_group_to_object WHERE groupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->groupID)); + $statement->execute([$this->groupID]); - $data = array(); + $data = []; while ($row = $statement->fetchArray()) { if (!isset($data[$row['objectTypeID']])) { - $data[$row['objectTypeID']] = array(); + $data[$row['objectTypeID']] = []; } // prevent NULL values which confuse isset() diff --git a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php index 3af0c507b4..0d406c4f81 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php @@ -33,7 +33,7 @@ class LanguageAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.language.canManageLanguage'); + public $neededPermissions = ['admin.language.canManageLanguage']; /** * language object @@ -57,7 +57,7 @@ class LanguageAddForm extends AbstractForm { * list of available languages * @var Language[] */ - public $languages = array(); + public $languages = []; /** * source language object @@ -139,11 +139,11 @@ class LanguageAddForm extends AbstractForm { public function save() { parent::save(); - $this->language = LanguageEditor::create(array( + $this->language = LanguageEditor::create([ 'countryCode' => mb_strtolower($this->countryCode), 'languageName' => $this->languageName, 'languageCode' => mb_strtolower($this->languageCode) - )); + ]); $languageEditor = new LanguageEditor($this->sourceLanguage); $languageEditor->copy($this->language); @@ -171,13 +171,13 @@ class LanguageAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'countryCode' => $this->countryCode, 'languageName' => $this->languageName, 'languageCode' => $this->languageCode, 'sourceLanguageID' => $this->sourceLanguageID, 'languages' => $this->languages, 'action' => 'add' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/LanguageEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageEditForm.class.php index 70fe6aeff0..5566ebc627 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageEditForm.class.php @@ -58,11 +58,11 @@ class LanguageEditForm extends LanguageAddForm { AbstractForm::save(); $editor = new LanguageEditor($this->language); - $editor->update(array( + $editor->update([ 'countryCode' => mb_strtolower($this->countryCode), 'languageName' => $this->languageName, - 'languageCode' => mb_strtolower($this->languageCode) - )); + 'languageCode' => mb_strtolower($this->languageCode) + ]); LanguageFactory::getInstance()->clearCache(); $this->saved(); @@ -89,10 +89,10 @@ class LanguageEditForm extends LanguageAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'languageID' => $this->languageID, 'language' => $this->language, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php index 58ba4eaf34..d28c2dda12 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php @@ -28,7 +28,7 @@ class LanguageExportForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.language.canManageLanguage'); + public $neededPermissions = ['admin.language.canManageLanguage']; /** * language id @@ -46,13 +46,13 @@ class LanguageExportForm extends AbstractForm { * selected packages * @var string[] */ - public $selectedPackages = array(); + public $selectedPackages = []; /** * available packages * @var string[] */ - public $packages = array(); + public $packages = []; /** * true to export custom variables @@ -140,14 +140,14 @@ class LanguageExportForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'languageID' => $this->languageID, 'languages' => LanguageFactory::getInstance()->getLanguages(), 'selectedPackages' => $this->selectedPackages, 'packages' => $this->packages, 'selectAllPackages' => true, 'packageNameLength' => $this->packageNameLength - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/form/LanguageImportForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageImportForm.class.php index 3e71883f6f..dbe22c35ea 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageImportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageImportForm.class.php @@ -29,7 +29,7 @@ class LanguageImportForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.language.canManageLanguage'); + public $neededPermissions = ['admin.language.canManageLanguage']; /** * file name @@ -59,7 +59,7 @@ class LanguageImportForm extends AbstractForm { * list of available languages * @var Language[] */ - public $languages = array(); + public $languages = []; /** * @see \wcf\form\IForm::readFormParameters() @@ -123,10 +123,10 @@ class LanguageImportForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'languages' => $this->languages, 'languageFile' => $this->languageFile - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php index 9f2b31a4c0..f2feddf766 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageMultilingualismForm.class.php @@ -29,7 +29,7 @@ class LanguageMultilingualismForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.language.canManageLanguage'); + public $neededPermissions = ['admin.language.canManageLanguage']; /** * indicates if multilingualism is enabled @@ -41,13 +41,13 @@ class LanguageMultilingualismForm extends AbstractForm { * ids of selected available languages * @var integer[] */ - public $languageIDs = array(); + public $languageIDs = []; /** * list of available content languages * @var Language[] */ - public $languages = array(); + public $languages = []; /** * @see \wcf\page\IPage::readParameters() @@ -101,7 +101,7 @@ class LanguageMultilingualismForm extends AbstractForm { parent::save(); // save - LanguageEditor::enableMultilingualism(($this->enable == 1 ? $this->languageIDs : array())); + LanguageEditor::enableMultilingualism(($this->enable == 1 ? $this->languageIDs : [])); // clear cache LanguageCacheBuilder::getInstance()->reset(); @@ -144,12 +144,12 @@ class LanguageMultilingualismForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'defaultLanguageID' => LanguageFactory::getInstance()->getDefaultLanguageID(), 'enable' => $this->enable, 'languageIDs' => $this->languageIDs, 'languages' => $this->languages - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php index abd3d3596f..5bf8d8d19c 100755 --- a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php @@ -150,16 +150,16 @@ class LoginForm extends AbstractCaptchaForm { // save authentication failure if (ENABLE_USER_AUTHENTICATION_FAILURE) { if ($this->errorField == 'username' || $this->errorField == 'password') { - $action = new UserAuthenticationFailureAction(array(), 'create', array( - 'data' => array( + $action = new UserAuthenticationFailureAction([], 'create', [ + 'data' => [ 'environment' => (RequestHandler::getInstance()->isACPRequest() ? 'admin' : 'user'), 'userID' => ($this->user !== null ? $this->user->userID : null), 'username' => $this->username, 'time' => TIME_NOW, 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => UserUtil::getUserAgent() - ) - )); + ] + ]); $action->executeAction(); if ($this->captchaObjectType) { @@ -239,10 +239,10 @@ class LoginForm extends AbstractCaptchaForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'username' => $this->username, 'password' => $this->password, 'url' => $this->url - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php b/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php index 01e1bcc1eb..79c6d8d17c 100755 --- a/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php @@ -107,10 +107,10 @@ class MasterPasswordForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'masterPassword' => $this->masterPassword, 'relativeWcfDir' => RELATIVE_WCF_DIR, 'url' => $this->url - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/MasterPasswordInitForm.class.php b/wcfsetup/install/files/lib/acp/form/MasterPasswordInitForm.class.php index 8cd9d4df3e..9f26b3c130 100755 --- a/wcfsetup/install/files/lib/acp/form/MasterPasswordInitForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MasterPasswordInitForm.class.php @@ -115,10 +115,10 @@ define('MASTER_PASSWORD', '".PasswordUtil::getDoubleSaltedHash($this->masterPass public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'confirmMasterPassword' => $this->confirmMasterPassword, 'exampleMasterPassword' => PasswordUtil::getRandomPassword(16), 'relativeWcfDir' => RELATIVE_WCF_DIR - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php index 7112dc6646..c87ed8df1a 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php @@ -154,11 +154,11 @@ class MenuAddForm extends AbstractForm { parent::save(); // save label - $this->objectAction = new MenuAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new MenuAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, 'packageID' => 1, 'identifier' => '' - )), 'boxData' => array( + ]), 'boxData' => [ 'name' => $this->title, 'boxType' => 'menu', 'position' => $this->position, @@ -167,21 +167,21 @@ class MenuAddForm extends AbstractForm { 'showOrder' => $this->showOrder, 'cssClassName' => $this->cssClassName, 'packageID' => 1 - ), 'pageIDs' => $this->pageIDs)); + ], 'pageIDs' => $this->pageIDs]); $returnValues = $this->objectAction->executeAction(); // set generic identifier $menuEditor = new MenuEditor($returnValues['returnValues']); - $menuEditor->update(array( + $menuEditor->update([ 'identifier' => 'com.woltlab.wcf.genericMenu'.$menuEditor->menuID - )); + ]); // save i18n if (!I18nHandler::getInstance()->isPlainValue('title')) { I18nHandler::getInstance()->save('title', 'wcf.menu.menu'.$menuEditor->menuID, 'wcf.menu', 1); // update title - $menuEditor->update(array( + $menuEditor->update([ 'title' => 'wcf.menu.menu'.$menuEditor->menuID - )); + ]); } $this->saved(); @@ -189,9 +189,9 @@ class MenuAddForm extends AbstractForm { $this->title = ''; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); I18nHandler::getInstance()->reset(); } @@ -204,7 +204,7 @@ class MenuAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'title' => 'title', 'position' => $this->position, @@ -215,6 +215,6 @@ class MenuAddForm extends AbstractForm { 'pageIDs' => $this->pageIDs, 'availablePositions' => Box::$availableMenuPositions, 'pageNodeList' => (new PageNodeTree())->getNodeList() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php index 11e8e86b47..9d66828f22 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php @@ -75,29 +75,29 @@ class MenuEditForm extends MenuAddForm { } // update menu - $this->objectAction = new MenuAction(array($this->menuID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new MenuAction([$this->menuID], 'update', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title - )))); + ])]); $this->objectAction->executeAction(); // update box if ($this->menu->identifier != 'com.woltlab.wcf.MainMenu') { - $boxAction = new BoxAction(array($this->menu->getBox()->boxID), 'update', array('data' => array_merge($this->additionalFields, array( + $boxAction = new BoxAction([$this->menu->getBox()->boxID], 'update', ['data' => array_merge($this->additionalFields, [ 'position' => $this->position, 'visibleEverywhere' => ($this->visibleEverywhere) ? 1 : 0, 'showHeader' => ($this->showHeader) ? 1 : 0, 'showOrder' => $this->showOrder, 'cssClassName' => $this->cssClassName - )), 'pageIDs' => $this->pageIDs)); + ]), 'pageIDs' => $this->pageIDs]); $boxAction->executeAction(); } $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -127,10 +127,10 @@ class MenuEditForm extends MenuAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'menuID' => $this->menuID, 'menu' => $this->menu - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php index 7b13274170..207f38b00b 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php @@ -89,7 +89,7 @@ class MenuItemEditForm extends MenuItemAddForm { } // update menu - $this->objectAction = new MenuItemAction(array($this->itemID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new MenuItemAction([$this->itemID], 'update', ['data' => array_merge($this->additionalFields, [ 'isDisabled' => ($this->isDisabled) ? 1 : 0, 'title' => $this->title, 'pageID' => $this->pageID, @@ -97,14 +97,14 @@ class MenuItemEditForm extends MenuItemAddForm { 'externalURL' => $this->externalURL, 'parentItemID' => $this->parentItemID, 'showOrder' => $this->showOrder - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -138,10 +138,10 @@ class MenuItemEditForm extends MenuItemAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'itemID' => $this->itemID, 'menuItem' => $this->menuItem - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/NoticeAddForm.class.php b/wcfsetup/install/files/lib/acp/form/NoticeAddForm.class.php index 28a56d3b30..f39506e9d1 100644 --- a/wcfsetup/install/files/lib/acp/form/NoticeAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/NoticeAddForm.class.php @@ -31,14 +31,14 @@ class NoticeAddForm extends AbstractForm { * list pf pre-defined CSS class names * @var string[] */ - public $availableCssClassNames = array( + public $availableCssClassNames = [ 'info', 'success', 'warning', 'error', 'custom' - ); + ]; /** * name of the chosen CSS class name @@ -56,7 +56,7 @@ class NoticeAddForm extends AbstractForm { * grouped notice condition object types * @var array */ - public $groupedConditionObjectTypes = array(); + public $groupedConditionObjectTypes = []; /** * 1 if the notice is disabled @@ -73,7 +73,7 @@ class NoticeAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.notice.canManageNotice'); + public $neededPermissions = ['admin.notice.canManageNotice']; /** * name of the notice @@ -101,7 +101,7 @@ class NoticeAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'availableCssClassNames' => $this->availableCssClassNames, 'cssClassName' => $this->cssClassName, @@ -112,7 +112,7 @@ class NoticeAddForm extends AbstractForm { 'noticeName' => $this->noticeName, 'noticeUseHtml' => $this->noticeUseHtml, 'showOrder' => $this->showOrder - )); + ]); } /** @@ -124,12 +124,12 @@ class NoticeAddForm extends AbstractForm { if (!$objectType->conditionobject) continue; if (!isset($this->groupedConditionObjectTypes[$objectType->conditionobject])) { - $this->groupedConditionObjectTypes[$objectType->conditionobject] = array(); + $this->groupedConditionObjectTypes[$objectType->conditionobject] = []; } if ($objectType->conditiongroup) { if (!isset($this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup])) { - $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup] = array(); + $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup] = []; } $this->groupedConditionObjectTypes[$objectType->conditionobject][$objectType->conditiongroup][$objectType->objectTypeID] = $objectType; @@ -187,8 +187,8 @@ class NoticeAddForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new NoticeAction(array(), 'create', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new NoticeAction([], 'create', [ + 'data' => array_merge($this->additionalFields, [ 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'isDisabled' => $this->isDisabled, 'isDismissible' => $this->isDismissible, @@ -196,8 +196,8 @@ class NoticeAddForm extends AbstractForm { 'noticeName' => $this->noticeName, 'noticeUseHtml' => $this->noticeUseHtml, 'showOrder' => $this->showOrder - )) - )); + ]) + ]); $returnValues = $this->objectAction->executeAction(); if (!I18nHandler::getInstance()->isPlainValue('notice')) { @@ -205,13 +205,13 @@ class NoticeAddForm extends AbstractForm { // update notice name $noticeEditor = new NoticeEditor($returnValues['returnValues']); - $noticeEditor->update(array( + $noticeEditor->update([ 'notice' => 'wcf.notice.notice.notice'.$returnValues['returnValues']->noticeID - )); + ]); } // transform conditions array into one-dimensional array - $conditions = array(); + $conditions = []; foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) { foreach ($groupedObjectTypes as $objectTypes) { if (is_array($objectTypes)) { diff --git a/wcfsetup/install/files/lib/acp/form/NoticeEditForm.class.php b/wcfsetup/install/files/lib/acp/form/NoticeEditForm.class.php index 535b18f01d..c499e65d57 100644 --- a/wcfsetup/install/files/lib/acp/form/NoticeEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/NoticeEditForm.class.php @@ -51,11 +51,11 @@ class NoticeEditForm extends NoticeAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'notice' => $this->notice, 'resetIsDismissed' => $this->resetIsDismissed - )); + ]); } /** @@ -80,7 +80,7 @@ class NoticeEditForm extends NoticeAddForm { $this->showOrder = $this->notice->showOrder; $conditions = $this->notice->getConditions(); - $conditionsByObjectTypeID = array(); + $conditionsByObjectTypeID = []; foreach ($conditions as $condition) { $conditionsByObjectTypeID[$condition->objectTypeID] = $condition; } @@ -130,8 +130,8 @@ class NoticeEditForm extends NoticeAddForm { public function save() { AbstractForm::save(); - $this->objectAction = new NoticeAction(array($this->notice), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new NoticeAction([$this->notice], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName, 'isDisabled' => $this->isDisabled, 'isDismissible' => $this->isDismissible, @@ -139,8 +139,8 @@ class NoticeEditForm extends NoticeAddForm { 'noticeName' => $this->noticeName, 'noticeUseHtml' => $this->noticeUseHtml, 'showOrder' => $this->showOrder - )) - )); + ]) + ]); $this->objectAction->executeAction(); if (I18nHandler::getInstance()->isPlainValue('notice')) { @@ -153,7 +153,7 @@ class NoticeEditForm extends NoticeAddForm { } // transform conditions array into one-dimensional array - $conditions = array(); + $conditions = []; foreach ($this->groupedConditionObjectTypes as $groupedObjectTypes) { foreach ($groupedObjectTypes as $objectTypes) { if (is_array($objectTypes)) { @@ -171,9 +171,9 @@ class NoticeEditForm extends NoticeAddForm { $sql = "DELETE FROM wcf".WCF_N."_notice_dismissed WHERE noticeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->notice->noticeID - )); + ]); $this->resetIsDismissed = 0; diff --git a/wcfsetup/install/files/lib/acp/form/NotificationPresetSettingsForm.class.php b/wcfsetup/install/files/lib/acp/form/NotificationPresetSettingsForm.class.php index ecc3691ea9..b036fce85c 100644 --- a/wcfsetup/install/files/lib/acp/form/NotificationPresetSettingsForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/NotificationPresetSettingsForm.class.php @@ -29,7 +29,7 @@ class NotificationPresetSettingsForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditUser'); + public $neededPermissions = ['admin.user.canEditUser']; /** * list of notification events @@ -41,7 +41,7 @@ class NotificationPresetSettingsForm extends AbstractForm { * list of settings by event * @var mixed[][] */ - public $settings = array(); + public $settings = []; /** * true to apply change to existing users @@ -53,7 +53,7 @@ class NotificationPresetSettingsForm extends AbstractForm { * list of valid options for the mail notification type. * @var string[] */ - protected static $validMailNotificationTypes = array('none', 'instant', 'daily'); + protected static $validMailNotificationTypes = ['none', 'instant', 'daily']; /** * @see \wcf\page\IPage::readParameters() @@ -81,7 +81,7 @@ class NotificationPresetSettingsForm extends AbstractForm { parent::validate(); // valid event ids - $validEventIDs = array(); + $validEventIDs = []; foreach ($this->events as $events) { foreach ($events as $event) { $validEventIDs[] = $event->eventID; @@ -119,14 +119,14 @@ class NotificationPresetSettingsForm extends AbstractForm { // default values if (empty($_POST)) { - $eventIDs = array(); + $eventIDs = []; foreach ($this->events as $events) { foreach ($events as $event) { $eventIDs[] = $event->eventID; - $this->settings[$event->eventID] = array( + $this->settings[$event->eventID] = [ 'enabled' => $event->preset, 'mailNotificationType' => $event->presetMailNotificationType - ); + ]; } } } @@ -138,13 +138,13 @@ class NotificationPresetSettingsForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - $groupedEvents = array(); + $groupedEvents = []; foreach ($this->events as $objectType => $events) { $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.notification.objectType', $objectType); $category = ($objectTypeObj->category ?: $objectType); if (!isset($groupedEvents[$category])) { - $groupedEvents[$category] = array(); + $groupedEvents[$category] = []; } foreach ($events as $event) $groupedEvents[$category][] = $event; @@ -152,11 +152,11 @@ class NotificationPresetSettingsForm extends AbstractForm { ksort($groupedEvents); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'events' => $groupedEvents, 'settings' => $this->settings, 'applyChangesToExistingUsers' => $this->applyChangesToExistingUsers - )); + ]); } /** @@ -178,18 +178,18 @@ class NotificationPresetSettingsForm extends AbstractForm { } if ($event->preset != $preset || $event->presetMailNotificationType != $presetMailNotificationType) { - $editor = new UserNotificationEventEditor(new UserNotificationEvent(null, array('eventID' => $event->eventID))); - $editor->update(array( + $editor = new UserNotificationEventEditor(new UserNotificationEvent(null, ['eventID' => $event->eventID])); + $editor->update([ 'preset' => $preset, 'presetMailNotificationType' => $presetMailNotificationType - )); + ]); if ($this->applyChangesToExistingUsers) { if (!$preset) { $sql = "DELETE FROM wcf".WCF_N."_user_notification_event_to_user WHERE eventID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($event->eventID)); + $statement->execute([$event->eventID]); } else { $sql = "REPLACE INTO wcf".WCF_N."_user_notification_event_to_user @@ -197,7 +197,7 @@ class NotificationPresetSettingsForm extends AbstractForm { SELECT userID, ?, ? FROM wcf".WCF_N."_user"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($event->eventID, $presetMailNotificationType)); + $statement->execute([$event->eventID, $presetMailNotificationType]); } } } diff --git a/wcfsetup/install/files/lib/acp/form/OptionForm.class.php b/wcfsetup/install/files/lib/acp/form/OptionForm.class.php index 92e4ee75c9..d6fec4346c 100644 --- a/wcfsetup/install/files/lib/acp/form/OptionForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/OptionForm.class.php @@ -42,7 +42,7 @@ class OptionForm extends AbstractOptionListForm { * the option tree * @var array */ - public $optionTree = array(); + public $optionTree = []; /** * @see \wcf\acp\form\AbstractOptionListForm::$languageItemPattern @@ -73,7 +73,7 @@ class OptionForm extends AbstractOptionListForm { // save options $saveOptions = $this->optionHandler->save('wcf.acp.option', 'wcf.acp.option.option'); - $this->objectAction = new OptionAction(array(), 'updateAll', array('data' => $saveOptions)); + $this->objectAction = new OptionAction([], 'updateAll', ['data' => $saveOptions]); $this->objectAction->executeAction(); $this->saved(); @@ -107,11 +107,11 @@ class OptionForm extends AbstractOptionListForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'category' => $this->category, 'optionName' => $this->optionName, 'optionTree' => $this->optionTree - )); + ]); } /** @@ -122,7 +122,7 @@ class OptionForm extends AbstractOptionListForm { ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.option.category.'.$this->category->categoryName); // check permission - WCF::getSession()->checkPermissions(array('admin.configuration.canEditOption')); + WCF::getSession()->checkPermissions(['admin.configuration.canEditOption']); if ($this->category->categoryName == 'module') { // check master password diff --git a/wcfsetup/install/files/lib/acp/form/PackageStartInstallForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageStartInstallForm.class.php index 9ae5931c4e..f5611501ee 100755 --- a/wcfsetup/install/files/lib/acp/form/PackageStartInstallForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageStartInstallForm.class.php @@ -165,7 +165,7 @@ class PackageStartInstallForm extends AbstractForm { // insert queue $isApplication = PackageValidationManager::getInstance()->getPackageValidationArchive()->getArchive()->getPackageInfo('isApplication'); - $this->queue = PackageInstallationQueueEditor::create(array( + $this->queue = PackageInstallationQueueEditor::create([ 'processNo' => $processNo, 'userID' => WCF::getUser()->userID, 'package' => PackageValidationManager::getInstance()->getPackageValidationArchive()->getArchive()->getPackageInfo('name'), @@ -174,7 +174,7 @@ class PackageStartInstallForm extends AbstractForm { 'archive' => $archive, 'action' => ($this->package != null ? 'update' : 'install'), 'isApplication' => (!$isApplication ? '0' : '1') - )); + ]); $this->saved(); @@ -188,10 +188,10 @@ class PackageStartInstallForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'package' => $this->package, 'installingImportedStyle' => $this->stylePackageImportLocation != '' - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/form/PackageUpdateServerAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageUpdateServerAddForm.class.php index ff25a166f1..3c5a1fe170 100755 --- a/wcfsetup/install/files/lib/acp/form/PackageUpdateServerAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageUpdateServerAddForm.class.php @@ -27,7 +27,7 @@ class PackageUpdateServerAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canEditServer'); + public $neededPermissions = ['admin.configuration.package.canEditServer']; /** * server url @@ -80,11 +80,11 @@ class PackageUpdateServerAddForm extends AbstractForm { parent::save(); // save server - $this->objectAction = new PackageUpdateServerAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new PackageUpdateServerAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'serverURL' => $this->serverURL, 'loginUsername' => $this->loginUsername, 'loginPassword' => $this->loginPassword - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -101,12 +101,12 @@ class PackageUpdateServerAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'serverURL' => $this->serverURL, 'loginUsername' => $this->loginUsername, 'loginPassword' => $this->loginPassword, 'action' => 'add' - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/form/PackageUpdateServerEditForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageUpdateServerEditForm.class.php index 07398d7513..834c73d9e6 100755 --- a/wcfsetup/install/files/lib/acp/form/PackageUpdateServerEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageUpdateServerEditForm.class.php @@ -49,11 +49,11 @@ class PackageUpdateServerEditForm extends PackageUpdateServerAddForm { AbstractForm::save(); // save server - $this->objectAction = new PackageUpdateServerAction(array($this->packageUpdateServerID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new PackageUpdateServerAction([$this->packageUpdateServerID], 'update', ['data' => array_merge($this->additionalFields, [ 'serverURL' => $this->serverURL, 'loginUsername' => $this->loginUsername, 'loginPassword' => $this->loginPassword - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -80,10 +80,10 @@ class PackageUpdateServerEditForm extends PackageUpdateServerAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'packageUpdateServerID' => $this->packageUpdateServerID, 'packageUpdateServer' => $this->updateServer, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/PaidSubscriptionAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PaidSubscriptionAddForm.class.php index f200282bd3..dd71cce412 100644 --- a/wcfsetup/install/files/lib/acp/form/PaidSubscriptionAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PaidSubscriptionAddForm.class.php @@ -32,12 +32,12 @@ class PaidSubscriptionAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.paidSubscription.canManageSubscription'); + public $neededPermissions = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\page\AbstractPage::$templateName @@ -108,31 +108,31 @@ class PaidSubscriptionAddForm extends AbstractForm { * list of group ids * @var integer[] */ - public $groupIDs = array(); + public $groupIDs = []; /** * list of excluded subscriptions * @var integer[] */ - public $excludedSubscriptionIDs = array(); + public $excludedSubscriptionIDs = []; /** * available user groups * @var array */ - public $availableUserGroups = array(); + public $availableUserGroups = []; /** * list of available currencies * @var string[] */ - public $availableCurrencies = array(); + public $availableCurrencies = []; /** * list of available subscriptions * @var array */ - public $availableSubscriptions = array(); + public $availableSubscriptions = []; /** * @see \wcf\page\IPage::readParameters() @@ -144,7 +144,7 @@ class PaidSubscriptionAddForm extends AbstractForm { I18nHandler::getInstance()->register('title'); // get available user groups - $this->availableUserGroups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS)); + $this->availableUserGroups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]); if (!count(PaymentMethodHandler::getInstance()->getPaymentMethods())) { throw new NamedUserException(WCF::getLanguage()->get('wcf.acp.paidSubscription.error.noPaymentMethods')); @@ -257,7 +257,7 @@ class PaidSubscriptionAddForm extends AbstractForm { parent::save(); // save subscription - $this->objectAction = new PaidSubscriptionAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new PaidSubscriptionAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, 'description' => $this->description, 'isDisabled' => $this->isDisabled, @@ -269,7 +269,7 @@ class PaidSubscriptionAddForm extends AbstractForm { 'isRecurring' => $this->isRecurring, 'groupIDs' => implode(',', $this->groupIDs), 'excludedSubscriptionIDs' => implode(',', $this->excludedSubscriptionIDs) - )))); + ])]); $returnValues = $this->objectAction->executeAction(); // save i18n values @@ -281,13 +281,13 @@ class PaidSubscriptionAddForm extends AbstractForm { $this->title = $this->description = ''; $this->isDisabled = $this->showOrder = $this->cost = $this->subscriptionLength = $this->isRecurring = 0; $this->currency = 'EUR'; - $this->groupIDs = array(); + $this->groupIDs = []; I18nHandler::getInstance()->reset(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -302,9 +302,9 @@ class PaidSubscriptionAddForm extends AbstractForm { // update database $editor = new PaidSubscriptionEditor($subscription); - $editor->update(array( + $editor->update([ $columnName => 'wcf.paidSubscription.subscription'.$subscription->subscriptionID.($columnName == 'description' ? '.description' : '') - )); + ]); } } @@ -316,7 +316,7 @@ class PaidSubscriptionAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'isDisabled' => $this->isDisabled, 'showOrder' => $this->showOrder, @@ -330,6 +330,6 @@ class PaidSubscriptionAddForm extends AbstractForm { 'availableCurrencies' => $this->availableCurrencies, 'availableUserGroups' => $this->availableUserGroups, 'availableSubscriptions' => $this->availableSubscriptions - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/PaidSubscriptionEditForm.class.php b/wcfsetup/install/files/lib/acp/form/PaidSubscriptionEditForm.class.php index 6d1186be9e..68d7af761d 100644 --- a/wcfsetup/install/files/lib/acp/form/PaidSubscriptionEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PaidSubscriptionEditForm.class.php @@ -47,7 +47,7 @@ class PaidSubscriptionEditForm extends PaidSubscriptionAddForm { protected function getAvailableSubscriptions() { $subscriptionList = new PaidSubscriptionList(); - $subscriptionList->getConditionBuilder()->add('subscriptionID <> ?', array($this->subscriptionID)); + $subscriptionList->getConditionBuilder()->add('subscriptionID <> ?', [$this->subscriptionID]); $subscriptionList->sqlOrderBy = 'title'; $subscriptionList->readObjects(); $this->availableSubscriptions = $subscriptionList->getObjects(); @@ -128,7 +128,7 @@ class PaidSubscriptionEditForm extends PaidSubscriptionAddForm { } // save subscription - $this->objectAction = new PaidSubscriptionAction(array($this->subscription), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new PaidSubscriptionAction([$this->subscription], 'update', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, 'description' => $this->description, 'isDisabled' => $this->isDisabled, @@ -140,14 +140,14 @@ class PaidSubscriptionEditForm extends PaidSubscriptionAddForm { 'isRecurring' => $this->isRecurring, 'groupIDs' => implode(',', $this->groupIDs), 'excludedSubscriptionIDs' => implode(',', $this->excludedSubscriptionIDs) - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -159,10 +159,10 @@ class PaidSubscriptionEditForm extends PaidSubscriptionAddForm { $useRequestData = (empty($_POST)) ? false : true; I18nHandler::getInstance()->assignVariables($useRequestData); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'subscriptionID' => $this->subscriptionID, 'subscription' => $this->subscription - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/PaidSubscriptionUserAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PaidSubscriptionUserAddForm.class.php index 12289ab234..b571df7535 100644 --- a/wcfsetup/install/files/lib/acp/form/PaidSubscriptionUserAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PaidSubscriptionUserAddForm.class.php @@ -30,12 +30,12 @@ class PaidSubscriptionUserAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.paidSubscription.canManageSubscription'); + public $neededPermissions = ['admin.paidSubscription.canManageSubscription']; /** * subscription id @@ -125,23 +125,23 @@ class PaidSubscriptionUserAddForm extends AbstractForm { parent::save(); $userSubscription = PaidSubscriptionUser::getSubscriptionUser($this->subscriptionID, $this->user->userID); - $data = array(); + $data = []; if ($this->subscription->subscriptionLength) { $data['endDate'] = $this->endDateTime->getTimestamp(); } if ($userSubscription === null) { // create new subscription - $action = new PaidSubscriptionUserAction(array(), 'create', array( + $action = new PaidSubscriptionUserAction([], 'create', [ 'user' => $this->user, 'subscription' => $this->subscription, 'data' => $data - )); + ]); $returnValues = $action->executeAction(); $userSubscription = $returnValues['returnValues']; } else { // extend existing subscription - $action = new PaidSubscriptionUserAction(array($userSubscription), 'extend', array('data' => $data)); + $action = new PaidSubscriptionUserAction([$userSubscription], 'extend', ['data' => $data]); $action->executeAction(); } $this->saved(); @@ -150,9 +150,9 @@ class PaidSubscriptionUserAddForm extends AbstractForm { $this->username = $this->endDate = ''; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -176,11 +176,11 @@ class PaidSubscriptionUserAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'subscriptionID' => $this->subscriptionID, 'subscription' => $this->subscription, 'username' => $this->username, 'endDate' => $this->endDate - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php index 774dd9abc5..87e02e111e 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyAddForm.class.php @@ -36,12 +36,12 @@ class SmileyAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.smiley.canManageSmiley'); + public $neededPermissions = ['admin.content.smiley.canManageSmiley']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_SMILEY'); + public $neededModules = ['MODULE_SMILEY']; /** * primary smiley code @@ -89,7 +89,7 @@ class SmileyAddForm extends AbstractForm { * data of the uploaded smiley file * @var array() */ - public $fileUpload = array(); + public $fileUpload = []; /** * temporary name of the uploaded smiley file @@ -105,7 +105,7 @@ class SmileyAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'smileyTitle' => $this->smileyTitle, 'showOrder' => $this->showOrder, @@ -115,7 +115,7 @@ class SmileyAddForm extends AbstractForm { 'smileyPath' => $this->smileyPath, 'categoryNodeList' => $this->categoryNodeTree->getIterator(), 'uploadedFilename' => $this->uploadedFilename - )); + ]); } /** @@ -161,8 +161,8 @@ class SmileyAddForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new SmileyAction(array(), 'create', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new SmileyAction([], 'create', [ + 'data' => array_merge($this->additionalFields, [ 'smileyTitle' => $this->smileyTitle, 'smileyCode' => $this->smileyCode, 'aliases' => $this->aliases, @@ -170,9 +170,9 @@ class SmileyAddForm extends AbstractForm { 'showOrder' => $this->showOrder, 'categoryID' => $this->categoryID ?: null, 'packageID' => 1 - )), + ]), 'fileLocation' => $this->uploadedFilename ? WCF_DIR.'images/smilies/'.$this->uploadedFilename : '' - )); + ]); $this->objectAction->executeAction(); $returnValues = $this->objectAction->getReturnValues(); $smileyEditor = new SmileyEditor($returnValues['returnValues']); @@ -182,9 +182,9 @@ class SmileyAddForm extends AbstractForm { I18nHandler::getInstance()->save('smileyTitle', 'wcf.smiley.title'.$smileyID, 'wcf.smiley', 1); // update title - $smileyEditor->update(array( + $smileyEditor->update([ 'smileyTitle' => 'wcf.smiley.title'.$smileyID - )); + ]); } // reset values @@ -265,7 +265,7 @@ class SmileyAddForm extends AbstractForm { // validate smiley code and aliases against existing smilies $conditionBuilder = new PreparedStatementConditionBuilder(); if (isset($this->smiley)) { - $conditionBuilder->add('smileyID <> ?', array($this->smiley->smileyID)); + $conditionBuilder->add('smileyID <> ?', [$this->smiley->smileyID]); } $sql = "SELECT smileyCode, aliases FROM wcf".WCF_N."_smiley @@ -275,7 +275,7 @@ class SmileyAddForm extends AbstractForm { $aliases = explode("\n", $this->aliases); while ($row = $statement->fetchArray()) { - $known = array(); + $known = []; if (!empty($row['aliases'])) { $known = explode("\n", $row['aliases']); } diff --git a/wcfsetup/install/files/lib/acp/form/SmileyCategoryAddForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyCategoryAddForm.class.php index ec10586836..1ecaf8d46e 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyCategoryAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyCategoryAddForm.class.php @@ -30,5 +30,5 @@ class SmileyCategoryAddForm extends AbstractCategoryAddForm { /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_SMILEY'); + public $neededModules = ['MODULE_SMILEY']; } diff --git a/wcfsetup/install/files/lib/acp/form/SmileyCategoryEditForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyCategoryEditForm.class.php index c9a05d0c58..4ff69ee3b7 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyCategoryEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyCategoryEditForm.class.php @@ -30,5 +30,5 @@ class SmileyCategoryEditForm extends AbstractCategoryEditForm { /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_SMILEY'); + public $neededModules = ['MODULE_SMILEY']; } diff --git a/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php b/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php index 732bed0127..d7eae25d8b 100644 --- a/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/SmileyEditForm.class.php @@ -26,7 +26,7 @@ class SmileyEditForm extends SmileyAddForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.smiley.canManageSmiley'); + public $neededPermissions = ['admin.content.smiley.canManageSmiley']; /** * smiley id @@ -69,17 +69,17 @@ class SmileyEditForm extends SmileyAddForm { } // update bbcode - $this->objectAction = new SmileyAction(array($this->smileyID), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new SmileyAction([$this->smileyID], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'smileyTitle' => $this->smileyTitle, 'smileyCode' => $this->smileyCode, 'aliases' => $this->aliases, 'smileyPath' => $this->smileyPath, 'showOrder' => $this->showOrder, 'categoryID' => $this->categoryID ?: null - )), + ]), 'fileLocation' => $this->uploadedFilename ? WCF_DIR.'images/smilies/'.$this->uploadedFilename : '' - )); + ]); $this->objectAction->executeAction(); $this->uploadedFilename = ''; @@ -87,9 +87,9 @@ class SmileyEditForm extends SmileyAddForm { $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -118,9 +118,9 @@ class SmileyEditForm extends SmileyAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'smiley' => $this->smiley, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php index b73b34ef8b..6f730db6b8 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php @@ -124,8 +124,8 @@ class StyleEditForm extends StyleAddForm { unset($this->variables['overrideScssCustom']); }*/ - $this->objectAction = new StyleAction(array($this->style), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new StyleAction([$this->style], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'styleName' => $this->styleName, 'templateGroupID' => $this->templateGroupID, 'styleVersion' => $this->styleVersion, @@ -136,10 +136,10 @@ class StyleEditForm extends StyleAddForm { 'license' => $this->license, 'authorName' => $this->authorName, 'authorURL' => $this->authorURL - )), + ]), 'tmpHash' => $this->tmpHash, 'variables' => $this->variables - )); + ]); $this->objectAction->executeAction(); // save description @@ -162,10 +162,10 @@ class StyleEditForm extends StyleAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'style' => $this->style, 'styleID' => $this->styleID - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php index 9dc6190ac2..fa0b0cc1ff 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php @@ -58,7 +58,7 @@ class StyleExportForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.style.canManageStyle'); + public $neededPermissions = ['admin.style.canManageStyle']; /** * package identifier @@ -167,7 +167,7 @@ class StyleExportForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'canExportImages' => $this->canExportImages, 'canExportTemplates' => $this->canExportTemplates, 'exportAsPackage' => $this->exportAsPackage, @@ -176,6 +176,6 @@ class StyleExportForm extends AbstractForm { 'packageName' => $this->packageName, 'style' => $this->style, 'styleID' => $this->styleID - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php index afbfbf3af6..a83f4ef608 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleImportForm.class.php @@ -30,13 +30,13 @@ class StyleImportForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.style.canManageStyle'); + public $neededPermissions = ['admin.style.canManageStyle']; /** * upload data * @var string[] */ - public $source = array(); + public $source = []; /** * style editor object @@ -99,9 +99,9 @@ class StyleImportForm extends AbstractForm { WCF::getSession()->register('stylePackageImportLocation', $filename); - HeaderUtil::redirect(LinkHandler::getInstance()->getLink('PackageStartInstall', array( + HeaderUtil::redirect(LinkHandler::getInstance()->getLink('PackageStartInstall', [ 'action' => 'install' - ))); + ])); exit; } catch (SystemException $e) { diff --git a/wcfsetup/install/files/lib/acp/form/TagAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TagAddForm.class.php index f803adeb6f..8b0d87c921 100644 --- a/wcfsetup/install/files/lib/acp/form/TagAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TagAddForm.class.php @@ -29,18 +29,18 @@ class TagAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.tag.canManageTag'); + public $neededPermissions = ['admin.content.tag.canManageTag']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_TAGGING'); + public $neededModules = ['MODULE_TAGGING']; /** * list of available languages * @var array */ - public $availableLanguages = array(); + public $availableLanguages = []; /** * name value @@ -58,7 +58,7 @@ class TagAddForm extends AbstractForm { * synonyms * @var string[] */ - public $synonyms = array(); + public $synonyms = []; /** * @see \wcf\page\IPage::readParameters() @@ -148,10 +148,10 @@ class TagAddForm extends AbstractForm { parent::save(); // save tag - $this->objectAction = new TagAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new TagAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'name' => $this->name, 'languageID' => $this->languageID - )))); + ])]); $this->objectAction->executeAction(); $returnValues = $this->objectAction->getReturnValues(); $editor = new TagEditor($returnValues['returnValues']); @@ -162,11 +162,11 @@ class TagAddForm extends AbstractForm { // find existing tag $synonymObj = Tag::getTag($synonym, $this->languageID); if ($synonymObj === null) { - $synonymAction = new TagAction(array(), 'create', array('data' => array( + $synonymAction = new TagAction([], 'create', ['data' => [ 'name' => $synonym, 'languageID' => $this->languageID, 'synonymFor' => $editor->tagID - ))); + ]]); $synonymAction->executeAction(); } else { @@ -178,12 +178,12 @@ class TagAddForm extends AbstractForm { // reset values $this->name = ''; - $this->synonyms = array(); + $this->synonyms = []; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -192,12 +192,12 @@ class TagAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'availableLanguages' => $this->availableLanguages, 'name' => $this->name, 'languageID' => $this->languageID, 'synonyms' => $this->synonyms - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/TagEditForm.class.php b/wcfsetup/install/files/lib/acp/form/TagEditForm.class.php index 8144f1a428..a92be41143 100644 --- a/wcfsetup/install/files/lib/acp/form/TagEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TagEditForm.class.php @@ -27,7 +27,7 @@ class TagEditForm extends TagAddForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.tag.canManageTag'); + public $neededPermissions = ['admin.content.tag.canManageTag']; /** * tag id @@ -61,9 +61,9 @@ class TagEditForm extends TagAddForm { AbstractForm::save(); // update tag - $this->objectAction = new TagAction(array($this->tagID), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new TagAction([$this->tagID], 'update', ['data' => array_merge($this->additionalFields, [ 'name' => $this->name - )))); + ])]); $this->objectAction->executeAction(); if ($this->tagObj->synonymFor === null) { @@ -72,10 +72,10 @@ class TagEditForm extends TagAddForm { SET synonymFor = ? WHERE synonymFor = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ null, $this->tagID - )); + ]); $editor = new TagEditor($this->tagObj); foreach ($this->synonyms as $synonym) { @@ -84,11 +84,11 @@ class TagEditForm extends TagAddForm { // find existing tag $synonymObj = Tag::getTag($synonym, $this->tagObj->languageID); if ($synonymObj === null) { - $synonymAction = new TagAction(array(), 'create', array('data' => array( + $synonymAction = new TagAction([], 'create', ['data' => [ 'name' => $synonym, 'languageID' => $this->tagObj->languageID, 'synonymFor' => $this->tagID - ))); + ]]); $synonymAction->executeAction(); } else { @@ -100,9 +100,9 @@ class TagEditForm extends TagAddForm { $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -119,9 +119,9 @@ class TagEditForm extends TagAddForm { } $synonymList = new TagList(); - $synonymList->getConditionBuilder()->add('synonymFor = ?', array($this->tagObj->tagID)); + $synonymList->getConditionBuilder()->add('synonymFor = ?', [$this->tagObj->tagID]); $synonymList->readObjects(); - $this->synonyms = array(); + $this->synonyms = []; foreach ($synonymList as $synonym) { $this->synonyms[] = $synonym->name; } @@ -133,10 +133,10 @@ class TagEditForm extends TagAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'tagObj' => $this->tagObj, 'action' => 'edit', 'synonym' => (($this->tagObj !== null && $this->tagObj->synonymFor) ? new Tag($this->tagObj->synonymFor) : null) - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php index da113ae9cb..8bfcddf394 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateAddForm.class.php @@ -31,7 +31,7 @@ class TemplateAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.template.canManageTemplate'); + public $neededPermissions = ['admin.template.canManageTemplate']; /** * template name @@ -55,7 +55,7 @@ class TemplateAddForm extends AbstractForm { * available template groups * @var array */ - public $availableTemplateGroups = array(); + public $availableTemplateGroups = []; /** * template's package id @@ -116,7 +116,7 @@ class TemplateAddForm extends AbstractForm { WHERE templateName = ? AND templateGroupID IS NULL"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->tplName)); + $statement->execute([$this->tplName]); $row = $statement->fetchArray(); if ($row !== false) { $this->packageID = $row['packageID']; @@ -147,14 +147,14 @@ class TemplateAddForm extends AbstractForm { } $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('templateName = ?', array($this->tplName)); - $conditionBuilder->add('templateGroupID = ?', array($this->templateGroupID)); + $conditionBuilder->add('templateName = ?', [$this->tplName]); + $conditionBuilder->add('templateGroupID = ?', [$this->templateGroupID]); if ($this->copiedTemplate !== null) { - $conditionBuilder->add('(packageID = ? OR application = ?)', array($this->packageID, $this->copiedTemplate->application)); + $conditionBuilder->add('(packageID = ? OR application = ?)', [$this->packageID, $this->copiedTemplate->application]); } else { - $conditionBuilder->add('packageID = ?', array($this->packageID)); + $conditionBuilder->add('packageID = ?', [$this->packageID]); } $sql = "SELECT COUNT(*) @@ -192,12 +192,12 @@ class TemplateAddForm extends AbstractForm { $this->application = Package::getAbbreviation(PackageCache::getInstance()->getPackage($this->packageID)->package); } - $this->objectAction = new TemplateAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new TemplateAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'application' => $this->application, 'templateName' => $this->tplName, 'packageID' => $this->packageID, 'templateGroupID' => $this->templateGroupID - )), 'source' => $this->templateSource)); + ]), 'source' => $this->templateSource]); $this->objectAction->executeAction(); $this->saved(); @@ -206,9 +206,9 @@ class TemplateAddForm extends AbstractForm { $this->templateGroupID = 0; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -231,13 +231,13 @@ class TemplateAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'tplName' => $this->tplName, 'templateGroupID' => $this->templateGroupID, 'templateSource' => $this->templateSource, 'availableTemplateGroups' => $this->availableTemplateGroups, 'copy' => $this->copy - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/TemplateEditForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateEditForm.class.php index 79c24e9f61..e6c6c945a5 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateEditForm.class.php @@ -72,18 +72,18 @@ class TemplateEditForm extends TemplateAddForm { public function save() { AbstractForm::save(); - $this->objectAction = new TemplateAction(array($this->template), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new TemplateAction([$this->template], 'update', ['data' => array_merge($this->additionalFields, [ 'templateName' => $this->tplName, 'templateGroupID' => $this->templateGroupID, 'lastModificationTime' => TIME_NOW - )), 'source' => $this->templateSource)); + ]), 'source' => $this->templateSource]); $this->objectAction->executeAction(); $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -105,10 +105,10 @@ class TemplateEditForm extends TemplateAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'templateID' => $this->templateID, 'template' => $this->template - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/TemplateGroupAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateGroupAddForm.class.php index 769bf8fba2..99a02e2860 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateGroupAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateGroupAddForm.class.php @@ -27,7 +27,7 @@ class TemplateGroupAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.template.canManageTemplate'); + public $neededPermissions = ['admin.template.canManageTemplate']; /** * template group name @@ -51,7 +51,7 @@ class TemplateGroupAddForm extends AbstractForm { * available template groups * @var array */ - public $availableTemplateGroups = array(); + public $availableTemplateGroups = []; /** * @see \wcf\form\IForm::readFormParameters() @@ -93,7 +93,7 @@ class TemplateGroupAddForm extends AbstractForm { FROM wcf".WCF_N."_template_group WHERE templateGroupName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->templateGroupName)); + $statement->execute([$this->templateGroupName]); if ($statement->fetchSingleColumn()) { throw new UserInputException('templateGroupName', 'notUnique'); @@ -116,7 +116,7 @@ class TemplateGroupAddForm extends AbstractForm { FROM wcf".WCF_N."_template_group WHERE templateGroupFolderName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->templateGroupFolderName)); + $statement->execute([$this->templateGroupFolderName]); if ($statement->fetchSingleColumn()) { throw new UserInputException('templateGroupFolderName', 'notUnique'); @@ -129,11 +129,11 @@ class TemplateGroupAddForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new TemplateGroupAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new TemplateGroupAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'templateGroupName' => $this->templateGroupName, 'templateGroupFolderName' => $this->templateGroupFolderName, 'parentTemplateGroupID' => ($this->parentTemplateGroupID ?: null) - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -142,16 +142,16 @@ class TemplateGroupAddForm extends AbstractForm { $this->parentTemplateGroupID = 0; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** * @see \wcf\page\IPage::readData() */ public function readData() { - $this->availableTemplateGroups = TemplateGroup::getSelectList(array(), 1); + $this->availableTemplateGroups = TemplateGroup::getSelectList([], 1); parent::readData(); } @@ -162,12 +162,12 @@ class TemplateGroupAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'templateGroupName' => $this->templateGroupName, 'templateGroupFolderName' => $this->templateGroupFolderName, 'parentTemplateGroupID' => $this->parentTemplateGroupID, 'availableTemplateGroups' => $this->availableTemplateGroups - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/TemplateGroupEditForm.class.php b/wcfsetup/install/files/lib/acp/form/TemplateGroupEditForm.class.php index ba3d48c2d0..95c6fad78c 100644 --- a/wcfsetup/install/files/lib/acp/form/TemplateGroupEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/TemplateGroupEditForm.class.php @@ -71,25 +71,25 @@ class TemplateGroupEditForm extends TemplateGroupAddForm { public function save() { AbstractForm::save(); - $this->objectAction = new TemplateGroupAction(array($this->templateGroup), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new TemplateGroupAction([$this->templateGroup], 'update', ['data' => array_merge($this->additionalFields, [ 'templateGroupName' => $this->templateGroupName, 'templateGroupFolderName' => $this->templateGroupFolderName, 'parentTemplateGroupID' => ($this->parentTemplateGroupID ?: null) - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** * @see \wcf\page\IPage::readData() */ public function readData() { - $this->availableTemplateGroups = TemplateGroup::getSelectList(array($this->templateGroupID), 1); + $this->availableTemplateGroups = TemplateGroup::getSelectList([$this->templateGroupID], 1); AbstractForm::readData(); @@ -107,10 +107,10 @@ class TemplateGroupEditForm extends TemplateGroupAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'templateGroupID' => $this->templateGroupID, 'templateGroup' => $this->templateGroup - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserActivityPointOptionForm.class.php b/wcfsetup/install/files/lib/acp/form/UserActivityPointOptionForm.class.php index a6431970d0..fae2261813 100644 --- a/wcfsetup/install/files/lib/acp/form/UserActivityPointOptionForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserActivityPointOptionForm.class.php @@ -27,19 +27,19 @@ class UserActivityPointOptionForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditActivityPoints'); + public $neededPermissions = ['admin.user.canEditActivityPoints']; /** * points to objectType * @var integer[] */ - public $points = array(); + public $points = []; /** * valid object types * @var ObjectType[] */ - public $objectTypes = array(); + public $objectTypes = []; /** * @see \wcf\form\IForm::readFormParameters() @@ -86,7 +86,7 @@ class UserActivityPointOptionForm extends AbstractForm { $editor = new ObjectTypeEditor($objectType); $data = $objectType->additionalData; $data['points'] = $this->points[$objectType->objectTypeID]; - $editor->update(array('additionalData' => serialize($data))); + $editor->update(['additionalData' => serialize($data)]); } ObjectTypeEditor::resetCache(); @@ -102,9 +102,9 @@ class UserActivityPointOptionForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'objectTypes' => $this->objectTypes, 'points' => $this->points - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php b/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php index 538af5542a..913c61588b 100755 --- a/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php @@ -29,7 +29,7 @@ class UserAssignToGroupForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditUser'); + public $neededPermissions = ['admin.user.canEditUser']; /** * @see \wcf\page\AbstractPage::$activeMenuItem @@ -40,25 +40,25 @@ class UserAssignToGroupForm extends AbstractForm { * ids of the relevant users * @var integer[] */ - public $userIDs = array(); + public $userIDs = []; /** * ids of the assigned user groups * @var integer[] */ - public $groupIDs = array(); + public $groupIDs = []; /** * relevant users * @var User[] */ - public $users = array(); + public $users = []; /** * assigned user groups * @var UserGroup[] */ - public $groups = array(); + public $groups = []; /** * id of the user clipboard item object type @@ -121,7 +121,7 @@ class UserAssignToGroupForm extends AbstractForm { parent::save(); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->userIDs)); + $conditions->add("userID IN (?)", [$this->userIDs]); $sql = "SELECT userID, groupID FROM wcf".WCF_N."_user_to_group @@ -129,7 +129,7 @@ class UserAssignToGroupForm extends AbstractForm { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $groups = array(); + $groups = []; while ($row = $statement->fetchArray()) { $groups[$row['userID']][] = $row['groupID']; } @@ -142,10 +142,10 @@ class UserAssignToGroupForm extends AbstractForm { $groupsIDs = array_merge($groups[$user->userID], $this->groupIDs); $groupsIDs = array_unique($groupsIDs); - $action = new UserAction(array(new UserEditor($user)), 'addToGroups', array( + $action = new UserAction([new UserEditor($user)], 'addToGroups', [ 'groups' => $groupsIDs, 'addDefaultGroups' => false - )); + ]); $action->executeAction(); } @@ -154,11 +154,11 @@ class UserAssignToGroupForm extends AbstractForm { $this->saved(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'groupIDs' => $this->groupIDs, 'message' => 'wcf.acp.user.assignToGroup.success', 'users' => $this->users - )); + ]); WCF::getTPL()->display('success'); exit; } @@ -178,18 +178,18 @@ class UserAssignToGroupForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'users' => $this->users, 'userIDs' => $this->userIDs, 'groupIDs' => $this->groupIDs, 'groups' => $this->groups - )); + ]); } /** * Get a list of available groups. */ protected function readGroups() { - $this->groups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS)); + $this->groups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserContentRevertChangesForm.class.php b/wcfsetup/install/files/lib/acp/form/UserContentRevertChangesForm.class.php index 112c3aa6a7..abfa1dc191 100644 --- a/wcfsetup/install/files/lib/acp/form/UserContentRevertChangesForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserContentRevertChangesForm.class.php @@ -22,12 +22,12 @@ class UserContentRevertChangesForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_EDIT_HISTORY'); + public $neededModules = ['MODULE_EDIT_HISTORY']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.canBulkRevertContentChanges'); + public $neededPermissions = ['admin.content.canBulkRevertContentChanges']; /** * @see \wcf\page\AbstractPage::$activeMenuItem @@ -38,13 +38,13 @@ class UserContentRevertChangesForm extends AbstractForm { * ids of the relevant users * @var integer[] */ - public $userIDs = array(); + public $userIDs = []; /** * relevant users * @var User[] */ - public $users = array(); + public $users = []; /** * timeframe to consider @@ -118,10 +118,10 @@ class UserContentRevertChangesForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'users' => $this->users, 'userIDs' => $this->userIDs, 'timeframe' => $this->timeframe - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php index 8d5c7ea756..7dd0eb68b6 100755 --- a/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php @@ -35,7 +35,7 @@ class UserEditForm extends UserAddForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditUser'); + public $neededPermissions = ['admin.user.canEditUser']; /** * user id @@ -215,7 +215,7 @@ class UserEditForm extends UserAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'userID' => $this->user->userID, 'action' => 'edit', 'url' => '', @@ -229,7 +229,7 @@ class UserEditForm extends UserAddForm { 'disableAvatarExpires' => $this->disableAvatarExpires, 'userAvatar' => $this->userAvatar, 'banExpires' => $this->banExpires - )); + ]); } /** @@ -242,36 +242,36 @@ class UserEditForm extends UserAddForm { if ($this->avatarType != 'custom') { // delete custom avatar if ($this->user->avatarID) { - $action = new UserAvatarAction(array($this->user->avatarID), 'delete'); + $action = new UserAvatarAction([$this->user->avatarID], 'delete'); $action->executeAction(); } } switch ($this->avatarType) { case 'none': - $avatarData = array( + $avatarData = [ 'avatarID' => null, 'enableGravatar' => 0 - ); + ]; break; case 'custom': - $avatarData = array( + $avatarData = [ 'enableGravatar' => 0 - ); + ]; break; case 'gravatar': - $avatarData = array( + $avatarData = [ 'avatarID' => null, 'enableGravatar' => 1 - ); + ]; break; } $this->additionalFields = array_merge($this->additionalFields, $avatarData); // add default groups - $defaultGroups = UserGroup::getAccessibleGroups(array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS)); + $defaultGroups = UserGroup::getAccessibleGroups([UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]); $oldGroupIDs = $this->user->getGroupIDs(); foreach ($oldGroupIDs as $oldGroupID) { if (isset($defaultGroups[$oldGroupID])) { @@ -283,8 +283,8 @@ class UserEditForm extends UserAddForm { // save user $saveOptions = $this->optionHandler->save(); - $data = array( - 'data' => array_merge($this->additionalFields, array( + $data = [ + 'data' => array_merge($this->additionalFields, [ 'username' => $this->username, 'email' => $this->email, 'password' => $this->password, @@ -294,11 +294,11 @@ class UserEditForm extends UserAddForm { 'signatureEnableBBCodes' => $this->signatureEnableBBCodes, 'signatureEnableSmilies' => $this->signatureEnableSmilies, 'signatureEnableHtml' => $this->signatureEnableHtml - )), + ]), 'groups' => $this->groupIDs, 'languageIDs' => $this->visibleLanguages, 'options' => $saveOptions - ); + ]; // handle ban if (WCF::getSession()->getPermission('admin.user.canBanUser')) { @@ -342,17 +342,17 @@ class UserEditForm extends UserAddForm { $data['data']['disableAvatarExpires'] = $this->disableAvatarExpires; } - $this->objectAction = new UserAction(array($this->userID), 'update', $data); + $this->objectAction = new UserAction([$this->userID], 'update', $data); $this->objectAction->executeAction(); // update user rank $editor = new UserEditor(new User($this->userID)); if (MODULE_USER_RANK) { - $action = new UserProfileAction(array($editor), 'updateUserRank'); + $action = new UserProfileAction([$editor], 'updateUserRank'); $action->executeAction(); } if (MODULE_USERS_ONLINE) { - $action = new UserProfileAction(array($editor), 'updateUserOnlineMarking'); + $action = new UserProfileAction([$editor], 'updateUserOnlineMarking'); $action->executeAction(); } @@ -360,7 +360,7 @@ class UserEditForm extends UserAddForm { $sql = "DELETE FROM wcf".WCF_N."_moderation_queue_to_user WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->user->userID)); + $statement->execute([$this->user->userID]); // reset moderation count ModerationQueueManager::getInstance()->resetModerationCount($this->user->userID); diff --git a/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php b/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php index 9f417217a5..1c30003501 100755 --- a/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php @@ -28,7 +28,7 @@ class UserEmailAddressExportForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canMailUser'); + public $neededPermissions = ['admin.user.canMailUser']; /** * type of the file containg the exported email addresses @@ -40,7 +40,7 @@ class UserEmailAddressExportForm extends AbstractForm { * ids of the users whose email addresses are exported * @var integer[] */ - public $userIDs = array(); + public $userIDs = []; /** * string used to separate email adresses @@ -58,7 +58,7 @@ class UserEmailAddressExportForm extends AbstractForm { * users whose email addresses are exported * @var User[] */ - public $users = array(); + public $users = []; /** * clipboard item type id @@ -115,7 +115,7 @@ class UserEmailAddressExportForm extends AbstractForm { } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->userIDs)); + $conditions->add("userID IN (?)", [$this->userIDs]); // count users $sql = "SELECT COUNT(*) @@ -162,11 +162,11 @@ class UserEmailAddressExportForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'users' => $this->users, 'separator' => $this->separator, 'textSeparator' => $this->textSeparator, 'fileType' => $this->fileType - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php index bbf64b89c8..8bffe5b36d 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php @@ -29,7 +29,7 @@ class UserGroupAssignmentAddForm extends AbstractForm { * list of grouped user group assignment condition object types * @var array */ - public $conditions = array(); + public $conditions = []; /** * id of the selected user group @@ -46,7 +46,7 @@ class UserGroupAssignmentAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canManageGroupAssignment'); + public $neededPermissions = ['admin.user.canManageGroupAssignment']; /** * title of the user group assignment @@ -58,7 +58,7 @@ class UserGroupAssignmentAddForm extends AbstractForm { * list of selectable user groups * @var UserGroup[] */ - public $userGroups = array(); + public $userGroups = []; /** * @see \wcf\page\IPage::assignVariables() @@ -66,25 +66,25 @@ class UserGroupAssignmentAddForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'groupedObjectTypes' => $this->conditions, 'groupID' => $this->groupID, 'isDisabled' => $this->isDisabled, 'title' => $this->title, 'userGroups' => $this->userGroups - )); + ]); } /** * @see \wcf\page\IPage::readData() */ public function readData() { - $this->userGroups = UserGroup::getGroupsByType(array(), array( + $this->userGroups = UserGroup::getGroupsByType([], [ UserGroup::EVERYONE, UserGroup::GUESTS, UserGroup::USERS - )); + ]); foreach ($this->userGroups as $key => $userGroup) { if (!$userGroup->isAccessible()) { unset($this->userGroups[$key]); @@ -123,17 +123,17 @@ class UserGroupAssignmentAddForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new UserGroupAssignmentAction(array(), 'create', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserGroupAssignmentAction([], 'create', [ + 'data' => array_merge($this->additionalFields, [ 'groupID' => $this->groupID, 'isDisabled' => $this->isDisabled, 'title' => $this->title - )) - )); + ]) + ]); $returnValues = $this->objectAction->executeAction(); // transform conditions array into one-dimensional array - $conditions = array(); + $conditions = []; foreach ($this->conditions as $groupedObjectTypes) { $conditions = array_merge($conditions, $groupedObjectTypes); } diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentEditForm.class.php index 0629a52c58..0f28ef33e0 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentEditForm.class.php @@ -36,10 +36,10 @@ class UserGroupAssignmentEditForm extends UserGroupAssignmentAddForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'assignment' => $this->assignment - )); + ]); } /** @@ -78,17 +78,17 @@ class UserGroupAssignmentEditForm extends UserGroupAssignmentAddForm { public function save() { AbstractForm::save(); - $this->objectAction = new UserGroupAssignmentAction(array($this->assignment), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserGroupAssignmentAction([$this->assignment], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'groupID' => $this->groupID, 'isDisabled' => $this->isDisabled, 'title' => $this->title - )) - )); + ]) + ]); $this->objectAction->executeAction(); // transform conditions array into one-dimensional array - $conditions = array(); + $conditions = []; foreach ($this->conditions as $groupedObjectTypes) { $conditions = array_merge($conditions, $groupedObjectTypes); } diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php index 0aa8d47e22..ef40e0dea0 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php @@ -34,18 +34,18 @@ class UserGroupOptionForm extends AbstractForm { * list of parsed form elements per group * @var string[] */ - public $formElements = array(); + public $formElements = []; /** * list of accessible groups * @var UserGroup[] */ - public $groups = array(); + public $groups = []; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditGroup'); + public $neededPermissions = ['admin.user.canEditGroup']; /** * user group option type object @@ -57,13 +57,13 @@ class UserGroupOptionForm extends AbstractForm { * list of parent categories * @var UserGroupOptionCategory[] */ - public $parentCategories = array(); + public $parentCategories = []; /** * list of values per user group * @var array */ - public $values = array(); + public $values = []; /** * user group option object @@ -95,7 +95,7 @@ class UserGroupOptionForm extends AbstractForm { $categoryList = new UserGroupOptionCategoryList(); $categoryList->readObjects(); - $categories = array(); + $categories = []; foreach ($categoryList as $category) { $categories[$category->categoryName] = $category; } @@ -201,8 +201,8 @@ class UserGroupOptionForm extends AbstractForm { if (empty($_POST)) { // read values of accessible user groups $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("groupID IN (?)", array(array_keys($this->groups))); - $conditions->add("optionID = ?", array($this->userGroupOption->optionID)); + $conditions->add("groupID IN (?)", [array_keys($this->groups)]); + $conditions->add("optionID = ?", [$this->userGroupOption->optionID]); $sql = "SELECT groupID, optionValue FROM wcf".WCF_N."_user_group_option_value @@ -227,7 +227,7 @@ class UserGroupOptionForm extends AbstractForm { public function save() { parent::save(); - $this->objectAction = new UserGroupOptionAction(array($this->userGroupOption), 'updateValues', array('values' => $this->values)); + $this->objectAction = new UserGroupOptionAction([$this->userGroupOption], 'updateValues', ['values' => $this->values]); $this->objectAction->executeAction(); // fire saved event @@ -242,13 +242,13 @@ class UserGroupOptionForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'formElements' => $this->formElements, 'groups' => $this->groups, 'parentCategories' => $this->parentCategories, 'userGroupOption' => $this->userGroupOption, 'values' => $this->values - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php b/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php index fea1aa4919..a9d7ead234 100755 --- a/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php @@ -38,18 +38,18 @@ class UserMailForm extends AbstractForm { * list of group ids * @var integer[] */ - public $groupIDs = array(); + public $groupIDs = []; /** * list of groups * @var UserGroup[] */ - public $groups = array(); + public $groups = []; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canMailUser'); + public $neededPermissions = ['admin.user.canMailUser']; /** * message subject @@ -67,7 +67,7 @@ class UserMailForm extends AbstractForm { * list of user ids * @var integer[] */ - public $userIDs = array(); + public $userIDs = []; /** * list of users @@ -132,9 +132,9 @@ class UserMailForm extends AbstractForm { // save config in session $userMailData = WCF::getSession()->getVar('userMailData'); - if ($userMailData === null) $userMailData = array(); + if ($userMailData === null) $userMailData = []; $mailID = count($userMailData); - $userMailData[$mailID] = array( + $userMailData[$mailID] = [ 'action' => $this->action, 'userIDs' => $this->userIDs, 'groupIDs' => implode(',', $this->groupIDs), @@ -142,7 +142,7 @@ class UserMailForm extends AbstractForm { 'text' => $this->text, 'from' => $this->from, 'enableHTML' => $this->enableHTML - ); + ]; WCF::getSession()->register('userMailData', $userMailData); $this->saved(); @@ -179,12 +179,12 @@ class UserMailForm extends AbstractForm { if (!empty($this->userIDs)) { $this->userList = new UserList(); - $this->userList->getConditionBuilder()->add("user_table.userID IN (?)", array($this->userIDs)); + $this->userList->getConditionBuilder()->add("user_table.userID IN (?)", [$this->userIDs]); $this->userList->sqlOrderBy = "user_table.username ASC"; $this->userList->readObjects(); } - $this->groups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE)); + $this->groups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE]); } /** @@ -193,7 +193,7 @@ class UserMailForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'enableHTML' => $this->enableHTML, 'from' => $this->from, 'groupIDs' => $this->groupIDs, @@ -202,6 +202,6 @@ class UserMailForm extends AbstractForm { 'text' => $this->text, 'userIDs' => $this->userIDs, 'userList' => $this->userList - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php b/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php index e44eeaca0f..46db2f097f 100644 --- a/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserMergeForm.class.php @@ -25,7 +25,7 @@ class UserMergeForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditUser'); + public $neededPermissions = ['admin.user.canEditUser']; /** * @see \wcf\page\AbstractPage::$activeMenuItem @@ -36,13 +36,13 @@ class UserMergeForm extends AbstractForm { * ids of the relevant users * @var integer[] */ - public $userIDs = array(); + public $userIDs = []; /** * relevant users * @var User[] */ - public $users = array(); + public $users = []; /** * destination user id @@ -54,7 +54,7 @@ class UserMergeForm extends AbstractForm { * ids of merge users (without destination user) * @var integer[] */ - public $mergedUserIDs = array(); + public $mergedUserIDs = []; /** * id of the user clipboard item object type @@ -110,141 +110,141 @@ class UserMergeForm extends AbstractForm { // poll_option_vote $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE IGNORE wcf".WCF_N."_poll_option_vote SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // comment $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_comment SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // comment_response $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_comment_response SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // profile comments $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.user.profileComment'); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectType->objectTypeID)); - $conditions->add("objectID IN (?)", array($this->mergedUserIDs)); + $conditions->add("objectTypeID = ?", [$objectType->objectTypeID]); + $conditions->add("objectID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_comment SET objectID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // like (userID) $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE IGNORE wcf".WCF_N."_like SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // like (objectUserID) $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectUserID IN (?)", array($this->mergedUserIDs)); + $conditions->add("objectUserID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_like SET objectUserID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // like_object $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectUserID IN (?)", array($this->mergedUserIDs)); + $conditions->add("objectUserID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_like_object SET objectUserID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // user_follow (userID) $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); - $conditions->add("followUserID <> ?", array($this->destinationUserID)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); + $conditions->add("followUserID <> ?", [$this->destinationUserID]); $sql = "UPDATE IGNORE wcf".WCF_N."_user_follow SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // user_follow (followUserID) $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("followUserID IN (?)", array($this->mergedUserIDs)); - $conditions->add("userID <> ?", array($this->destinationUserID)); + $conditions->add("followUserID IN (?)", [$this->mergedUserIDs]); + $conditions->add("userID <> ?", [$this->destinationUserID]); $sql = "UPDATE IGNORE wcf".WCF_N."_user_follow SET followUserID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // user_ignore (userID) $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); - $conditions->add("ignoreUserID <> ?", array($this->destinationUserID)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); + $conditions->add("ignoreUserID <> ?", [$this->destinationUserID]); $sql = "UPDATE IGNORE wcf".WCF_N."_user_ignore SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // user_ignore (ignoreUserID) $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("ignoreUserID IN (?)", array($this->mergedUserIDs)); - $conditions->add("userID <> ?", array($this->destinationUserID)); + $conditions->add("ignoreUserID IN (?)", [$this->mergedUserIDs]); + $conditions->add("userID <> ?", [$this->destinationUserID]); $sql = "UPDATE IGNORE wcf".WCF_N."_user_ignore SET ignoreUserID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // user_object_watch $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE IGNORE wcf".WCF_N."_user_object_watch SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // user_activity_event $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_user_activity_event SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // attachments $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_attachment SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // modification_log $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($this->mergedUserIDs)); + $conditions->add("userID IN (?)", [$this->mergedUserIDs]); $sql = "UPDATE wcf".WCF_N."_modification_log SET userID = ? ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($this->destinationUserID), $conditions->getParameters())); + $statement->execute(array_merge([$this->destinationUserID], $conditions->getParameters())); // delete merged users $action = new UserAction($this->mergedUserIDs, 'delete'); @@ -267,10 +267,10 @@ class UserMergeForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'users' => $this->users, 'userIDs' => $this->userIDs, 'destinationUserID' => $this->destinationUserID - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php index b88715fba0..f917a8a0b5 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php @@ -26,7 +26,7 @@ class UserOptionCategoryAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canManageUserOption'); + public $neededPermissions = ['admin.user.canManageUserOption']; /** * category name @@ -79,11 +79,11 @@ class UserOptionCategoryAddForm extends AbstractForm { parent::save(); // save label - $this->objectAction = new UserOptionCategoryAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserOptionCategoryAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'parentCategoryName' => 'profile', 'categoryName' => $this->categoryName, 'showOrder' => $this->showOrder - )))); + ])]); $this->objectAction->executeAction(); // update name @@ -91,9 +91,9 @@ class UserOptionCategoryAddForm extends AbstractForm { $categoryID = $returnValues['returnValues']->categoryID; I18nHandler::getInstance()->save('categoryName', 'wcf.user.option.category.category'.$categoryID, 'wcf.user.option'); $categoryEditor = new UserOptionCategoryEditor($returnValues['returnValues']); - $categoryEditor->update(array( + $categoryEditor->update([ 'categoryName' => 'category'.$categoryID - )); + ]); $this->saved(); // reset values @@ -103,9 +103,9 @@ class UserOptionCategoryAddForm extends AbstractForm { I18nHandler::getInstance()->reset(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -116,10 +116,10 @@ class UserOptionCategoryAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'categoryName' => $this->categoryName, 'showOrder' => $this->showOrder - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryEditForm.class.php index d32c3721c4..8d50127684 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryEditForm.class.php @@ -56,9 +56,9 @@ class UserOptionCategoryEditForm extends UserOptionCategoryAddForm { I18nHandler::getInstance()->save('categoryName', 'wcf.user.option.category.'.$this->category->categoryName, 'wcf.user.option'); - $this->objectAction = new UserOptionCategoryAction(array($this->category), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserOptionCategoryAction([$this->category], 'update', ['data' => array_merge($this->additionalFields, [ 'showOrder' => $this->showOrder - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -86,10 +86,10 @@ class UserOptionCategoryEditForm extends UserOptionCategoryAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'categoryID' => $this->categoryID, 'category' => $this->category - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionEditForm.class.php index 3d7f15e4ba..4831d6bcca 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionEditForm.class.php @@ -57,7 +57,7 @@ class UserOptionEditForm extends UserOptionAddForm { I18nHandler::getInstance()->save('optionName', 'wcf.user.option.'.$this->userOption->optionName, 'wcf.user.option'); I18nHandler::getInstance()->save('optionDescription', 'wcf.user.option.'.$this->userOption->optionName.'.description', 'wcf.user.option'); - $this->objectAction = new UserOptionAction(array($this->userOption), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserOptionAction([$this->userOption], 'update', ['data' => array_merge($this->additionalFields, [ 'categoryName' => $this->categoryName, 'optionType' => $this->optionType, 'defaultValue' => $this->defaultValue, @@ -70,7 +70,7 @@ class UserOptionEditForm extends UserOptionAddForm { 'searchable' => $this->searchable, 'editable' => $this->editable, 'visible' => $this->visible - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -110,10 +110,10 @@ class UserOptionEditForm extends UserOptionAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'edit', 'optionID' => $this->optionID, 'userOption' => $this->userOption - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionListForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionListForm.class.php index a10acc2828..6a8de2cd2f 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionListForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionListForm.class.php @@ -30,7 +30,7 @@ abstract class UserOptionListForm extends AbstractOptionListForm { * @return array */ protected function getAvailableGroups() { - $userGroups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS)); + $userGroups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]); // work-around for PHP 5.3.3 randomly failing in uasort() foreach ($userGroups as $userGroup) { diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionSetDefaultsForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionSetDefaultsForm.class.php index e2d1e865f5..54aeeb21c1 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionSetDefaultsForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionSetDefaultsForm.class.php @@ -24,7 +24,7 @@ class UserOptionSetDefaultsForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canManageUserOption'); + public $neededPermissions = ['admin.user.canManageUserOption']; /** * user option handler @@ -87,7 +87,7 @@ class UserOptionSetDefaultsForm extends AbstractForm { WHERE optionID IN (?".str_repeat(', ?', count($optionIDs) - 1).")"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($optionIDs); - $optionIDs = $optionValues = array(); + $optionIDs = $optionValues = []; while ($row = $statement->fetchArray()) { if ($row['defaultValue'] != $saveOptions[$row['optionID']]) { $optionIDs[] = $row['optionID']; @@ -109,7 +109,7 @@ class UserOptionSetDefaultsForm extends AbstractForm { WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($saveOptions as $optionID => $value) { - $statement->execute(array($value, $optionID)); + $statement->execute([$value, $optionID]); } // reset cache @@ -136,9 +136,9 @@ class UserOptionSetDefaultsForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'optionTree' => $this->optionHandler->getOptionTree(), 'applyChangesToExistingUsers' => $this->applyChangesToExistingUsers - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php index a5d508a319..db075e30ab 100644 --- a/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php @@ -29,12 +29,12 @@ class UserRankAddForm extends AbstractForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.rank.canManageRank'); + public $neededPermissions = ['admin.user.rank.canManageRank']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_USER_RANK'); + public $neededModules = ['MODULE_USER_RANK']; /** * rank group id @@ -88,7 +88,7 @@ class UserRankAddForm extends AbstractForm { * list of pre-defined css class names * @var string[] */ - public $availableCssClassNames = array( + public $availableCssClassNames = [ 'yellow', 'orange', 'brown', @@ -101,7 +101,7 @@ class UserRankAddForm extends AbstractForm { 'none', /* not a real value */ 'custom' /* not a real value */ - ); + ]; /** * @see \wcf\page\IPage::readParameters() @@ -181,7 +181,7 @@ class UserRankAddForm extends AbstractForm { parent::save(); // save label - $this->objectAction = new UserRankAction(array(), 'create', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserRankAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'rankTitle' => $this->rankTitle, 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName), 'groupID' => $this->groupID, @@ -189,7 +189,7 @@ class UserRankAddForm extends AbstractForm { 'rankImage' => $this->rankImage, 'repeatImage' => $this->repeatImage, 'requiredGender' => $this->requiredGender - )))); + ])]); $this->objectAction->executeAction(); if (!I18nHandler::getInstance()->isPlainValue('rankTitle')) { @@ -199,9 +199,9 @@ class UserRankAddForm extends AbstractForm { // update name $rankEditor = new UserRankEditor($returnValues['returnValues']); - $rankEditor->update(array( + $rankEditor->update([ 'rankTitle' => 'wcf.user.rank.userRank'.$rankID - )); + ]); } $this->saved(); @@ -213,9 +213,9 @@ class UserRankAddForm extends AbstractForm { I18nHandler::getInstance()->reset(); // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -226,18 +226,18 @@ class UserRankAddForm extends AbstractForm { I18nHandler::getInstance()->assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => 'add', 'availableCssClassNames' => $this->availableCssClassNames, 'cssClassName' => $this->cssClassName, 'customCssClassName' => $this->customCssClassName, 'groupID' => $this->groupID, 'rankTitle' => $this->rankTitle, - 'availableGroups' => UserGroup::getGroupsByType(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE)), + 'availableGroups' => UserGroup::getGroupsByType([], [UserGroup::GUESTS, UserGroup::EVERYONE]), 'requiredPoints' => $this->requiredPoints, 'rankImage' => $this->rankImage, 'repeatImage' => $this->repeatImage, 'requiredGender' => $this->requiredGender - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserRankEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserRankEditForm.class.php index 585ade4ac5..3ba24f7a9a 100644 --- a/wcfsetup/install/files/lib/acp/form/UserRankEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserRankEditForm.class.php @@ -64,7 +64,7 @@ class UserRankEditForm extends UserRankAddForm { } // update label - $this->objectAction = new UserRankAction(array($this->rank), 'update', array('data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserRankAction([$this->rank], 'update', ['data' => array_merge($this->additionalFields, [ 'rankTitle' => $this->rankTitle, 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName), 'groupID' => $this->groupID, @@ -72,7 +72,7 @@ class UserRankEditForm extends UserRankAddForm { 'rankImage' => $this->rankImage, 'repeatImage' => $this->repeatImage, 'requiredGender' => $this->requiredGender - )))); + ])]); $this->objectAction->executeAction(); $this->saved(); @@ -80,9 +80,9 @@ class UserRankEditForm extends UserRankAddForm { if ($this->cssClassName != 'custom') $this->customCssClassName = ''; // show success - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'success' => true - )); + ]); } /** @@ -115,10 +115,10 @@ class UserRankEditForm extends UserRankAddForm { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'rankID' => $this->rankID, 'rank' => $this->rank, 'action' => 'edit' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php b/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php index c3b916eb6e..54d0b662fa 100755 --- a/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserSearchForm.class.php @@ -33,13 +33,13 @@ class UserSearchForm extends UserOptionListForm { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canSearchUser'); + public $neededPermissions = ['admin.user.canSearchUser']; /** * list of grouped user group assignment condition object types * @var array */ - public $conditions = array(); + public $conditions = []; /** * list with searched users @@ -75,7 +75,7 @@ class UserSearchForm extends UserOptionListForm { * shown columns * @var string[] */ - public $columns = array('registrationDate', 'lastActivityTime'); + public $columns = ['registrationDate', 'lastActivityTime']; /** * number of results @@ -163,14 +163,14 @@ class UserSearchForm extends UserOptionListForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'groupedObjectTypes' => $this->conditions, 'sortField' => $this->sortField, 'sortOrder' => $this->sortOrder, 'itemsPerPage' => $this->itemsPerPage, 'columns' => $this->columns, 'columnOptions' => $this->optionHandler->getCategoryOptions('profile') - )); + ]); } /** @@ -186,12 +186,12 @@ class UserSearchForm extends UserOptionListForm { 'columns' => $this->columns ]); - $search = SearchEditor::create(array( + $search = SearchEditor::create([ 'userID' => WCF::getUser()->userID, 'searchData' => $data, 'searchTime' => TIME_NOW, 'searchType' => 'users' - )); + ]); // get new search id $this->searchID = $search->searchID; diff --git a/wcfsetup/install/files/lib/acp/page/ACPSessionLogListPage.class.php b/wcfsetup/install/files/lib/acp/page/ACPSessionLogListPage.class.php index b46b3d9522..9a64783ff3 100755 --- a/wcfsetup/install/files/lib/acp/page/ACPSessionLogListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ACPSessionLogListPage.class.php @@ -26,7 +26,7 @@ class ACPSessionLogListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canViewLog'); + public $neededPermissions = ['admin.management.canViewLog']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -41,7 +41,7 @@ class ACPSessionLogListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('sessionLogID', 'username', 'ipAddress', 'userAgent', 'time', 'lastActivityTime', 'accesses'); + public $validSortFields = ['sessionLogID', 'username', 'ipAddress', 'userAgent', 'time', 'lastActivityTime', 'accesses']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php b/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php index e94bd44523..67e51a86d5 100755 --- a/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php @@ -29,7 +29,7 @@ class ACPSessionLogPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canViewLog'); + public $neededPermissions = ['admin.management.canViewLog']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -39,7 +39,7 @@ class ACPSessionLogPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('sessionAccessLogID', 'ipAddress', 'time', 'requestURI', 'requestMethod', 'className'); + public $validSortFields = ['sessionAccessLogID', 'ipAddress', 'time', 'requestURI', 'requestMethod', 'className']; /** * session log id @@ -78,7 +78,7 @@ class ACPSessionLogPage extends SortablePage { protected function initObjectList() { parent::initObjectList(); - $this->objectList->getConditionBuilder()->add('sessionLogID = ?', array($this->sessionLogID)); + $this->objectList->getConditionBuilder()->add('sessionLogID = ?', [$this->sessionLogID]); } /** @@ -96,9 +96,9 @@ class ACPSessionLogPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'sessionLogID' => $this->sessionLogID, 'sessionLog' => $this->sessionLog - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php b/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php index 4da4b69fe6..8387146d17 100644 --- a/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php @@ -98,14 +98,14 @@ abstract class AbstractCategoryListPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'addController' => $this->addController, 'categoryNodeList' => $this->categoryNodeTree->getIterator(), 'collapsedCategoryIDs' => $this->collapsedCategoryIDs, 'collapsibleObjectTypeID' => $this->collapsibleObjectTypeID, 'editController' => $this->editController, 'objectType' => $this->objectType - )); + ]); if ($this->pageTitle) { WCF::getTPL()->assign('pageTitle', $this->pageTitle); diff --git a/wcfsetup/install/files/lib/acp/page/AdListPage.class.php b/wcfsetup/install/files/lib/acp/page/AdListPage.class.php index 44d0707b83..42d58d1679 100644 --- a/wcfsetup/install/files/lib/acp/page/AdListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/AdListPage.class.php @@ -21,12 +21,12 @@ class AdListPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.ad.canManageAd'); + public $neededPermissions = ['admin.ad.canManageAd']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_WCF_AD'); + public $neededModules = ['MODULE_WCF_AD']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php b/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php index f809e1e1ee..83983ae6ba 100644 --- a/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php @@ -29,7 +29,7 @@ class ApplicationManagementPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.canManageApplication'); + public $neededPermissions = ['admin.configuration.canManageApplication']; /** * @see \wcf\page\IPage::readData() @@ -47,8 +47,8 @@ class ApplicationManagementPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'applicationList' => $this->applicationList - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/AttachmentListPage.class.php b/wcfsetup/install/files/lib/acp/page/AttachmentListPage.class.php index ae057582d1..b49f0a5d2f 100644 --- a/wcfsetup/install/files/lib/acp/page/AttachmentListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/AttachmentListPage.class.php @@ -25,7 +25,7 @@ class AttachmentListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.attachment.canManageAttachment'); + public $neededPermissions = ['admin.attachment.canManageAttachment']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -40,7 +40,7 @@ class AttachmentListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('attachmentID', 'filename', 'filesize', 'downloads', 'uploadTime', 'lastDownloadTime'); + public $validSortFields = ['attachmentID', 'filename', 'filesize', 'downloads', 'uploadTime', 'lastDownloadTime']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -69,13 +69,13 @@ class AttachmentListPage extends SortablePage { * available file types * @var string[] */ - public $availableFileTypes = array(); + public $availableFileTypes = []; /** * attachment stats * @var array */ - public $stats = array(); + public $stats = []; /** * @see \wcf\page\IPage::readParameters() @@ -94,14 +94,14 @@ class AttachmentListPage extends SortablePage { protected function initObjectList() { parent::initObjectList(); - $objectTypeIDs = array(); + $objectTypeIDs = []; foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.attachment.objectType') as $objectType) { if (!$objectType->private) { $objectTypeIDs[] = $objectType->objectTypeID; } } - if (!empty($objectTypeIDs)) $this->objectList->getConditionBuilder()->add('attachment.objectTypeID IN (?)', array($objectTypeIDs)); + if (!empty($objectTypeIDs)) $this->objectList->getConditionBuilder()->add('attachment.objectTypeID IN (?)', [$objectTypeIDs]); else $this->objectList->getConditionBuilder()->add('1 = 0'); $this->objectList->getConditionBuilder()->add("attachment.tmpHash = ''"); @@ -113,14 +113,14 @@ class AttachmentListPage extends SortablePage { if (!empty($this->username)) { $user = User::getUserByUsername($this->username); if ($user->userID) { - $this->objectList->getConditionBuilder()->add('attachment.userID = ?', array($user->userID)); + $this->objectList->getConditionBuilder()->add('attachment.userID = ?', [$user->userID]); } } if (!empty($this->filename)) { - $this->objectList->getConditionBuilder()->add('attachment.filename LIKE ?', array($this->filename.'%')); + $this->objectList->getConditionBuilder()->add('attachment.filename LIKE ?', [$this->filename.'%']); } if (!empty($this->fileType)) { - $this->objectList->getConditionBuilder()->add('attachment.fileType LIKE ?', array($this->fileType)); + $this->objectList->getConditionBuilder()->add('attachment.fileType LIKE ?', [$this->fileType]); } } @@ -130,12 +130,12 @@ class AttachmentListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'stats' => $this->stats, 'username' => $this->username, 'filename' => $this->filename, 'fileType' => $this->fileType, 'availableFileTypes' => $this->availableFileTypes - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/AttachmentPage.class.php b/wcfsetup/install/files/lib/acp/page/AttachmentPage.class.php index a7e9d0bba5..2c2ceabf5e 100644 --- a/wcfsetup/install/files/lib/acp/page/AttachmentPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/AttachmentPage.class.php @@ -18,7 +18,7 @@ class AttachmentPage extends \wcf\page\AttachmentPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.attachment.canManageAttachment'); + public $neededPermissions = ['admin.attachment.canManageAttachment']; /** * @see \wcf\page\IPage::checkPermissions() diff --git a/wcfsetup/install/files/lib/acp/page/BBCodeListPage.class.php b/wcfsetup/install/files/lib/acp/page/BBCodeListPage.class.php index 4beb985fbc..341abc5df7 100644 --- a/wcfsetup/install/files/lib/acp/page/BBCodeListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/BBCodeListPage.class.php @@ -26,7 +26,7 @@ class BBCodeListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.bbcode.canManageBBCode'); + public $neededPermissions = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -41,5 +41,5 @@ class BBCodeListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('bbcodeID', 'bbcodeTag', 'className'); + public $validSortFields = ['bbcodeID', 'bbcodeTag', 'className']; } diff --git a/wcfsetup/install/files/lib/acp/page/BBCodeMediaProviderListPage.class.php b/wcfsetup/install/files/lib/acp/page/BBCodeMediaProviderListPage.class.php index 665f652976..7fd63d1785 100644 --- a/wcfsetup/install/files/lib/acp/page/BBCodeMediaProviderListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/BBCodeMediaProviderListPage.class.php @@ -26,7 +26,7 @@ class BBCodeMediaProviderListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.bbcode.canManageBBCode'); + public $neededPermissions = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -41,5 +41,5 @@ class BBCodeMediaProviderListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('providerID', 'title'); + public $validSortFields = ['providerID', 'title']; } diff --git a/wcfsetup/install/files/lib/acp/page/BoxListPage.class.php b/wcfsetup/install/files/lib/acp/page/BoxListPage.class.php index 954737dced..5fd8461a52 100644 --- a/wcfsetup/install/files/lib/acp/page/BoxListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/BoxListPage.class.php @@ -30,7 +30,7 @@ class BoxListPage extends SortablePage { /** * @inheritdoc */ - public $neededPermissions = array('admin.content.cms.canManageBox'); + public $neededPermissions = ['admin.content.cms.canManageBox']; /** * @inheritdoc @@ -40,7 +40,7 @@ class BoxListPage extends SortablePage { /** * @inheritdoc */ - public $validSortFields = array('boxID', 'name', 'boxType', 'position', 'showOrder'); + public $validSortFields = ['boxID', 'name', 'boxType', 'position', 'showOrder']; /** * name @@ -92,25 +92,25 @@ class BoxListPage extends SortablePage { parent::initObjectList(); // hide menu boxes - $this->objectList->getConditionBuilder()->add('box.boxType <> ?', array('menu')); + $this->objectList->getConditionBuilder()->add('box.boxType <> ?', ['menu']); if (!empty($this->name)) { - $this->objectList->getConditionBuilder()->add('box.name LIKE ?', array('%'.$this->name.'%')); + $this->objectList->getConditionBuilder()->add('box.name LIKE ?', ['%'.$this->name.'%']); } if (!empty($this->title)) { - $this->objectList->getConditionBuilder()->add('box.boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_content WHERE title LIKE ?)', array('%'.$this->title.'%')); + $this->objectList->getConditionBuilder()->add('box.boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_content WHERE title LIKE ?)', ['%'.$this->title.'%']); } if (!empty($this->content)) { - $this->objectList->getConditionBuilder()->add('box.boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_content WHERE content LIKE ?)', array('%'.$this->content.'%')); + $this->objectList->getConditionBuilder()->add('box.boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_content WHERE content LIKE ?)', ['%'.$this->content.'%']); } if (!empty($this->position)) { - $this->objectList->getConditionBuilder()->add('box.position = ?', array($this->position)); + $this->objectList->getConditionBuilder()->add('box.position = ?', [$this->position]); } if ($this->boxType == 'static') { - $this->objectList->getConditionBuilder()->add('box.boxType IN (?, ?, ?)', array('text', 'html', 'tpl')); + $this->objectList->getConditionBuilder()->add('box.boxType IN (?, ?, ?)', ['text', 'html', 'tpl']); } else if ($this->boxType == 'system') { - $this->objectList->getConditionBuilder()->add('box.boxType IN (?)', array('system')); + $this->objectList->getConditionBuilder()->add('box.boxType IN (?)', ['system']); } } @@ -120,13 +120,13 @@ class BoxListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'name' => $this->name, 'title' => $this->title, 'content' => $this->content, 'boxType' => $this->boxType, 'position' => $this->position, 'availablePositions' => Box::$availablePositions - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php b/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php index b405c900bc..ee589eab74 100755 --- a/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php @@ -27,7 +27,7 @@ class CacheListPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.canManageApplication'); + public $neededPermissions = ['admin.configuration.canManageApplication']; /** * indicates if cache was cleared @@ -39,13 +39,13 @@ class CacheListPage extends AbstractPage { * contains a list of cache resources * @var array */ - public $caches = array(); + public $caches = []; /** * contains general cache information * @var array */ - public $cacheData = array(); + public $cacheData = []; /** * @see \wcf\page\IPage::readParameters() @@ -63,12 +63,12 @@ class CacheListPage extends AbstractPage { parent::readData(); // init cache data - $this->cacheData = array( + $this->cacheData = [ 'source' => get_class(CacheHandler::getInstance()->getCacheSource()), 'version' => '', 'size' => 0, 'files' => 0 - ); + ]; switch ($this->cacheData['source']) { case 'wcf\system\cache\source\DiskCacheSource': @@ -105,7 +105,7 @@ class CacheListPage extends AbstractPage { */ protected function readCacheFiles($cacheType, $cacheDir, Regex $ignore = null, $extension = 'php') { if (!isset($this->cacheData[$cacheType])) { - $this->cacheData[$cacheType] = array(); + $this->cacheData[$cacheType] = []; } // get files in cache directory @@ -119,7 +119,7 @@ class CacheListPage extends AbstractPage { $files = $directoryUtil->getFileObjects(SORT_ASC, new Regex('\.'.$extension.'$')); // get additional file information - $data = array(); + $data = []; if (is_array($files)) { /** @var \SplFileInfo $file */ foreach ($files as $file) { @@ -127,13 +127,13 @@ class CacheListPage extends AbstractPage { continue; } - $data[] = array( + $data[] = [ 'filename' => $file->getBasename(), 'filesize' => $file->getSize(), 'mtime' => $file->getMTime(), 'perm' => substr(sprintf('%o', $file->getPerms()), -3), 'writable' => $file->isWritable() - ); + ]; $this->cacheData['files']++; $this->cacheData['size'] += $file->getSize(); @@ -149,10 +149,10 @@ class CacheListPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'caches' => $this->caches, 'cacheData' => $this->cacheData, 'cleared' => $this->cleared - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/CaptchaQuestionListPage.class.php b/wcfsetup/install/files/lib/acp/page/CaptchaQuestionListPage.class.php index be00c0d611..ba0e5ed9fc 100644 --- a/wcfsetup/install/files/lib/acp/page/CaptchaQuestionListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CaptchaQuestionListPage.class.php @@ -21,7 +21,7 @@ class CaptchaQuestionListPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.captcha.canManageCaptchaQuestion'); + public $neededPermissions = ['admin.captcha.canManageCaptchaQuestion']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php b/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php index 197c8ca4da..154953a3d2 100755 --- a/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php @@ -21,7 +21,7 @@ class CronjobListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canManageCronjob'); + public $neededPermissions = ['admin.management.canManageCronjob']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -31,7 +31,7 @@ class CronjobListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('cronjobID', 'nextExec', 'startMinute', 'startHour', 'startDom', 'startMonth', 'startDow'); + public $validSortFields = ['cronjobID', 'nextExec', 'startMinute', 'startHour', 'startDom', 'startMonth', 'startDow']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php b/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php index aee3b8efe4..c55cfd9062 100755 --- a/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php @@ -21,7 +21,7 @@ class CronjobLogListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canManageCronjob'); + public $neededPermissions = ['admin.management.canManageCronjob']; /** * @see \wcf\page\MultipleLinkPage::$itemsPerPage @@ -41,7 +41,7 @@ class CronjobLogListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('cronjobID', 'className', 'description', 'execTime', 'success'); + public $validSortFields = ['cronjobID', 'className', 'description', 'execTime', 'success']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php b/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php index 750b034a87..5e0dd73f9e 100644 --- a/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php @@ -28,7 +28,7 @@ class ExceptionLogViewPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canViewLog'); + public $neededPermissions = ['admin.management.canViewLog']; /** * @see \wcf\page\MultipleLinkPage::$itemsPerPage @@ -51,13 +51,13 @@ class ExceptionLogViewPage extends MultipleLinkPage { * available logfiles * @var string[] */ - public $logFiles = array(); + public $logFiles = []; /** * exceptions shown * @var array */ - public $exceptions = array(); + public $exceptions = []; /** * @see \wcf\page\IPage::readParameters() @@ -119,7 +119,7 @@ class ExceptionLogViewPage extends MultipleLinkPage { try { $this->exceptions = call_user_func_array('array_merge', array_map( function($v) { - return array($v[0] => $v[1]); + return [$v[0] => $v[1]]; }, array_chunk($contents, 2) )); @@ -212,11 +212,11 @@ Stack Trace: (?P[a-zA-Z0-9+/]+={0,2})', Regex::DOT_ALL); public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'exceptionID' => $this->exceptionID, 'logFiles' => array_flip(array_map('basename', $this->logFiles)), 'logFile' => $this->logFile, 'exceptions' => $this->exceptions - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/LabelGroupListPage.class.php b/wcfsetup/install/files/lib/acp/page/LabelGroupListPage.class.php index dd3b915fe1..8568e7ea0b 100644 --- a/wcfsetup/install/files/lib/acp/page/LabelGroupListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/LabelGroupListPage.class.php @@ -26,12 +26,12 @@ class LabelGroupListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('groupID', 'groupName', 'groupDescription', 'showOrder'); + public $validSortFields = ['groupID', 'groupName', 'groupDescription', 'showOrder']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.label.canManageLabel'); + public $neededPermissions = ['admin.content.label.canManageLabel']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/LanguageItemListPage.class.php b/wcfsetup/install/files/lib/acp/page/LanguageItemListPage.class.php index 8be8ec16c7..33ba0250b5 100644 --- a/wcfsetup/install/files/lib/acp/page/LanguageItemListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/LanguageItemListPage.class.php @@ -32,7 +32,7 @@ class LanguageItemListPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.language.canManageLanguage'); + public $neededPermissions = ['admin.language.canManageLanguage']; /** * language item list @@ -74,13 +74,13 @@ class LanguageItemListPage extends AbstractPage { * available languages * @var array */ - public $availableLanguages = array(); + public $availableLanguages = []; /** * available language categories * @var array */ - public $availableLanguageCategories = array(); + public $availableLanguageCategories = []; /** * current page no @@ -126,10 +126,10 @@ class LanguageItemListPage extends AbstractPage { // get items $this->languageItemList = new LanguageItemList(); - $this->languageItemList->getConditionBuilder()->add('languageID = ?', array($this->languageID)); - if ($this->languageCategoryID) $this->languageItemList->getConditionBuilder()->add('languageCategoryID = ?', array($this->languageCategoryID)); - if ($this->languageItem) $this->languageItemList->getConditionBuilder()->add('languageItem LIKE ?', array('%'.$this->languageItem.'%')); - if ($this->languageItemValue) $this->languageItemList->getConditionBuilder()->add('((languageUseCustomValue = 0 AND languageItemValue LIKE ?) OR languageCustomItemValue LIKE ?)', array('%'.$this->languageItemValue.'%', '%'.$this->languageItemValue.'%')); + $this->languageItemList->getConditionBuilder()->add('languageID = ?', [$this->languageID]); + if ($this->languageCategoryID) $this->languageItemList->getConditionBuilder()->add('languageCategoryID = ?', [$this->languageCategoryID]); + if ($this->languageItem) $this->languageItemList->getConditionBuilder()->add('languageItem LIKE ?', ['%'.$this->languageItem.'%']); + if ($this->languageItemValue) $this->languageItemList->getConditionBuilder()->add('((languageUseCustomValue = 0 AND languageItemValue LIKE ?) OR languageCustomItemValue LIKE ?)', ['%'.$this->languageItemValue.'%', '%'.$this->languageItemValue.'%']); if ($this->hasCustomValue) $this->languageItemList->getConditionBuilder()->add("languageCustomItemValue IS NOT NULL"); $this->languageItemList->sqlLimit = 100; @@ -152,7 +152,7 @@ class LanguageItemListPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'objects' => $this->languageItemList, 'count' => $this->count, 'pageNo' => $this->pageNo, @@ -163,6 +163,6 @@ class LanguageItemListPage extends AbstractPage { 'hasCustomValue' => $this->hasCustomValue, 'availableLanguages' => $this->availableLanguages, 'availableLanguageCategories' => $this->availableLanguageCategories - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php b/wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php index 72966e9d84..d948e604c5 100644 --- a/wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/LanguageListPage.class.php @@ -27,7 +27,7 @@ class LanguageListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.language.canManageLanguage'); + public $neededPermissions = ['admin.language.canManageLanguage']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -37,7 +37,7 @@ class LanguageListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('languageID', 'languageCode', 'languageName', 'users', 'variables', 'customVariables'); + public $validSortFields = ['languageID', 'languageCode', 'languageName', 'users', 'variables', 'customVariables']; /** * @see \wcf\page\MultipleLinkPage::initObjectList() @@ -56,8 +56,8 @@ class LanguageListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'languages' => $this->objectList->getObjects() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/MenuItemListPage.class.php b/wcfsetup/install/files/lib/acp/page/MenuItemListPage.class.php index 8b97f4104c..20d6982fc7 100644 --- a/wcfsetup/install/files/lib/acp/page/MenuItemListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/MenuItemListPage.class.php @@ -26,7 +26,7 @@ class MenuItemListPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.cms.canManageMenu'); + public $neededPermissions = ['admin.content.cms.canManageMenu']; /** * menu item list @@ -80,10 +80,10 @@ class MenuItemListPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'menuID' => $this->menuID, 'menu' => $this->menu, 'menuItemNodeList' => $this->menuItems->getNodeList() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/NoticeListPage.class.php b/wcfsetup/install/files/lib/acp/page/NoticeListPage.class.php index 769ecba81f..2c9513aa5f 100644 --- a/wcfsetup/install/files/lib/acp/page/NoticeListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/NoticeListPage.class.php @@ -26,7 +26,7 @@ class NoticeListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.notice.canManageNotice'); + public $neededPermissions = ['admin.notice.canManageNotice']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -36,5 +36,5 @@ class NoticeListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$objectListClassName */ - public $validSortFields = array('noticeID', 'noticeName', 'showOrder'); + public $validSortFields = ['noticeID', 'noticeName', 'showOrder']; } diff --git a/wcfsetup/install/files/lib/acp/page/PHPInfoPage.class.php b/wcfsetup/install/files/lib/acp/page/PHPInfoPage.class.php index 4bc394d97c..280319e9e8 100644 --- a/wcfsetup/install/files/lib/acp/page/PHPInfoPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PHPInfoPage.class.php @@ -22,7 +22,7 @@ class PHPInfoPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canInstallPackage', 'admin.configuration.package.canUpdatePackage'); + public $neededPermissions = ['admin.configuration.package.canInstallPackage', 'admin.configuration.package.canUpdatePackage']; /** * @see \wcf\page\IPage::assignVariables() @@ -60,8 +60,8 @@ class PHPInfoPage extends AbstractPage { return $ret; }, $info); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'phpInfo' => $info - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php index 4016ad56da..29afe56741 100644 --- a/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php @@ -68,10 +68,10 @@ class PackageInstallationConfirmPage extends AbstractPage { } if ($this->queue->action == 'install') { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canInstallPackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage']); } else { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canUpdatePackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canUpdatePackage']); } $this->installingImportedStyle = WCF::getSession()->getVar('stylePackageImportLocation') !== null; @@ -98,13 +98,13 @@ class PackageInstallationConfirmPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'archive' => $this->packageInstallationDispatcher->getArchive(), 'packageValidationArchives' => PackageValidationManager::getInstance()->getPackageValidationArchiveList(), 'queue' => $this->queue, 'validationPassed' => $this->validationPassed, 'installingImportedStyle' => $this->installingImportedStyle - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php index bf0bd55b34..6c7553a82b 100644 --- a/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php @@ -22,7 +22,7 @@ class PackageListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canUpdatePackage', 'admin.configuration.package.canUninstallPackage'); + public $neededPermissions = ['admin.configuration.package.canUpdatePackage', 'admin.configuration.package.canUninstallPackage']; /** * @see \wcf\page\MultipleLinkPage::$itemsPerPage @@ -48,7 +48,7 @@ class PackageListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('packageID', 'package', 'packageDir', 'packageName', 'packageDescription', 'packageDate', 'packageURL', 'isApplication', 'author', 'authorURL', 'installDate', 'updateDate'); + public $validSortFields = ['packageID', 'package', 'packageDir', 'packageName', 'packageDescription', 'packageDate', 'packageURL', 'isApplication', 'author', 'authorURL', 'installDate', 'updateDate']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -70,9 +70,9 @@ class PackageListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'packageID' => $this->packageID - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/page/PackagePage.class.php b/wcfsetup/install/files/lib/acp/page/PackagePage.class.php index 01cdbe2736..0f60f91115 100755 --- a/wcfsetup/install/files/lib/acp/page/PackagePage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackagePage.class.php @@ -24,7 +24,7 @@ class PackagePage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canUpdatePackage', 'admin.configuration.package.canUninstallPackage'); + public $neededPermissions = ['admin.configuration.package.canUpdatePackage', 'admin.configuration.package.canUninstallPackage']; /** * id of the package diff --git a/wcfsetup/install/files/lib/acp/page/PackageUpdatePage.class.php b/wcfsetup/install/files/lib/acp/page/PackageUpdatePage.class.php index 2c9694a15a..a16f47ca75 100644 --- a/wcfsetup/install/files/lib/acp/page/PackageUpdatePage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageUpdatePage.class.php @@ -25,12 +25,12 @@ class PackageUpdatePage extends AbstractPage { * list of available updates * @var array */ - public $availableUpdates = array(); + public $availableUpdates = []; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canUpdatePackage'); + public $neededPermissions = ['admin.configuration.package.canUpdatePackage']; /** * @see \wcf\page\IPage::readData() @@ -47,9 +47,9 @@ class PackageUpdatePage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'availableUpdates' => $this->availableUpdates - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/acp/page/PackageUpdateServerListPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageUpdateServerListPage.class.php index e3aa3b80f4..de5c68b35b 100755 --- a/wcfsetup/install/files/lib/acp/page/PackageUpdateServerListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageUpdateServerListPage.class.php @@ -21,7 +21,7 @@ class PackageUpdateServerListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canEditServer'); + public $neededPermissions = ['admin.configuration.package.canEditServer']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -31,7 +31,7 @@ class PackageUpdateServerListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('packageUpdateServerID', 'serverURL', 'status', 'errorMessage', 'lastUpdateTime', 'packages'); + public $validSortFields = ['packageUpdateServerID', 'serverURL', 'status', 'errorMessage', 'lastUpdateTime', 'packages']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionListPage.class.php b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionListPage.class.php index 3961ea3600..9e5abd5f5c 100644 --- a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionListPage.class.php @@ -21,12 +21,12 @@ class PaidSubscriptionListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.paidSubscription.canManageSubscription'); + public $neededPermissions = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -36,7 +36,7 @@ class PaidSubscriptionListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('subscriptionID', 'title', 'showOrder', 'cost', 'subscriptionLength'); + public $validSortFields = ['subscriptionID', 'title', 'showOrder', 'cost', 'subscriptionLength']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogListPage.class.php b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogListPage.class.php index 3b89567d5e..8bd6a76ee1 100644 --- a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogListPage.class.php @@ -24,12 +24,12 @@ class PaidSubscriptionTransactionLogListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.paidSubscription.canManageSubscription'); + public $neededPermissions = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -44,7 +44,7 @@ class PaidSubscriptionTransactionLogListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('logID', 'subscriptionUserID', 'userID', 'subscriptionID', 'paymentMethodObjectTypeID', 'logTime', 'transactionID', 'logMessage'); + public $validSortFields = ['logID', 'subscriptionUserID', 'userID', 'subscriptionID', 'paymentMethodObjectTypeID', 'logTime', 'transactionID', 'logMessage']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -87,13 +87,13 @@ class PaidSubscriptionTransactionLogListPage extends SortablePage { parent::initObjectList(); if ($this->transactionID) { - $this->objectList->getConditionBuilder()->add('paid_subscription_transaction_log.transactionID LIKE ?', array('%' . $this->transactionID . '%')); + $this->objectList->getConditionBuilder()->add('paid_subscription_transaction_log.transactionID LIKE ?', ['%' . $this->transactionID . '%']); } if ($this->username) { - $this->objectList->getConditionBuilder()->add('paid_subscription_transaction_log.userID IN (SELECT userID FROM wcf'.WCF_N.'_user WHERE username LIKE ?)', array('%' . $this->username . '%')); + $this->objectList->getConditionBuilder()->add('paid_subscription_transaction_log.userID IN (SELECT userID FROM wcf'.WCF_N.'_user WHERE username LIKE ?)', ['%' . $this->username . '%']); } if ($this->subscriptionID) { - $this->objectList->getConditionBuilder()->add('paid_subscription_transaction_log.subscriptionID = ?', array($this->subscriptionID)); + $this->objectList->getConditionBuilder()->add('paid_subscription_transaction_log.subscriptionID = ?', [$this->subscriptionID]); } $this->objectList->sqlSelects = 'user_table.username, paid_subscription.title'; @@ -107,11 +107,11 @@ class PaidSubscriptionTransactionLogListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'transactionID' => $this->transactionID, 'username' => $this->username, 'subscriptionID' => $this->subscriptionID, 'availableSubscriptions' => PaidSubscriptionCacheBuilder::getInstance()->getData() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogPage.class.php b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogPage.class.php index 8b74371fb3..800b169455 100644 --- a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionTransactionLogPage.class.php @@ -24,12 +24,12 @@ class PaidSubscriptionTransactionLogPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.paidSubscription.canManageSubscription'); + public $neededPermissions = ['admin.paidSubscription.canManageSubscription']; /** * log entry id @@ -62,9 +62,9 @@ class PaidSubscriptionTransactionLogPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'logID' => $this->logID, 'log' => $this->log - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionUserListPage.class.php b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionUserListPage.class.php index 2f32caf835..6b867a9645 100644 --- a/wcfsetup/install/files/lib/acp/page/PaidSubscriptionUserListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PaidSubscriptionUserListPage.class.php @@ -21,12 +21,12 @@ class PaidSubscriptionUserListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.paidSubscription.canManageSubscription'); + public $neededPermissions = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -36,7 +36,7 @@ class PaidSubscriptionUserListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('subscriptionUserID', 'userID', 'subscriptionID', 'startDate', 'endDate'); + public $validSortFields = ['subscriptionUserID', 'userID', 'subscriptionID', 'startDate', 'endDate']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -49,7 +49,7 @@ class PaidSubscriptionUserListPage extends SortablePage { protected function initObjectList() { parent::initObjectList(); - $this->objectList->getConditionBuilder()->add('isActive = ?', array(1)); + $this->objectList->getConditionBuilder()->add('isActive = ?', [1]); $this->objectList->sqlSelects = 'user_table.username, paid_subscription.title'; $this->objectList->sqlJoins = "LEFT JOIN wcf".WCF_N."_user user_table ON (user_table.userID = paid_subscription_user.userID)"; $this->objectList->sqlJoins .= " LEFT JOIN wcf".WCF_N."_paid_subscription paid_subscription ON (paid_subscription.subscriptionID = paid_subscription_user.subscriptionID)"; diff --git a/wcfsetup/install/files/lib/acp/page/PluginStorePurchasedItemsPage.class.php b/wcfsetup/install/files/lib/acp/page/PluginStorePurchasedItemsPage.class.php index 1204e66a63..48872c0334 100644 --- a/wcfsetup/install/files/lib/acp/page/PluginStorePurchasedItemsPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PluginStorePurchasedItemsPage.class.php @@ -27,31 +27,31 @@ class PluginStorePurchasedItemsPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.configuration.package.canUpdatePackage', 'admin.configuration.package.canUninstallPackage'); + public $neededPermissions = ['admin.configuration.package.canUpdatePackage', 'admin.configuration.package.canUninstallPackage']; /** * list of purchased products grouped by WCF major release * @var array */ - public $products = array(); + public $products = []; /** * list of product data grouped by WCF major release * @var array */ - public $productData = array(); + public $productData = []; /** * list of installed update servers (Plugin-Store only) * @var PackageUpdateServer[] */ - public $updateServers = array(); + public $updateServers = []; /** * list of supported WCF major releases (Plugin-Store) * @var string[] */ - public $wcfMajorReleases = array(); + public $wcfMajorReleases = []; /** * @see \wcf\page\IPage::readParameters() @@ -87,24 +87,24 @@ class PluginStorePurchasedItemsPage extends AbstractPage { foreach ($this->products as $packageUpdateID => $product) { $wcfMajorRelease = $product['wcfMajorRelease']; if (!isset($this->productData[$wcfMajorRelease])) { - $this->productData[$wcfMajorRelease] = array(); + $this->productData[$wcfMajorRelease] = []; } $languageCode = WCF::getLanguage()->languageCode; $packageName = (isset($product['packageName'][$languageCode])) ? $product['packageName'][$languageCode] : $product['packageName']['en']; - $this->productData[$wcfMajorRelease][$packageUpdateID] = array( + $this->productData[$wcfMajorRelease][$packageUpdateID] = [ 'author' => $product['author'], 'authorURL' => $product['authorURL'], 'package' => $product['package'], 'packageName' => $packageName, 'pluginStoreURL' => $product['pluginStoreURL'], - 'version' => array( + 'version' => [ 'available' => $product['lastVersion'], 'installed' => '' - ), + ], 'status' => (isset($this->updateServers[$wcfMajorRelease]) ? 'install' : 'unavailable') - ); + ]; $package = PackageCache::getInstance()->getPackageByIdentifier($product['package']); if ($package !== null) { @@ -130,10 +130,10 @@ class PluginStorePurchasedItemsPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'productData' => $this->productData, 'updateServers' => $this->updateServers, 'wcfMajorReleases' => $this->wcfMajorReleases - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php b/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php index 1808466230..5dcfd8686d 100644 --- a/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php @@ -23,13 +23,13 @@ class RebuildDataPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canRebuildData'); + public $neededPermissions = ['admin.management.canRebuildData']; /** * object types * @var array */ - public $objectTypes = array(); + public $objectTypes = []; /** * display a warning if InnoDB uses a slow configuration @@ -76,9 +76,9 @@ class RebuildDataPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'objectTypes' => $this->objectTypes, 'showInnoDBWarning' => $this->showInnoDBWarning - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/SmileyCategoryListPage.class.php b/wcfsetup/install/files/lib/acp/page/SmileyCategoryListPage.class.php index 511d6f1933..2812d6cd59 100644 --- a/wcfsetup/install/files/lib/acp/page/SmileyCategoryListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/SmileyCategoryListPage.class.php @@ -30,5 +30,5 @@ class SmileyCategoryListPage extends AbstractCategoryListPage { /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_SMILEY'); + public $neededModules = ['MODULE_SMILEY']; } diff --git a/wcfsetup/install/files/lib/acp/page/SmileyListPage.class.php b/wcfsetup/install/files/lib/acp/page/SmileyListPage.class.php index 94c595c24d..70eed0b0ec 100644 --- a/wcfsetup/install/files/lib/acp/page/SmileyListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/SmileyListPage.class.php @@ -26,12 +26,12 @@ class SmileyListPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.smiley.canManageSmiley'); + public $neededPermissions = ['admin.content.smiley.canManageSmiley']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_SMILEY'); + public $neededModules = ['MODULE_SMILEY']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -64,7 +64,7 @@ class SmileyListPage extends MultipleLinkPage { * available categories * @var SmileyCategory[] */ - public $categories = array(); + public $categories = []; /** * @see \wcf\page\IPage::readParameters() @@ -87,11 +87,11 @@ class SmileyListPage extends MultipleLinkPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'category' => $this->category, 'categories' => $this->categories, 'smileyCount' => count(SmileyCache::getInstance()->getSmilies()) - )); + ]); } /** @@ -101,10 +101,10 @@ class SmileyListPage extends MultipleLinkPage { parent::initObjectList(); if ($this->categoryID) { - $this->objectList->getConditionBuilder()->add('categoryID = ?', array($this->categoryID)); + $this->objectList->getConditionBuilder()->add('categoryID = ?', [$this->categoryID]); } else { - $this->objectList->getConditionBuilder()->add('categoryID IS NULL', array()); + $this->objectList->getConditionBuilder()->add('categoryID IS NULL', []); } } diff --git a/wcfsetup/install/files/lib/acp/page/StatPage.class.php b/wcfsetup/install/files/lib/acp/page/StatPage.class.php index 11b8a1f763..58f9f6fa73 100644 --- a/wcfsetup/install/files/lib/acp/page/StatPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/StatPage.class.php @@ -24,7 +24,7 @@ class StatPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canViewLog'); + public $neededPermissions = ['admin.management.canViewLog']; /** * start date (yyyy-mm-dd) @@ -42,7 +42,7 @@ class StatPage extends AbstractPage { * available object type * @var array */ - public $availableObjectTypes = array(); + public $availableObjectTypes = []; /** * @see \wcf\page\AbstractPage::readData() @@ -61,7 +61,7 @@ class StatPage extends AbstractPage { $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.statDailyHandler'); foreach ($objectTypes as $objectType) { if (!isset($this->availableObjectTypes[$objectType->categoryname])) { - $this->availableObjectTypes[$objectType->categoryname] = array(); + $this->availableObjectTypes[$objectType->categoryname] = []; } $this->availableObjectTypes[$objectType->categoryname][] = $objectType; @@ -74,10 +74,10 @@ class StatPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'endDate' => $this->endDate, 'startDate' => $this->startDate, 'availableObjectTypes' => $this->availableObjectTypes - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/StyleListPage.class.php b/wcfsetup/install/files/lib/acp/page/StyleListPage.class.php index 61a95146ef..432501e44a 100644 --- a/wcfsetup/install/files/lib/acp/page/StyleListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/StyleListPage.class.php @@ -21,7 +21,7 @@ class StyleListPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.style.canManageStyle'); + public $neededPermissions = ['admin.style.canManageStyle']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/TagListPage.class.php b/wcfsetup/install/files/lib/acp/page/TagListPage.class.php index 0e9a581bee..501e1192cd 100644 --- a/wcfsetup/install/files/lib/acp/page/TagListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/TagListPage.class.php @@ -24,12 +24,12 @@ class TagListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.tag.canManageTag'); + public $neededPermissions = ['admin.content.tag.canManageTag']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_TAGGING'); + public $neededModules = ['MODULE_TAGGING']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -39,7 +39,7 @@ class TagListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('tagID', 'languageID', 'name', 'usageCount'); + public $validSortFields = ['tagID', 'languageID', 'name', 'usageCount']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -58,10 +58,10 @@ class TagListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'hasMarkedItems' => ClipboardHandler::getInstance()->hasMarkedItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.tag')), 'search' => $this->search - )); + ]); } /** @@ -87,7 +87,7 @@ class TagListPage extends SortablePage { $this->objectList->sqlJoins .= " LEFT JOIN wcf".WCF_N."_tag synonym ON tag.synonymFor = synonym.tagID"; if ($this->search !== '') { - $this->objectList->getConditionBuilder()->add('tag.name LIKE ?', array($this->search.'%')); + $this->objectList->getConditionBuilder()->add('tag.name LIKE ?', [$this->search.'%']); } } } diff --git a/wcfsetup/install/files/lib/acp/page/TemplateGroupListPage.class.php b/wcfsetup/install/files/lib/acp/page/TemplateGroupListPage.class.php index f8c95a2d37..798d4a30c7 100644 --- a/wcfsetup/install/files/lib/acp/page/TemplateGroupListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/TemplateGroupListPage.class.php @@ -21,7 +21,7 @@ class TemplateGroupListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.template.canManageTemplate'); + public $neededPermissions = ['admin.template.canManageTemplate']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -36,7 +36,7 @@ class TemplateGroupListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$defaultSortField */ - public $validSortFields = array('templateGroupID', 'templateGroupName', 'templateGroupFolderName', 'templates'); + public $validSortFields = ['templateGroupID', 'templateGroupName', 'templateGroupFolderName', 'templates']; /** * @see \wcf\page\MultipleLinkPage::initObjectList() diff --git a/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php b/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php index a5e552dd90..da133cade3 100644 --- a/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php @@ -26,7 +26,7 @@ class TemplateListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.template.canManageTemplate'); + public $neededPermissions = ['admin.template.canManageTemplate']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -46,7 +46,7 @@ class TemplateListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('templateID', 'templateName', 'lastModificationTime'); + public $validSortFields = ['templateID', 'templateName', 'lastModificationTime']; /** * template group id @@ -70,13 +70,13 @@ class TemplateListPage extends SortablePage { * available template groups * @var array */ - public $availableTemplateGroups = array(); + public $availableTemplateGroups = []; /** * available applications * @var array */ - public $availableApplications = array(); + public $availableApplications = []; /** * @see \wcf\page\IPage::readParameters() @@ -95,11 +95,11 @@ class TemplateListPage extends SortablePage { protected function initObjectList() { parent::initObjectList(); - if ($this->templateGroupID) $this->objectList->getConditionBuilder()->add('template.templateGroupID = ?', array($this->templateGroupID)); + if ($this->templateGroupID) $this->objectList->getConditionBuilder()->add('template.templateGroupID = ?', [$this->templateGroupID]); else $this->objectList->getConditionBuilder()->add('template.templateGroupID IS NULL'); - if ($this->searchTemplateName) $this->objectList->getConditionBuilder()->add('templateName LIKE ?', array('%'.$this->searchTemplateName.'%')); - if ($this->application) $this->objectList->getConditionBuilder()->add('application = ?', array($this->application)); + if ($this->searchTemplateName) $this->objectList->getConditionBuilder()->add('templateName LIKE ?', ['%'.$this->searchTemplateName.'%']); + if ($this->application) $this->objectList->getConditionBuilder()->add('application = ?', [$this->application]); } /** @@ -109,7 +109,7 @@ class TemplateListPage extends SortablePage { parent::readData(); // get template groups - $this->availableTemplateGroups = TemplateGroup::getSelectList(array(), 1); + $this->availableTemplateGroups = TemplateGroup::getSelectList([], 1); // get applications $applications = ApplicationHandler::getInstance()->getApplications(); @@ -134,12 +134,12 @@ class TemplateListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'templateGroupID' => $this->templateGroupID, 'searchTemplateName' => $this->searchTemplateName, 'application' => $this->application, 'availableTemplateGroups' => $this->availableTemplateGroups, 'availableApplications' => $this->availableApplications - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/UserAuthenticationFailureListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserAuthenticationFailureListPage.class.php index a91ce91ddc..03addba59a 100644 --- a/wcfsetup/install/files/lib/acp/page/UserAuthenticationFailureListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserAuthenticationFailureListPage.class.php @@ -21,12 +21,12 @@ class UserAuthenticationFailureListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.management.canViewLog'); + public $neededPermissions = ['admin.management.canViewLog']; /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('ENABLE_USER_AUTHENTICATION_FAILURE'); + public $neededModules = ['ENABLE_USER_AUTHENTICATION_FAILURE']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -41,7 +41,7 @@ class UserAuthenticationFailureListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('failureID', 'environment', 'userID', 'username', 'time', 'ipAddress', 'userAgent'); + public $validSortFields = ['failureID', 'environment', 'userID', 'username', 'time', 'ipAddress', 'userAgent']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/UserGroupAssignmentListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserGroupAssignmentListPage.class.php index baeb1a07e6..65496a3a80 100644 --- a/wcfsetup/install/files/lib/acp/page/UserGroupAssignmentListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserGroupAssignmentListPage.class.php @@ -21,7 +21,7 @@ class UserGroupAssignmentListPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canManageGroupAssignment'); + public $neededPermissions = ['admin.user.canManageGroupAssignment']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName diff --git a/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php index f1101d0bfa..37f851df47 100755 --- a/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php @@ -22,7 +22,7 @@ class UserGroupListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canEditGroup', 'admin.user.canDeleteGroup'); + public $neededPermissions = ['admin.user.canEditGroup', 'admin.user.canDeleteGroup']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -32,7 +32,7 @@ class UserGroupListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('groupID', 'groupName', 'groupType', 'members', 'priority'); + public $validSortFields = ['groupID', 'groupName', 'groupType', 'members', 'priority']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -81,8 +81,8 @@ class UserGroupListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'deletedGroups' => $this->deletedGroups - )); + ]); } } diff --git a/wcfsetup/install/files/lib/acp/page/UserOptionCategoryListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserOptionCategoryListPage.class.php index a47d0c4497..4196e482aa 100644 --- a/wcfsetup/install/files/lib/acp/page/UserOptionCategoryListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserOptionCategoryListPage.class.php @@ -21,7 +21,7 @@ class UserOptionCategoryListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canManageUserOption'); + public $neededPermissions = ['admin.user.canManageUserOption']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -36,7 +36,7 @@ class UserOptionCategoryListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$defaultSortField */ - public $validSortFields = array('categoryID', 'categoryName', 'showOrder', 'userOptions'); + public $validSortFields = ['categoryID', 'categoryName', 'showOrder', 'userOptions']; /** * @see \wcf\page\MultipleLinkPage::initObjectList @@ -45,6 +45,6 @@ class UserOptionCategoryListPage extends SortablePage { parent::initObjectList(); $this->objectList->sqlSelects = "(SELECT COUNT(*) FROM wcf".WCF_N."_user_option WHERE categoryName = user_option_category.categoryName) AS userOptions"; - $this->objectList->getConditionBuilder()->add('user_option_category.parentCategoryName = ?', array('profile')); + $this->objectList->getConditionBuilder()->add('user_option_category.parentCategoryName = ?', ['profile']); } } diff --git a/wcfsetup/install/files/lib/acp/page/UserOptionListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserOptionListPage.class.php index 05c3e72d6d..69f8a9cbef 100644 --- a/wcfsetup/install/files/lib/acp/page/UserOptionListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserOptionListPage.class.php @@ -21,7 +21,7 @@ class UserOptionListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.canManageUserOption'); + public $neededPermissions = ['admin.user.canManageUserOption']; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -36,7 +36,7 @@ class UserOptionListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$defaultSortField */ - public $validSortFields = array('optionID', 'optionName', 'categoryName', 'optionType', 'showOrder'); + public $validSortFields = ['optionID', 'optionName', 'categoryName', 'optionType', 'showOrder']; /** * @see \wcf\page\MultipleLinkPage::initObjectList @@ -44,6 +44,6 @@ class UserOptionListPage extends SortablePage { protected function initObjectList() { parent::initObjectList(); - $this->objectList->getConditionBuilder()->add("option_table.categoryName IN (SELECT categoryName FROM wcf".WCF_N."_user_option_category WHERE parentCategoryName = ?)", array('profile')); + $this->objectList->getConditionBuilder()->add("option_table.categoryName IN (SELECT categoryName FROM wcf".WCF_N."_user_option_category WHERE parentCategoryName = ?)", ['profile']); } } diff --git a/wcfsetup/install/files/lib/acp/page/UserRankListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserRankListPage.class.php index 99cb36a3c6..9d1cc9aad7 100644 --- a/wcfsetup/install/files/lib/acp/page/UserRankListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserRankListPage.class.php @@ -21,12 +21,12 @@ class UserRankListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.user.rank.canManageRank'); + public $neededPermissions = ['admin.user.rank.canManageRank']; /** * @see wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_USER_RANK'); + public $neededModules = ['MODULE_USER_RANK']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -41,7 +41,7 @@ class UserRankListPage extends SortablePage { /** * @see \wcf\page\MultipleLinkPage::$validSortFields */ - public $validSortFields = array('rankID', 'groupID', 'requiredPoints', 'rankTitle', 'rankImage', 'requiredGender'); + public $validSortFields = ['rankID', 'groupID', 'requiredPoints', 'rankTitle', 'rankImage', 'requiredGender']; /** * @see \wcf\page\MultipleLinkPage::show() diff --git a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php index 1863fa6b82..340cb9d624 100644 --- a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php @@ -32,13 +32,13 @@ class AJAXProxyAction extends AJAXInvokeAction { * list of object ids * @var integer[] */ - protected $objectIDs = array(); + protected $objectIDs = []; /** * additional parameters * @var mixed[] */ - protected $parameters = array(); + protected $parameters = []; /** * @see \wcf\action\IAction::readParameters() @@ -81,13 +81,13 @@ class AJAXProxyAction extends AJAXInvokeAction { protected function sendResponse() { // add benchmark and debug data if (ENABLE_BENCHMARK) { - $this->response['benchmark'] = array( + $this->response['benchmark'] = [ 'executionTime' => WCF::getBenchmark()->getExecutionTime().'s', 'memoryUsage' => WCF::getBenchmark()->getMemoryUsage(), 'phpExecution' => StringUtil::formatNumeric((WCF::getBenchmark()->getExecutionTime() - WCF::getBenchmark()->getQueryExecutionTime()) / WCF::getBenchmark()->getExecutionTime() * 100).'%', 'sqlExecution' => StringUtil::formatNumeric(WCF::getBenchmark()->getQueryExecutionTime() / WCF::getBenchmark()->getExecutionTime() * 100).'%', 'sqlQueries' => WCF::getBenchmark()->getQueryCount() - ); + ]; if (ENABLE_DEBUG_MODE) { $this->response['benchmark']['items'] = WCF::getBenchmark()->getItems(); diff --git a/wcfsetup/install/files/lib/action/AbstractAction.class.php b/wcfsetup/install/files/lib/action/AbstractAction.class.php index 445f49583c..4846b92caa 100644 --- a/wcfsetup/install/files/lib/action/AbstractAction.class.php +++ b/wcfsetup/install/files/lib/action/AbstractAction.class.php @@ -27,13 +27,13 @@ abstract class AbstractAction implements IAction { * needed modules to execute this action * @var string[] */ - public $neededModules = array(); + public $neededModules = []; /** * needed permissions to execute this action * @var string[] */ - public $neededPermissions = array(); + public $neededPermissions = []; /** * @see \wcf\form\IAction::__run() diff --git a/wcfsetup/install/files/lib/action/AbstractDialogAction.class.php b/wcfsetup/install/files/lib/action/AbstractDialogAction.class.php index 919bb02105..f2e0ca82af 100644 --- a/wcfsetup/install/files/lib/action/AbstractDialogAction.class.php +++ b/wcfsetup/install/files/lib/action/AbstractDialogAction.class.php @@ -33,7 +33,7 @@ abstract class AbstractDialogAction extends AbstractSecureAction { * response data * @var array */ - public $data = array(); + public $data = []; /** * @see \wcf\action\IAction::readParameters() diff --git a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php index 6afedcd7b5..38ae15c8f5 100644 --- a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php @@ -27,7 +27,7 @@ class FacebookAuthAction extends AbstractAction { /** * @see \wcf\action\AbstractAction::$neededModules */ - public $neededModules = array('FACEBOOK_PUBLIC_KEY', 'FACEBOOK_PRIVATE_KEY'); + public $neededModules = ['FACEBOOK_PUBLIC_KEY', 'FACEBOOK_PRIVATE_KEY']; /** * @see \wcf\action\IAction::execute() @@ -94,7 +94,7 @@ class FacebookAuthAction extends AbstractAction { if (UserAuthenticationFactory::getInstance()->getUserAuthentication()->supportsPersistentLogins()) { $password = StringUtil::getRandomID(); $userEditor = new UserEditor($user); - $userEditor->update(array('password' => $password)); + $userEditor->update(['password' => $password]); // reload user to retrieve salt $user = new User($user->userID); diff --git a/wcfsetup/install/files/lib/action/GithubAuthAction.class.php b/wcfsetup/install/files/lib/action/GithubAuthAction.class.php index 3ff3c2e9e0..973dbf80d2 100644 --- a/wcfsetup/install/files/lib/action/GithubAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/GithubAuthAction.class.php @@ -27,7 +27,7 @@ class GithubAuthAction extends AbstractAction { /** * @see \wcf\action\AbstractAction::$neededModules */ - public $neededModules = array('GITHUB_PUBLIC_KEY', 'GITHUB_PRIVATE_KEY'); + public $neededModules = ['GITHUB_PUBLIC_KEY', 'GITHUB_PRIVATE_KEY']; /** * @see \wcf\action\IAction::execute() @@ -39,11 +39,11 @@ class GithubAuthAction extends AbstractAction { if (isset($_GET['code'])) { try { // fetch access_token - $request = new HTTPRequest('https://github.com/login/oauth/access_token', array(), array( + $request = new HTTPRequest('https://github.com/login/oauth/access_token', [], [ 'client_id' => StringUtil::trim(GITHUB_PUBLIC_KEY), 'client_secret' => StringUtil::trim(GITHUB_PRIVATE_KEY), 'code' => $_GET['code'] - )); + ]); $request->execute(); $reply = $request->getReply(); @@ -82,7 +82,7 @@ class GithubAuthAction extends AbstractAction { if (!$user->userID) { $user = $this->getUser($data['access_token']); $userEditor = new UserEditor($user); - $userEditor->update(array('authData' => 'github:'.$userData['id'])); + $userEditor->update(['authData' => 'github:'.$userData['id']]); } if ($user->userID) { @@ -95,7 +95,7 @@ class GithubAuthAction extends AbstractAction { if (UserAuthenticationFactory::getInstance()->getUserAuthentication()->supportsPersistentLogins()) { $password = StringUtil::getRandomID(); $userEditor = new UserEditor($user); - $userEditor->update(array('password' => $password)); + $userEditor->update(['password' => $password]); // reload user to retrieve salt $user = new User($user->userID); diff --git a/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php b/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php index e6faaee131..652278c210 100644 --- a/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php @@ -27,7 +27,7 @@ class GoogleAuthAction extends AbstractAction { /** * @see \wcf\action\AbstractAction::$neededModules */ - public $neededModules = array('GOOGLE_PUBLIC_KEY', 'GOOGLE_PRIVATE_KEY'); + public $neededModules = ['GOOGLE_PUBLIC_KEY', 'GOOGLE_PRIVATE_KEY']; /** * @see \wcf\action\IAction::execute() @@ -35,20 +35,20 @@ class GoogleAuthAction extends AbstractAction { public function execute() { parent::execute(); - $callbackURL = LinkHandler::getInstance()->getLink('GoogleAuth', array( + $callbackURL = LinkHandler::getInstance()->getLink('GoogleAuth', [ 'appendSession' => false - )); + ]); // user accepted the connection if (isset($_GET['code'])) { try { // fetch access_token - $request = new HTTPRequest('https://accounts.google.com/o/oauth2/token', array(), array( + $request = new HTTPRequest('https://accounts.google.com/o/oauth2/token', [], [ 'code' => $_GET['code'], 'client_id' => StringUtil::trim(GOOGLE_PUBLIC_KEY), 'client_secret' => StringUtil::trim(GOOGLE_PRIVATE_KEY), 'redirect_uri' => $callbackURL, 'grant_type' => 'authorization_code' - )); + ]); $request->execute(); $reply = $request->getReply(); @@ -96,7 +96,7 @@ class GoogleAuthAction extends AbstractAction { if (UserAuthenticationFactory::getInstance()->getUserAuthentication()->supportsPersistentLogins()) { $password = StringUtil::getRandomID(); $userEditor = new UserEditor($user); - $userEditor->update(array('password' => $password)); + $userEditor->update(['password' => $password]); // reload user to retrieve salt $user = new User($user->userID); diff --git a/wcfsetup/install/files/lib/action/GravatarDownloadAction.class.php b/wcfsetup/install/files/lib/action/GravatarDownloadAction.class.php index 2713f1170b..527d0cc162 100644 --- a/wcfsetup/install/files/lib/action/GravatarDownloadAction.class.php +++ b/wcfsetup/install/files/lib/action/GravatarDownloadAction.class.php @@ -106,9 +106,9 @@ class GravatarDownloadAction extends AbstractAction { // update file extension if ($fileExtension != $this->user->gravatarFileExtension) { $editor = new UserEditor($this->user); - $editor->update(array( + $editor->update([ 'gravatarFileExtension' => $fileExtension - )); + ]); } @header('Content-Type: '.$mimeType); @@ -118,9 +118,9 @@ class GravatarDownloadAction extends AbstractAction { catch (SystemException $e) { // disable gravatar $editor = new UserEditor($this->user); - $editor->update(array( + $editor->update([ 'enableGravatar' => 0 - )); + ]); } } diff --git a/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php b/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php index 0c9e976c4c..c77f2f8f07 100644 --- a/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php +++ b/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php @@ -30,13 +30,13 @@ class MessageQuoteAction extends AJAXProxyAction { * list of quote ids * @var string[] */ - public $quoteIDs = array(); + public $quoteIDs = []; /** * list of object types * @var string[] */ - public $objectTypes = array(); + public $objectTypes = []; /** * @see \wcf\action\IAction::readParameters() @@ -68,15 +68,15 @@ class MessageQuoteAction extends AJAXProxyAction { $returnValues = null; switch ($this->actionName) { case 'count': - $returnValues = array( + $returnValues = [ 'count' => $this->count() - ); + ]; break; case 'getQuotes': - $returnValues = array( + $returnValues = [ 'template' => $this->getQuotes() - ); + ]; break; case 'markForRemoval': @@ -84,15 +84,15 @@ class MessageQuoteAction extends AJAXProxyAction { break; case 'remove': - $returnValues = array( + $returnValues = [ 'count' => $this->remove() - ); + ]; break; case 'removeMarkedQuotes': - $returnValues = array( + $returnValues = [ 'count' => $this->removeMarkedQuotes() - ); + ]; break; default: diff --git a/wcfsetup/install/files/lib/action/NotificationConfirmAction.class.php b/wcfsetup/install/files/lib/action/NotificationConfirmAction.class.php index 446b894601..e538eca802 100644 --- a/wcfsetup/install/files/lib/action/NotificationConfirmAction.class.php +++ b/wcfsetup/install/files/lib/action/NotificationConfirmAction.class.php @@ -69,14 +69,14 @@ class NotificationConfirmAction extends AbstractAction { $event = new UserNotificationEvent($this->notification->eventID); $objectType = ObjectTypeCache::getInstance()->getObjectType($event->objectTypeID); - $objects = $objectType->getProcessor()->getObjectsByIDs(array($this->notification->objectID)); + $objects = $objectType->getProcessor()->getObjectsByIDs([$this->notification->objectID]); $userProfile = null; if ($this->notification->authorID) { $userProfile = new UserProfile(new User($this->notification->authorID)); } else { - $userProfile = new UserProfile(new User(null, array('userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')))); + $userProfile = new UserProfile(new User(null, ['userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')])); } $className = $event->className; diff --git a/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php b/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php index f7ed46508d..643740237a 100644 --- a/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php +++ b/wcfsetup/install/files/lib/action/NotificationDisableAction.class.php @@ -89,21 +89,21 @@ class NotificationDisableAction extends AbstractAction { WHERE userID = ? AND eventID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 'none', $this->userID, $this->eventID - )); + ]); } else { $sql = "UPDATE wcf".WCF_N."_user_notification_event_to_user SET mailNotificationType = ? WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 'none', $this->userID - )); + ]); } $this->executed(); diff --git a/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php b/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php index b2f06bbb42..37960691d0 100644 --- a/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php +++ b/wcfsetup/install/files/lib/action/PaypalCallbackAction.class.php @@ -35,7 +35,7 @@ class PaypalCallbackAction extends AbstractAction { $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; } - $request = new HTTPRequest($url, array(), array_merge(array('cmd' => '_notify-validate'), $_POST)); + $request = new HTTPRequest($url, [], array_merge(['cmd' => '_notify-validate'], $_POST)); $request->execute(); $reply = $request->getReply(); $content = $reply['body']; diff --git a/wcfsetup/install/files/lib/action/PollAction.class.php b/wcfsetup/install/files/lib/action/PollAction.class.php index 738f9e0556..405adcada6 100644 --- a/wcfsetup/install/files/lib/action/PollAction.class.php +++ b/wcfsetup/install/files/lib/action/PollAction.class.php @@ -30,7 +30,7 @@ class PollAction extends AJAXProxyAction { * list of option ids * @var integer[] */ - public $optionIDs = array(); + public $optionIDs = []; /** * poll object @@ -63,7 +63,7 @@ class PollAction extends AJAXProxyAction { if (isset($_POST['actionName'])) $this->actionName = StringUtil::trim($_POST['actionName']); if (isset($_POST['pollID'])) $this->pollID = intval($_POST['pollID']); - $polls = PollManager::getInstance()->getPolls(array($this->pollID)); + $polls = PollManager::getInstance()->getPolls([$this->pollID]); if (!isset($polls[$this->pollID])) { throw new UserInputException('pollID'); } @@ -106,7 +106,7 @@ class PollAction extends AJAXProxyAction { throw new PermissionDeniedException(); } - $optionIDs = array(); + $optionIDs = []; foreach ($this->poll->getOptions() as $option) { $optionIDs[] = $option->optionID; } @@ -125,10 +125,10 @@ class PollAction extends AJAXProxyAction { public function execute() { AbstractAction::execute(); - $returnValues = array( + $returnValues = [ 'actionName' => $this->actionName, 'pollID' => $this->pollID - ); + ]; switch ($this->actionName) { case 'getResult': @@ -158,9 +158,9 @@ class PollAction extends AJAXProxyAction { * @param array $returnValues */ public function getResult(array &$returnValues) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'poll' => $this->poll - )); + ]); $returnValues['resultTemplate'] = WCF::getTPL()->fetch('pollResult'); } @@ -171,9 +171,9 @@ class PollAction extends AJAXProxyAction { * @param array $returnValues */ public function getVote(array &$returnValues) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'poll' => $this->poll - )); + ]); $returnValues['voteTemplate'] = WCF::getTPL()->fetch('pollVote'); } @@ -184,11 +184,11 @@ class PollAction extends AJAXProxyAction { * @param mixed[] $returnValues */ protected function vote(array &$returnValues) { - $pollAction = new \wcf\data\poll\PollAction(array($this->poll), 'vote', array('optionIDs' => $this->optionIDs)); + $pollAction = new \wcf\data\poll\PollAction([$this->poll], 'vote', ['optionIDs' => $this->optionIDs]); $pollAction->executeAction(); // update poll object - $polls = PollManager::getInstance()->getPolls(array($this->pollID)); + $polls = PollManager::getInstance()->getPolls([$this->pollID]); $this->poll = $polls[$this->pollID]; if ($this->relatedObject !== null) { $this->poll->setRelatedObject($this->relatedObject); diff --git a/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php b/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php index 3e8fb5de56..a0ab9d1720 100644 --- a/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php @@ -26,7 +26,7 @@ class TwitterAuthAction extends AbstractAction { /** * @see \wcf\action\AbstractAction::$neededModules */ - public $neededModules = array('TWITTER_PUBLIC_KEY', 'TWITTER_PRIVATE_KEY'); + public $neededModules = ['TWITTER_PUBLIC_KEY', 'TWITTER_PRIVATE_KEY']; /** * @see \wcf\action\IAction::execute() @@ -46,22 +46,22 @@ class TwitterAuthAction extends AbstractAction { try { // fetch access_token - $oauthHeader = array( + $oauthHeader = [ 'oauth_consumer_key' => StringUtil::trim(TWITTER_PUBLIC_KEY), 'oauth_nonce' => StringUtil::getRandomID(), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => TIME_NOW, 'oauth_version' => '1.0', 'oauth_token' => $initData['oauth_token'] - ); - $postData = array( + ]; + $postData = [ 'oauth_verifier' => $_GET['oauth_verifier'] - ); + ]; $signature = $this->createSignature('https://api.twitter.com/oauth/access_token', array_merge($oauthHeader, $postData)); $oauthHeader['oauth_signature'] = $signature; - $request = new HTTPRequest('https://api.twitter.com/oauth/access_token', array(), $postData); + $request = new HTTPRequest('https://api.twitter.com/oauth/access_token', [], $postData); $request->addHeader('Authorization', 'OAuth '.$this->buildOAuthHeader($oauthHeader)); $request->execute(); $reply = $request->getReply(); @@ -88,7 +88,7 @@ class TwitterAuthAction extends AbstractAction { if (UserAuthenticationFactory::getInstance()->getUserAuthentication()->supportsPersistentLogins()) { $password = StringUtil::getRandomID(); $userEditor = new UserEditor($user); - $userEditor->update(array('password' => $password)); + $userEditor->update(['password' => $password]); // reload user to retrieve salt $user = new User($user->userID); @@ -149,22 +149,22 @@ class TwitterAuthAction extends AbstractAction { // start auth by fetching request_token try { - $callbackURL = LinkHandler::getInstance()->getLink('TwitterAuth', array( + $callbackURL = LinkHandler::getInstance()->getLink('TwitterAuth', [ 'appendSession' => false - )); - $oauthHeader = array( + ]); + $oauthHeader = [ 'oauth_callback' => $callbackURL, 'oauth_consumer_key' => StringUtil::trim(TWITTER_PUBLIC_KEY), 'oauth_nonce' => StringUtil::getRandomID(), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => TIME_NOW, 'oauth_version' => '1.0' - ); + ]; $signature = $this->createSignature('https://api.twitter.com/oauth/request_token', $oauthHeader); $oauthHeader['oauth_signature'] = $signature; // call api - $request = new HTTPRequest('https://api.twitter.com/oauth/request_token', array('method' => 'POST')); + $request = new HTTPRequest('https://api.twitter.com/oauth/request_token', ['method' => 'POST']); $request->addHeader('Authorization', 'OAuth '.$this->buildOAuthHeader($oauthHeader)); $request->execute(); $reply = $request->getReply(); @@ -213,7 +213,7 @@ class TwitterAuthAction extends AbstractAction { * @return string */ public function createSignature($url, array $parameters, $tokenSecret = '') { - $tmp = array(); + $tmp = []; foreach ($parameters as $key => $val) { $tmp[rawurlencode($key)] = rawurlencode($val); } diff --git a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php index 22459e0a1d..8791f0722f 100644 --- a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php +++ b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php @@ -37,49 +37,49 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID * list of object ids * @var integer[] */ - protected $objectIDs = array(); + protected $objectIDs = []; /** * list of object editors * @var DatabaseObjectEditor[] */ - protected $objects = array(); + protected $objects = []; /** * multi-dimensional array of parameters required by an action * @var mixed[][] */ - protected $parameters = array(); + protected $parameters = []; /** * list of permissions required to create objects * @var string[] */ - protected $permissionsCreate = array(); + protected $permissionsCreate = []; /** * list of permissions required to delete objects * @var string[] */ - protected $permissionsDelete = array(); + protected $permissionsDelete = []; /** * list of permissions required to update objects * @var string[] */ - protected $permissionsUpdate = array(); + protected $permissionsUpdate = []; /** * disallow requests for specified methods if the origin is not the ACP * @var string[] */ - protected $requireACP = array(); + protected $requireACP = []; /** * Resets cache if any of the listed actions is invoked * @var string[] */ - protected $resetCache = array('create', 'delete', 'toggle', 'update', 'updatePosition'); + protected $resetCache = ['create', 'delete', 'toggle', 'update', 'updatePosition']; /** * values returned by executed action @@ -92,7 +92,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID * is completely disabled * @var string[] */ - protected $allowGuestAccess = array(); + protected $allowGuestAccess = []; const TYPE_INTEGER = 1; const TYPE_STRING = 2; @@ -110,7 +110,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID * @param array $parameters * @throws SystemException */ - public function __construct(array $objects, $action, array $parameters = array()) { + public function __construct(array $objects, $action, array $parameters = []) { // set class name if (empty($this->className)) { $className = get_called_class(); @@ -120,8 +120,8 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID } } - $indexName = call_user_func(array($this->className, 'getDatabaseTableIndexName')); - $baseClass = call_user_func(array($this->className, 'getBaseClass')); + $indexName = call_user_func([$this->className, 'getDatabaseTableIndexName']); + $baseClass = call_user_func([$this->className, 'getBaseClass']); foreach ($objects as $object) { if (is_object($object)) { @@ -182,7 +182,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID } // execute action - call_user_func_array(array($this, $actionName), $this->getParameters()); + call_user_func_array([$this, $actionName], $this->getParameters()); // fire event action EventHandler::getInstance()->fireAction($this, 'validateAction'); @@ -197,7 +197,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID throw new SystemException("call to undefined function '".$this->getActionName()."'"); } - $this->returnValues = call_user_func(array($this, $this->getActionName())); + $this->returnValues = call_user_func([$this, $this->getActionName()]); // reset cache if (in_array($this->getActionName(), $this->resetCache)) { @@ -215,7 +215,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID */ protected function resetCache() { if (is_subclass_of($this->className, 'wcf\data\IEditableCachedObject')) { - call_user_func(array($this->className, 'resetCache')); + call_user_func([$this->className, 'resetCache']); } } @@ -242,7 +242,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID $this->objects = $objects; // update object IDs - $this->objectIDs = array(); + $this->objectIDs = []; foreach ($this->objects as $object) { $this->objectIDs[] = $object->getObjectID(); } @@ -259,11 +259,11 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID * @see \wcf\data\IDatabaseObjectAction::getReturnValues() */ public function getReturnValues() { - return array( + return [ 'actionName' => $this->action, 'objectIDs' => $this->getObjectIDs(), 'returnValues' => $this->returnValues - ); + ]; } /** @@ -329,7 +329,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID * @return \wcf\data\DatabaseObject */ public function create() { - return call_user_func(array($this->className, 'create'), $this->parameters['data']); + return call_user_func([$this->className, 'create'], $this->parameters['data']); } /** @@ -341,13 +341,13 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID } // get ids - $objectIDs = array(); + $objectIDs = []; foreach ($this->objects as $object) { $objectIDs[] = $object->getObjectID(); } // execute action - return call_user_func(array($this->className, 'deleteAll'), $objectIDs); + return call_user_func([$this->className, 'deleteAll'], $objectIDs); } /** @@ -380,11 +380,11 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID } // get base class - $baseClass = call_user_func(array($this->className, 'getBaseClass')); + $baseClass = call_user_func([$this->className, 'getBaseClass']); // get db information - $tableName = call_user_func(array($this->className, 'getDatabaseTableName')); - $indexName = call_user_func(array($this->className, 'getDatabaseTableIndexName')); + $tableName = call_user_func([$this->className, 'getDatabaseTableName']); + $indexName = call_user_func([$this->className, 'getDatabaseTableIndexName']); // get objects $sql = "SELECT * @@ -513,7 +513,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID case self::TYPE_INTEGER: if (!isset($target[$variableName])) { if ($allowEmpty) { - $target[$variableName] = ($structure === self::STRUCT_FLAT) ? 0 : array(); + $target[$variableName] = ($structure === self::STRUCT_FLAT) ? 0 : []; } else { throw new UserInputException($variableName); @@ -544,7 +544,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID case self::TYPE_STRING: if (!isset($target[$variableName])) { if ($allowEmpty) { - $target[$variableName] = ($structure === self::STRUCT_FLAT) ? '' : array(); + $target[$variableName] = ($structure === self::STRUCT_FLAT) ? '' : []; } else { throw new UserInputException($variableName); @@ -594,7 +594,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID case self::TYPE_JSON: if (!isset($target[$variableName])) { if ($allowEmpty) { - $target[$variableName] = array(); + $target[$variableName] = []; } else { throw new UserInputException($variableName); diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectDecorator.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectDecorator.class.php index 4dbeb3d60f..55c815d6d3 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectDecorator.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectDecorator.class.php @@ -84,35 +84,35 @@ abstract class DatabaseObjectDecorator extends DatabaseObject { throw new SystemException("unknown method '".$name."'"); } - return call_user_func_array(array($this->object, $name), $arguments); + return call_user_func_array([$this->object, $name], $arguments); } /** * @see \wcf\data\IStorableObject::getDatabaseTableAlias() */ public static function getDatabaseTableAlias() { - return call_user_func(array(static::$baseClass, 'getDatabaseTableAlias')); + return call_user_func([static::$baseClass, 'getDatabaseTableAlias']); } /** * @see \wcf\data\IStorableObject::getDatabaseTableName() */ public static function getDatabaseTableName() { - return call_user_func(array(static::$baseClass, 'getDatabaseTableName')); + return call_user_func([static::$baseClass, 'getDatabaseTableName']); } /** * @see \wcf\data\IStorableObject::getDatabaseTableIndexIsIdentity() */ public static function getDatabaseTableIndexIsIdentity() { - return call_user_func(array(static::$baseClass, 'getDatabaseTableIndexIsIdentity')); + return call_user_func([static::$baseClass, 'getDatabaseTableIndexIsIdentity']); } /** * @see \wcf\data\IStorableObject::getDatabaseTableIndexName() */ public static function getDatabaseTableIndexName() { - return call_user_func(array(static::$baseClass, 'getDatabaseTableIndexName')); + return call_user_func([static::$baseClass, 'getDatabaseTableIndexName']); } /** diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php index f63463f22b..af9555561c 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php @@ -16,9 +16,9 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I /** * @see \wcf\data\IEditableObject::create() */ - public static function create(array $parameters = array()) { + public static function create(array $parameters = []) { $keys = $values = ''; - $statementParameters = array(); + $statementParameters = []; foreach ($parameters as $key => $value) { if (!empty($keys)) { $keys .= ','; @@ -50,11 +50,11 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I /** * @see \wcf\data\IEditableObject::update() */ - public function update(array $parameters = array()) { + public function update(array $parameters = []) { if (empty($parameters)) return; $updateSQL = ''; - $statementParameters = array(); + $statementParameters = []; foreach ($parameters as $key => $value) { if (!empty($updateSQL)) $updateSQL .= ', '; $updateSQL .= $key . ' = ?'; @@ -72,11 +72,11 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I /** * @see \wcf\data\IEditableObject::updateCounters() */ - public function updateCounters(array $counters = array()) { + public function updateCounters(array $counters = []) { if (empty($counters)) return; $updateSQL = ''; - $statementParameters = array(); + $statementParameters = []; foreach ($counters as $key => $value) { if (!empty($updateSQL)) $updateSQL .= ', '; $updateSQL .= $key . ' = ' . $key . ' + ?'; @@ -95,13 +95,13 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I * @see \wcf\data\IEditableObject::delete() */ public function delete() { - static::deleteAll(array($this->getObjectID())); + static::deleteAll([$this->getObjectID()]); } /** * @see \wcf\data\IEditableObject::deleteAll() */ - public static function deleteAll(array $objectIDs = array()) { + public static function deleteAll(array $objectIDs = []) { $sql = "DELETE FROM ".static::getDatabaseTableName()." WHERE ".static::getDatabaseTableIndexName()." = ?"; $statement = WCF::getDB()->prepareStatement($sql); @@ -109,7 +109,7 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I $affectedCount = 0; WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { - $statement->execute(array($objectID)); + $statement->execute([$objectID]); $affectedCount += $statement->getAffectedRows(); } WCF::getDB()->commitTransaction(); diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php index 2a0b7f5d42..f18e507707 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php @@ -38,7 +38,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { * result objects * @var DatabaseObject[] */ - public $objects = array(); + public $objects = []; /** * ids of result objects @@ -126,7 +126,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { } $objectClassName = $this->objectClassName ?: $this->className; - $baseClassName = call_user_func(array($this->decoratorClassName, 'getBaseClass')); + $baseClassName = call_user_func([$this->decoratorClassName, 'getBaseClass']); if ($objectClassName != $baseClassName && !is_subclass_of($baseClassName, $objectClassName)) { throw new SystemException("'".$this->decoratorClassName."' can't decorate objects of class '".$objectClassName."'"); } @@ -157,7 +157,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { * Reads the object ids from database. */ public function readObjectIDs() { - $this->objectIDs = array(); + $this->objectIDs = []; $sql = "SELECT ".$this->getDatabaseTableAlias().".".$this->getDatabaseTableIndexName()." AS objectID FROM ".$this->getDatabaseTableName()." ".$this->getDatabaseTableAlias()." ".$this->sqlConditionJoins." @@ -207,7 +207,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { } // use table index as array index - $objects = array(); + $objects = []; foreach ($this->objects as $object) { $objectID = $object->getObjectID(); $objects[$objectID] = $object; @@ -260,7 +260,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { * @return string */ public function getDatabaseTableName() { - return call_user_func(array($this->className, 'getDatabaseTableName')); + return call_user_func([$this->className, 'getDatabaseTableName']); } /** @@ -269,7 +269,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { * @return string */ public function getDatabaseTableIndexName() { - return call_user_func(array($this->className, 'getDatabaseTableIndexName')); + return call_user_func([$this->className, 'getDatabaseTableIndexName']); } /** @@ -278,7 +278,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject { * @return string */ public function getDatabaseTableAlias() { - return call_user_func(array($this->className, 'getDatabaseTableAlias')); + return call_user_func([$this->className, 'getDatabaseTableAlias']); } /** diff --git a/wcfsetup/install/files/lib/data/IEditableObject.class.php b/wcfsetup/install/files/lib/data/IEditableObject.class.php index b7b43bf50a..0b5ad8644e 100644 --- a/wcfsetup/install/files/lib/data/IEditableObject.class.php +++ b/wcfsetup/install/files/lib/data/IEditableObject.class.php @@ -18,21 +18,21 @@ interface IEditableObject extends IStorableObject { * @param array $parameters * @return \wcf\data\IStorableObject */ - public static function create(array $parameters = array()); + public static function create(array $parameters = []); /** * Updates this object. * * @param array $parameters */ - public function update(array $parameters = array()); + public function update(array $parameters = []); /** * Updates the counters of this object. * * @param array $counters */ - public function updateCounters(array $counters = array()); + public function updateCounters(array $counters = []); /** * Deletes this object. @@ -46,5 +46,5 @@ interface IEditableObject extends IStorableObject { * @param array $objectIDs * @return integer */ - public static function deleteAll(array $objectIDs = array()); + public static function deleteAll(array $objectIDs = []); } diff --git a/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php b/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php index 5d00d6b727..29d264ae72 100644 --- a/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php +++ b/wcfsetup/install/files/lib/data/ProcessibleDatabaseObject.class.php @@ -42,7 +42,7 @@ class ProcessibleDatabaseObject extends DatabaseObject { } if (is_subclass_of($this->className, 'wcf\system\SingletonFactory')) { - $this->processor = call_user_func(array($this->className, 'getInstance')); + $this->processor = call_user_func([$this->className, 'getInstance']); } else { if (!is_subclass_of($this->className, 'wcf\data\IDatabaseObjectProcessor')) { diff --git a/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php b/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php index 476f22ff2d..897a25f235 100644 --- a/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php +++ b/wcfsetup/install/files/lib/data/TMultiCategoryObject.class.php @@ -33,7 +33,7 @@ trait TMultiCategoryObject { * ids of the object's categories * @var integer[] */ - protected $categoryIDs = array(); + protected $categoryIDs = []; /** * list of the object's leaf categories @@ -58,7 +58,7 @@ trait TMultiCategoryObject { */ public function getCategories() { if ($this->categories === null) { - $this->categories = array(); + $this->categories = []; $className = static::getCategoryClassName(); if (!is_subclass_of($className, AbstractDecoratedCategory::class)) { @@ -80,7 +80,7 @@ trait TMultiCategoryObject { ) ORDER BY parentCategoryID, showOrder"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectID())); + $statement->execute([$this->getObjectID()]); while ($categoryID = $statement->fetchColumn()) { $this->categories[$categoryID] = $className::getCategory($categoryID); } diff --git a/wcfsetup/install/files/lib/data/acl/option/ACLOption.class.php b/wcfsetup/install/files/lib/data/acl/option/ACLOption.class.php index 3ecec50e2c..35b40ea7ec 100644 --- a/wcfsetup/install/files/lib/data/acl/option/ACLOption.class.php +++ b/wcfsetup/install/files/lib/data/acl/option/ACLOption.class.php @@ -37,7 +37,7 @@ class ACLOption extends DatabaseObject { */ public static function getOptions($objectTypeID) { $optionList = new ACLOptionList(); - $optionList->getConditionBuilder()->add("acl_option.objectTypeID = ?", array($objectTypeID)); + $optionList->getConditionBuilder()->add("acl_option.objectTypeID = ?", [$objectTypeID]); $optionList->readObjects(); return $optionList; diff --git a/wcfsetup/install/files/lib/data/acl/option/ACLOptionAction.class.php b/wcfsetup/install/files/lib/data/acl/option/ACLOptionAction.class.php index da5ced6b61..77d8f5169f 100644 --- a/wcfsetup/install/files/lib/data/acl/option/ACLOptionAction.class.php +++ b/wcfsetup/install/files/lib/data/acl/option/ACLOptionAction.class.php @@ -22,7 +22,7 @@ class ACLOptionAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('loadAll'); + protected $requireACP = ['loadAll']; /** * Validates parameters for ACL options. @@ -39,7 +39,7 @@ class ACLOptionAction extends AbstractDatabaseObjectAction { * @return array */ public function loadAll() { - $objectIDs = ($this->parameters['objectID']) ? array($this->parameters['objectID']) : array(); + $objectIDs = ($this->parameters['objectID']) ? [$this->parameters['objectID']] : []; $permissions = ACLHandler::getInstance()->getPermissions($this->parameters['objectTypeID'], $objectIDs, $this->parameters['categoryName'], true); return $permissions; diff --git a/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItem.class.php b/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItem.class.php index ab314ad8c1..cfdaa0019e 100644 --- a/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItem.class.php +++ b/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItem.class.php @@ -61,9 +61,9 @@ class ACPMenuItem extends DatabaseObject implements ITreeMenuItem { $this->parseController(); - $linkParameters = array( + $linkParameters = [ 'application' => $this->application - ); + ]; // links of top option category menu items need the id of the option // category diff --git a/wcfsetup/install/files/lib/data/acp/search/provider/ACPSearchProviderAction.class.php b/wcfsetup/install/files/lib/data/acp/search/provider/ACPSearchProviderAction.class.php index c08e264a40..3ec1421289 100644 --- a/wcfsetup/install/files/lib/data/acp/search/provider/ACPSearchProviderAction.class.php +++ b/wcfsetup/install/files/lib/data/acp/search/provider/ACPSearchProviderAction.class.php @@ -18,7 +18,7 @@ class ACPSearchProviderAction extends AbstractDatabaseObjectAction implements IS /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('getSearchResultList'); + protected $requireACP = ['getSearchResultList']; /** * @see \wcf\data\ISearchAction::validateGetSearchResultList() @@ -31,17 +31,17 @@ class ACPSearchProviderAction extends AbstractDatabaseObjectAction implements IS * @see \wcf\data\ISearchAction::getSearchResultList() */ public function getSearchResultList() { - $data = array(); + $data = []; $results = ACPSearchHandler::getInstance()->search($this->parameters['data']['searchString']); foreach ($results as $resultList) { - $items = array(); + $items = []; foreach ($resultList as $item) { - $items[] = array( + $items[] = [ 'link' => $item->getLink(), 'subtitle' => $item->getSubtitle(), 'title' => $item->getTitle() - ); + ]; } foreach ($items as $key => &$item) { @@ -59,10 +59,10 @@ class ACPSearchProviderAction extends AbstractDatabaseObjectAction implements IS } unset($item); - $data[] = array( + $data[] = [ 'items' => $items, 'title' => $resultList->getTitle() - ); + ]; } return $data; diff --git a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php index c5d318c8a5..dde485fc12 100644 --- a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php @@ -51,11 +51,11 @@ class ACPSessionVirtual extends DatabaseObject { AND ipAddress = ? AND userAgent = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $sessionID, UserUtil::getIpAddress(), UserUtil::getUserAgent() - )); + ]); return $statement->fetchObject(static::class); } @@ -71,7 +71,7 @@ class ACPSessionVirtual extends DatabaseObject { FROM ".static::getDatabaseTableName()." WHERE sessionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($sessionID)); + $statement->execute([$sessionID]); return $statement->fetchColumn(); } diff --git a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php index 9d106c9648..3e8dae04de 100644 --- a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php @@ -27,8 +27,8 @@ class ACPSessionVirtualAction extends AbstractDatabaseObjectAction { */ public function create() { // try to find an existing virtual session - $baseClass = call_user_func(array($this->className, 'getBaseClass')); - $virtualSession = call_user_func(array($baseClass, 'getExistingSession'), $this->parameters['data']['sessionID']); + $baseClass = call_user_func([$this->className, 'getBaseClass']); + $virtualSession = call_user_func([$baseClass, 'getExistingSession'], $this->parameters['data']['sessionID']); if ($virtualSession !== null) { return $virtualSession; } diff --git a/wcfsetup/install/files/lib/data/acp/template/ACPTemplateAction.class.php b/wcfsetup/install/files/lib/data/acp/template/ACPTemplateAction.class.php index c144fe7299..cf4af8c21d 100644 --- a/wcfsetup/install/files/lib/data/acp/template/ACPTemplateAction.class.php +++ b/wcfsetup/install/files/lib/data/acp/template/ACPTemplateAction.class.php @@ -21,20 +21,20 @@ class ACPTemplateAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.template.canAddTemplate'); + protected $permissionsCreate = ['admin.template.canAddTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.template.canDeleteTemplate'); + protected $permissionsDelete = ['admin.template.canDeleteTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.template.canUpdateTemplate'); + protected $permissionsUpdate = ['admin.template.canUpdateTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; } diff --git a/wcfsetup/install/files/lib/data/ad/AdAction.class.php b/wcfsetup/install/files/lib/data/ad/AdAction.class.php index 0f33a5158a..c1e880b59f 100644 --- a/wcfsetup/install/files/lib/data/ad/AdAction.class.php +++ b/wcfsetup/install/files/lib/data/ad/AdAction.class.php @@ -21,17 +21,17 @@ class AdAction extends AbstractDatabaseObjectAction implements ISortableAction, /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.ad.canManageAd'); + protected $permissionsDelete = ['admin.ad.canManageAd']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.ad.canManageAd'); + protected $permissionsUpdate = ['admin.ad.canManageAd']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update', 'updatePosition'); + protected $requireACP = ['create', 'delete', 'toggle', 'update', 'updatePosition']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -64,9 +64,9 @@ class AdAction extends AbstractDatabaseObjectAction implements ISortableAction, */ public function toggle() { foreach ($this->objects as $ad) { - $ad->update(array( + $ad->update([ 'isDisabled' => $ad->isDisabled ? 0 : 1 - )); + ]); } } @@ -119,10 +119,10 @@ class AdAction extends AbstractDatabaseObjectAction implements ISortableAction, $showOrder = $this->parameters['data']['offset']; WCF::getDB()->beginTransaction(); foreach ($this->parameters['data']['structure'][0] as $adID) { - $statement->execute(array( + $statement->execute([ $showOrder++, $adID - )); + ]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/data/ad/AdEditor.class.php b/wcfsetup/install/files/lib/data/ad/AdEditor.class.php index f6699b0f8b..cce212baa5 100644 --- a/wcfsetup/install/files/lib/data/ad/AdEditor.class.php +++ b/wcfsetup/install/files/lib/data/ad/AdEditor.class.php @@ -50,16 +50,16 @@ class AdEditor extends DatabaseObjectEditor implements IEditableCachedObject { SET showOrder = showOrder + 1 WHERE showOrder >= ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $showOrder - )); + ]); $newShowOrder = $showOrder; } - $this->update(array( + $this->update([ 'showOrder' => $newShowOrder - )); + ]); } /** @@ -67,8 +67,8 @@ class AdEditor extends DatabaseObjectEditor implements IEditableCachedObject { */ public static function resetCache() { AdCacheBuilder::getInstance()->reset(); - ConditionCacheBuilder::getInstance()->reset(array( + ConditionCacheBuilder::getInstance()->reset([ 'definitionID' => ObjectTypeCache::getInstance()->getDefinitionByName('com.woltlab.wcf.condition.ad')->definitionID - )); + ]); } } diff --git a/wcfsetup/install/files/lib/data/application/Application.class.php b/wcfsetup/install/files/lib/data/application/Application.class.php index 3acbd8d475..d534d98d75 100644 --- a/wcfsetup/install/files/lib/data/application/Application.class.php +++ b/wcfsetup/install/files/lib/data/application/Application.class.php @@ -103,11 +103,11 @@ class Application extends DatabaseObject { */ public static function getDirectory($abbreviation) { if (static::$directories === null) { - static::$directories = array(); + static::$directories = []; // read application directories $packageList = new PackageList(); - $packageList->getConditionBuilder()->add('package.isApplication = ?', array(1)); + $packageList->getConditionBuilder()->add('package.isApplication = ?', [1]); $packageList->readObjects(); foreach ($packageList as $package) { $abbr = Package::getAbbreviation($package->package); diff --git a/wcfsetup/install/files/lib/data/attachment/GroupedAttachmentList.class.php b/wcfsetup/install/files/lib/data/attachment/GroupedAttachmentList.class.php index 5b47102e2c..d59052cc40 100644 --- a/wcfsetup/install/files/lib/data/attachment/GroupedAttachmentList.class.php +++ b/wcfsetup/install/files/lib/data/attachment/GroupedAttachmentList.class.php @@ -17,7 +17,7 @@ class GroupedAttachmentList extends AttachmentList { * grouped objects * @var array */ - public $groupedObjects = array(); + public $groupedObjects = []; /** * object type @@ -44,12 +44,12 @@ class GroupedAttachmentList extends AttachmentList { parent::__construct(); $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', $objectType); - $this->getConditionBuilder()->add('attachment.objectTypeID = ?', array($this->objectType->objectTypeID)); + $this->getConditionBuilder()->add('attachment.objectTypeID = ?', [$this->objectType->objectTypeID]); - $this->getConditionBuilder()->add('(SELECT embeddedObjectID FROM wcf'.WCF_N.'_message_embedded_object WHERE messageObjectTypeID = ? AND messageID = attachment.objectID AND embeddedObjectTypeID = ? AND embeddedObjectID = attachment.attachmentID) IS NULL', array( + $this->getConditionBuilder()->add('(SELECT embeddedObjectID FROM wcf'.WCF_N.'_message_embedded_object WHERE messageObjectTypeID = ? AND messageID = attachment.objectID AND embeddedObjectTypeID = ? AND embeddedObjectID = attachment.attachmentID) IS NULL', [ ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $objectType), ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message.embeddedObject', 'com.woltlab.wcf.attachment') - )); + ]); } /** @@ -61,7 +61,7 @@ class GroupedAttachmentList extends AttachmentList { // group by object id foreach ($this->objects as $attachmentID => $attachment) { if (!isset($this->groupedObjects[$attachment->objectID])) { - $this->groupedObjects[$attachment->objectID] = array(); + $this->groupedObjects[$attachment->objectID] = []; } $this->groupedObjects[$attachment->objectID][$attachmentID] = $attachment; @@ -89,6 +89,6 @@ class GroupedAttachmentList extends AttachmentList { return $this->groupedObjects[$objectID]; } - return array(); + return []; } } diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php index 3b9a61d1a3..8229d450b7 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCode.class.php @@ -77,9 +77,9 @@ class BBCode extends ProcessibleDatabaseObject implements IRouteController { FROM wcf".WCF_N."_bbcode WHERE bbcodeTag = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($tag)); + $statement->execute([$tag]); $row = $statement->fetchArray(); - if (!$row) $row = array(); + if (!$row) $row = []; return new self(null, $row); } diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php index 1c304cd84e..ebbecaaf32 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCodeAction.class.php @@ -27,17 +27,17 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.content.bbcode.canManageBBCode'); + protected $permissionsDelete = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.content.bbcode.canManageBBCode'); + protected $permissionsUpdate = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('delete', 'toggle', 'update'); + protected $requireACP = ['delete', 'toggle', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -50,14 +50,14 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction FROM wcf".WCF_N."_user_group_option WHERE optionType = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array('BBCodeSelect')); + $statement->execute(['BBCodeSelect']); $optionIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($optionIDs)) { $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add("optionID IN (?)", array($optionIDs)); - $conditionBuilder->add("groupID IN (?)", array(UserGroup::getGroupIDsByType(array(UserGroup::EVERYONE)))); - $conditionBuilder->add("optionValue <> ?", array('all')); + $conditionBuilder->add("optionID IN (?)", [$optionIDs]); + $conditionBuilder->add("groupID IN (?)", [UserGroup::getGroupIDsByType([UserGroup::EVERYONE])]); + $conditionBuilder->add("optionValue <> ?", ['all']); $sql = "SELECT * FROM wcf".WCF_N."_user_group_option_value @@ -80,11 +80,11 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction $row['optionValue'] = $bbCode->bbcodeTag; } - $updateStatement->execute(array( + $updateStatement->execute([ $row['optionValue'], $row['optionID'], $row['groupID'] - )); + ]); } WCF::getDB()->commitTransaction(); @@ -120,9 +120,9 @@ class BBCodeAction extends AbstractDatabaseObjectAction implements IToggleAction */ public function toggle() { foreach ($this->objects as $bbcode) { - $bbcode->update(array( + $bbcode->update([ 'isDisabled' => $bbcode->isDisabled ? 0 : 1 - )); + ]); } } } diff --git a/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php b/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php index 16a9a26c80..76acee8718 100644 --- a/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/BBCodeCache.class.php @@ -19,20 +19,20 @@ class BBCodeCache extends SingletonFactory { * cached bbcodes * @var BBCode[] */ - protected $cachedBBCodes = array(); + protected $cachedBBCodes = []; /** * list of known highlighters * @var string[] */ - protected $highlighters = array(); + protected $highlighters = []; /** * @see \wcf\system\SingletonFactory::init() */ protected function init() { // get bbcode cache - $this->cachedBBCodes = BBCodeCacheBuilder::getInstance()->getData(array(), 'bbcodes'); + $this->cachedBBCodes = BBCodeCacheBuilder::getInstance()->getData([], 'bbcodes'); } /** @@ -75,7 +75,7 @@ class BBCodeCache extends SingletonFactory { */ public function getHighlighters() { if (empty($this->highlighters)) { - $this->highlighters = BBCodeCacheBuilder::getInstance()->getData(array(), 'highlighters'); + $this->highlighters = BBCodeCacheBuilder::getInstance()->getData([], 'highlighters'); } return $this->highlighters; diff --git a/wcfsetup/install/files/lib/data/bbcode/MessagePreviewAction.class.php b/wcfsetup/install/files/lib/data/bbcode/MessagePreviewAction.class.php index 5bd506b68e..70abc1eebe 100644 --- a/wcfsetup/install/files/lib/data/bbcode/MessagePreviewAction.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/MessagePreviewAction.class.php @@ -22,7 +22,7 @@ class MessagePreviewAction extends BBCodeAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getMessagePreview'); + protected $allowGuestAccess = ['getMessagePreview']; /** * Validates parameters for message preview. @@ -61,9 +61,9 @@ class MessagePreviewAction extends BBCodeAction { if ($enableBBCodes && $allowedBBCodesPermission) { $disallowedBBCodes = MessageParser::getInstance()->validateBBCodes($this->parameters['data']['message'], ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($allowedBBCodesPermission)))); if (!empty($disallowedBBCodes)) { - throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', array( + throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', [ 'disallowedBBCodes' => $disallowedBBCodes - ))); + ])); } } @@ -86,8 +86,8 @@ class MessagePreviewAction extends BBCodeAction { // parse message $preview = MessageParser::getInstance()->parse($message, $enableSmilies, $enableHtml, $enableBBCodes, false); - return array( + return [ 'message' => $preview - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/bbcode/attribute/BBCodeAttribute.class.php b/wcfsetup/install/files/lib/data/bbcode/attribute/BBCodeAttribute.class.php index dcb1328fd6..2d97995956 100644 --- a/wcfsetup/install/files/lib/data/bbcode/attribute/BBCodeAttribute.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/attribute/BBCodeAttribute.class.php @@ -41,7 +41,7 @@ class BBCodeAttribute extends DatabaseObject { public static function getAttributesByBBCode(BBCode $bbcode) { $attributeList = new BBCodeAttributeList(); $attributeList->sqlOrderBy = "bbcode_attribute.attributeNo ASC"; - $attributeList->getConditionBuilder()->add('bbcode_attribute.bbcodeID = ?', array($bbcode->bbcodeID)); + $attributeList->getConditionBuilder()->add('bbcode_attribute.bbcodeID = ?', [$bbcode->bbcodeID]); $attributeList->readObjects(); return $attributeList->getObjects(); } diff --git a/wcfsetup/install/files/lib/data/bbcode/media/provider/BBCodeMediaProviderAction.class.php b/wcfsetup/install/files/lib/data/bbcode/media/provider/BBCodeMediaProviderAction.class.php index ed1a54e022..b5359f6be6 100644 --- a/wcfsetup/install/files/lib/data/bbcode/media/provider/BBCodeMediaProviderAction.class.php +++ b/wcfsetup/install/files/lib/data/bbcode/media/provider/BBCodeMediaProviderAction.class.php @@ -21,15 +21,15 @@ class BBCodeMediaProviderAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.content.bbcode.canManageBBCode'); + protected $permissionsDelete = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.content.bbcode.canManageBBCode'); + protected $permissionsUpdate = ['admin.content.bbcode.canManageBBCode']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('delete', 'update'); + protected $requireACP = ['delete', 'update']; } diff --git a/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php b/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php index cf9dad0eb6..0317a06376 100644 --- a/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php +++ b/wcfsetup/install/files/lib/data/captcha/question/CaptchaQuestionAction.class.php @@ -17,21 +17,21 @@ class CaptchaQuestionAction extends AbstractDatabaseObjectAction implements ITog /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.captcha.canManageCaptchaQuestion'); + protected $permissionsDelete = ['admin.captcha.canManageCaptchaQuestion']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.captcha.canManageCaptchaQuestion'); + protected $permissionsUpdate = ['admin.captcha.canManageCaptchaQuestion']; /** * @see \wcf\data\IToggleAction::toggle() */ public function toggle() { foreach ($this->objects as $question) { - $question->update(array( + $question->update([ 'isDisabled' => $question->isDisabled ? 0 : 1 - )); + ]); } } diff --git a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php index c3a8993735..ba3e56cb7d 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php @@ -31,7 +31,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update', 'updatePosition'); + protected $requireACP = ['create', 'delete', 'toggle', 'update', 'updatePosition']; /** * @see \wcf\data\AbstractDatabaseObjectAction::delete() @@ -52,9 +52,9 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc */ public function toggle() { foreach ($this->objects as $categoryEditor) { - $categoryEditor->update(array( + $categoryEditor->update([ 'isDisabled' => 1 - $categoryEditor->isDisabled - )); + ]); } } @@ -94,7 +94,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc if (isset($this->parameters['data']['parentCategoryID'])) { $objectType = null; - $parentUpdates = array(); + $parentUpdates = []; foreach ($this->objects as $category) { if ($objectType === null) { @@ -102,10 +102,10 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc } if ($category->parentCategoryID != $this->parameters['data']['parentCategoryID']) { - $parentUpdates[$category->categoryID] = array( + $parentUpdates[$category->categoryID] = [ 'oldParentCategoryID' => $category->parentCategoryID, 'newParentCategoryID' => $this->parameters['data']['parentCategoryID'] - ); + ]; } } @@ -120,7 +120,7 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc */ public function updatePosition() { $objectType = null; - $parentUpdates = array(); + $parentUpdates = []; WCF::getDB()->beginTransaction(); foreach ($this->parameters['data']['structure'] as $parentCategoryID => $categoryIDs) { @@ -132,16 +132,16 @@ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAc } if ($category->parentCategoryID != $parentCategoryID) { - $parentUpdates[$categoryID] = array( + $parentUpdates[$categoryID] = [ 'oldParentCategoryID' => $category->parentCategoryID, 'newParentCategoryID' => $parentCategoryID - ); + ]; } - $this->objects[$categoryID]->update(array( + $this->objects[$categoryID]->update([ 'parentCategoryID' => $parentCategoryID ? $this->objects[$parentCategoryID]->categoryID : 0, 'showOrder' => $showOrder++ - )); + ]); } } WCF::getDB()->commitTransaction(); diff --git a/wcfsetup/install/files/lib/data/category/CategoryNode.class.php b/wcfsetup/install/files/lib/data/category/CategoryNode.class.php index c206dc78f9..9b0fd2afac 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryNode.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryNode.class.php @@ -20,7 +20,7 @@ class CategoryNode extends DatabaseObjectDecorator implements \RecursiveIterator * child category nodes * @var CategoryNode[] */ - protected $children = array(); + protected $children = []; /** * current iterator key diff --git a/wcfsetup/install/files/lib/data/category/UncachedCategoryNodeTree.class.php b/wcfsetup/install/files/lib/data/category/UncachedCategoryNodeTree.class.php index b53fca2f15..272eb9c422 100644 --- a/wcfsetup/install/files/lib/data/category/UncachedCategoryNodeTree.class.php +++ b/wcfsetup/install/files/lib/data/category/UncachedCategoryNodeTree.class.php @@ -17,25 +17,25 @@ class UncachedCategoryNodeTree extends CategoryNodeTree { * locally cached categories * @var Category[] */ - protected $categoryCache = array(); + protected $categoryCache = []; /** * locally cached category ids grouped by the id of their parent category * @var array */ - protected $categoryStructureCache = array(); + protected $categoryStructureCache = []; /** * @see \wcf\data\category\CategoryNodeTree::buildTree() */ protected function buildTree() { $categoryList = new CategoryList(); - $categoryList->getConditionBuilder()->add('category.objectTypeID = ?', array(CategoryHandler::getInstance()->getObjectTypeByName($this->objectType)->objectTypeID)); + $categoryList->getConditionBuilder()->add('category.objectTypeID = ?', [CategoryHandler::getInstance()->getObjectTypeByName($this->objectType)->objectTypeID]); $categoryList->sqlOrderBy = "category.showOrder ASC"; $categoryList->readObjects(); foreach ($categoryList as $category) { if (!isset($this->categoryStructureCache[$category->parentCategoryID])) { - $this->categoryStructureCache[$category->parentCategoryID] = array(); + $this->categoryStructureCache[$category->parentCategoryID] = []; } $this->categoryStructureCache[$category->parentCategoryID][] = $category->categoryID; @@ -56,7 +56,7 @@ class UncachedCategoryNodeTree extends CategoryNodeTree { * @see \wcf\data\category\CategoryNodeTree::getChildCategories() */ protected function getChildCategories(CategoryNode $parentNode) { - $categories = array(); + $categories = []; if (isset($this->categoryStructureCache[$parentNode->categoryID])) { foreach ($this->categoryStructureCache[$parentNode->categoryID] as $categoryID) { $categories[$categoryID] = $this->getCategory($categoryID); diff --git a/wcfsetup/install/files/lib/data/clipboard/item/ClipboardItemAction.class.php b/wcfsetup/install/files/lib/data/clipboard/item/ClipboardItemAction.class.php index 5decb765ba..61fa3287b6 100644 --- a/wcfsetup/install/files/lib/data/clipboard/item/ClipboardItemAction.class.php +++ b/wcfsetup/install/files/lib/data/clipboard/item/ClipboardItemAction.class.php @@ -30,7 +30,7 @@ class ClipboardItemAction extends AbstractDatabaseObjectAction { * * @see \wcf\data\AbstractDatabaseObjectAction */ - public function __construct(array $objects, $action, array $parameters = array()) { + public function __construct(array $objects, $action, array $parameters = []) { $this->action = $action; $this->parameters = $parameters; diff --git a/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php b/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php index 9fa7ccd7dc..b314ab095a 100644 --- a/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php @@ -26,7 +26,7 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('loadResponses'); + protected $allowGuestAccess = ['loadResponses']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$className @@ -60,7 +60,7 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { $ignoreCounters = !empty($this->parameters['ignoreCounters']); // read object type ids for comments - $commentIDs = array(); + $commentIDs = []; foreach ($this->objects as $response) { $commentIDs[] = $response->commentID; } @@ -71,14 +71,14 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { $comments = $commentList->getObjects(); // update counters - $processors = $responseIDs = $updateComments = array(); + $processors = $responseIDs = $updateComments = []; foreach ($this->objects as $response) { $objectTypeID = $comments[$response->commentID]->objectTypeID; if (!isset($processors[$objectTypeID])) { $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID); $processors[$objectTypeID] = $objectType->getProcessor(); - $responseIDs[$objectTypeID] = array(); + $responseIDs[$objectTypeID] = []; } $responseIDs[$objectTypeID][] = $response->responseID; @@ -101,14 +101,14 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { foreach ($comments as $comment) { $commentEditor = new CommentEditor($comment); $commentEditor->updateResponseIDs(); - $commentEditor->updateCounters(array( + $commentEditor->updateCounters([ 'responses' => -1 * $updateComments[$comment->commentID] - )); + ]); } } - $likeObjectIDs = array(); - $notificationObjectTypes = array(); + $likeObjectIDs = []; + $notificationObjectTypes = []; foreach ($responseIDs as $objectTypeID => $objectIDs) { // remove activity events $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID); @@ -163,7 +163,7 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { public function loadResponses() { // get response list $responseList = new StructuredCommentResponseList($this->commentManager, $this->comment); - $responseList->getConditionBuilder()->add("comment_response.time > ?", array($this->parameters['data']['lastResponseTime'])); + $responseList->getConditionBuilder()->add("comment_response.time > ?", [$this->parameters['data']['lastResponseTime']]); if (!$this->parameters['data']['loadAllResponses']) $responseList->sqlLimit = 50; $responseList->readObjects(); @@ -176,16 +176,16 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { $lastResponseTime = max($lastResponseTime, $response->time); } - WCF::getTPL()->assign(array( - 'likeData' => (MODULE_LIKE ? $responseList->getLikeData() : array()), + WCF::getTPL()->assign([ + 'likeData' => (MODULE_LIKE ? $responseList->getLikeData() : []), 'responseList' => $responseList, 'commentManager' => $this->commentManager - )); + ]); - return array( + return [ 'commentID' => $this->comment->commentID, 'lastResponseTime' => $lastResponseTime, 'template' => WCF::getTPL()->fetch('commentResponseList') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/condition/Condition.class.php b/wcfsetup/install/files/lib/data/condition/Condition.class.php index 157576d97e..5bfef9fcd9 100644 --- a/wcfsetup/install/files/lib/data/condition/Condition.class.php +++ b/wcfsetup/install/files/lib/data/condition/Condition.class.php @@ -61,7 +61,7 @@ class Condition extends DatabaseObject { // handle condition data $this->data['conditionData'] = @unserialize($data['conditionData']); if (!is_array($this->data['conditionData'])) { - $this->data['conditionData'] = array(); + $this->data['conditionData'] = []; } } diff --git a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php index 27a0aee63d..e9bd8808ae 100644 --- a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php @@ -28,27 +28,27 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.management.canManageCronjob'); + protected $permissionsCreate = ['admin.management.canManageCronjob']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.management.canManageCronjob'); + protected $permissionsDelete = ['admin.management.canManageCronjob']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.management.canManageCronjob'); + protected $permissionsUpdate = ['admin.management.canManageCronjob']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('executeCronjobs'); + protected $allowGuestAccess = ['executeCronjobs']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update', 'toggle', 'execute'); + protected $requireACP = ['create', 'delete', 'update', 'toggle', 'execute']; /** * @see \wcf\data\IDeleteAction::validateDelete() @@ -94,9 +94,9 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio */ public function toggle() { foreach ($this->objects as $cronjob) { - $cronjob->update(array( + $cronjob->update([ 'isDisabled' => $cronjob->isDisabled ? 0 : 1 - )); + ]); } } @@ -111,16 +111,16 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio * Executes cronjobs. */ public function execute() { - $return = array(); + $return = []; foreach ($this->objects as $key => $cronjob) { // mark them as pending - $cronjob->update(array('state' => Cronjob::PENDING)); + $cronjob->update(['state' => Cronjob::PENDING]); } foreach ($this->objects as $cronjob) { // it now time for executing - $cronjob->update(array('state' => Cronjob::EXECUTING)); + $cronjob->update(['state' => Cronjob::EXECUTING]); $className = $cronjob->className; $executable = new $className(); @@ -138,20 +138,20 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio catch (\Exception $exception) { } } - CronjobLogEditor::create(array( + CronjobLogEditor::create([ 'cronjobID' => $cronjob->cronjobID, 'execTime' => TIME_NOW, 'success' => ($exception ? 0 : 1), 'error' => ($exception ? $exception->getMessage() : '') - )); + ]); // calculate next exec-time $nextExec = $cronjob->getNextExec(); - $data = array( + $data = [ 'lastExec' => TIME_NOW, 'nextExec' => $nextExec, 'afterNextExec' => $cronjob->getNextExec(($nextExec + 120)) - ); + ]; // cronjob failed if ($exception) { @@ -180,7 +180,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio // build the return value if ($exception === null && !$cronjob->isDisabled) { $dateTime = DateUtil::getDateTimeByTimestamp($nextExec); - $return[$cronjob->cronjobID] = array( + $return[$cronjob->cronjobID] = [ 'time' => $nextExec, 'formatted' => str_replace( '%time%', @@ -191,11 +191,11 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio WCF::getLanguage()->get('wcf.date.dateTimeFormat') ) ) - ); + ]; } // we are finished - $cronjob->update(array('state' => Cronjob::READY)); + $cronjob->update(['state' => Cronjob::READY]); // throw exception again to show error message if ($exception) { @@ -218,7 +218,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio */ public function executeCronjobs() { // switch session owner to 'system' during execution of cronjobs - WCF::getSession()->changeUser(new User(null, array('userID' => 0, 'username' => 'System')), true); + WCF::getSession()->changeUser(new User(null, ['userID' => 0, 'username' => 'System']), true); WCF::getSession()->disableUpdate(); CronjobScheduler::getInstance()->executeCronjobs(); diff --git a/wcfsetup/install/files/lib/data/cronjob/log/CronjobLogAction.class.php b/wcfsetup/install/files/lib/data/cronjob/log/CronjobLogAction.class.php index 35649e3cdc..dde59826e1 100644 --- a/wcfsetup/install/files/lib/data/cronjob/log/CronjobLogAction.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/log/CronjobLogAction.class.php @@ -22,13 +22,13 @@ class CronjobLogAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('clearAll'); + protected $requireACP = ['clearAll']; /** * Validates the clear all action. */ public function validateClearAll() { - WCF::getSession()->checkPermissions(array('admin.management.canManageCronjob')); + WCF::getSession()->checkPermissions(['admin.management.canManageCronjob']); } /** diff --git a/wcfsetup/install/files/lib/data/label/LabelAction.class.php b/wcfsetup/install/files/lib/data/label/LabelAction.class.php index d2fb1b0e97..8b6ef611b0 100644 --- a/wcfsetup/install/files/lib/data/label/LabelAction.class.php +++ b/wcfsetup/install/files/lib/data/label/LabelAction.class.php @@ -151,10 +151,10 @@ class LabelAction extends AbstractDatabaseObjectAction implements ISortableActio WCF::getDB()->beginTransaction(); foreach ($this->parameters['data']['structure'] as $labelIDs) { foreach ($labelIDs as $labelID) { - $statement->execute(array( + $statement->execute([ $showOrder++, $labelID - )); + ]); } } WCF::getDB()->commitTransaction(); diff --git a/wcfsetup/install/files/lib/data/label/group/LabelGroupAction.class.php b/wcfsetup/install/files/lib/data/label/group/LabelGroupAction.class.php index 4350e7228d..15264e3066 100644 --- a/wcfsetup/install/files/lib/data/label/group/LabelGroupAction.class.php +++ b/wcfsetup/install/files/lib/data/label/group/LabelGroupAction.class.php @@ -22,22 +22,22 @@ class LabelGroupAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.content.label.canManageLabel'); + protected $permissionsCreate = ['admin.content.label.canManageLabel']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.content.label.canManageLabel'); + protected $permissionsDelete = ['admin.content.label.canManageLabel']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.content.label.canManageLabel'); + protected $permissionsUpdate = ['admin.content.label.canManageLabel']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::delete() diff --git a/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php b/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php index 3ac6060818..1fc1db77da 100644 --- a/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php +++ b/wcfsetup/install/files/lib/data/label/group/ViewableLabelGroup.class.php @@ -29,16 +29,16 @@ class ViewableLabelGroup extends DatabaseObjectDecorator implements \Countable, * list of labels * @var Label[] */ - protected $labels = array(); + protected $labels = []; /** * list of permissions by type * @var integer[][] */ - protected $permissions = array( - 'group' => array(), - 'user' => array() - ); + protected $permissions = [ + 'group' => [], + 'user' => [] + ]; /** * current iterator index diff --git a/wcfsetup/install/files/lib/data/language/Language.class.php b/wcfsetup/install/files/lib/data/language/Language.class.php index 94ac7f2549..506f9915ab 100644 --- a/wcfsetup/install/files/lib/data/language/Language.class.php +++ b/wcfsetup/install/files/lib/data/language/Language.class.php @@ -36,13 +36,13 @@ class Language extends DatabaseObject { * list of language items * @var string[] */ - protected $items = array(); + protected $items = []; /** * list of dynamic language items * @var string[] */ - protected $dynamicItems = array(); + protected $dynamicItems = []; /** * instance of LanguageEditor @@ -127,7 +127,7 @@ class Language extends DatabaseObject { * @param boolean $optional * @return string result */ - public function getDynamicVariable($item, array $variables = array(), $optional = false) { + public function getDynamicVariable($item, array $variables = [], $optional = false) { $staticItem = $this->get($item, $optional); if (!$staticItem) return ''; diff --git a/wcfsetup/install/files/lib/data/language/LanguageAction.class.php b/wcfsetup/install/files/lib/data/language/LanguageAction.class.php index aff9d71741..c01e01dcbe 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageAction.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageAction.class.php @@ -22,17 +22,17 @@ class LanguageAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.language.canManageLanguage'); + protected $permissionsCreate = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.language.canManageLanguage'); + protected $permissionsDelete = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.language.canManageLanguage'); + protected $permissionsUpdate = ['admin.language.canManageLanguage']; /** * language editor object @@ -43,7 +43,7 @@ class LanguageAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'setAsDefault', 'update'); + protected $requireACP = ['create', 'delete', 'setAsDefault', 'update']; /** * Validates permission to set a language as default. diff --git a/wcfsetup/install/files/lib/data/language/SetupLanguage.class.php b/wcfsetup/install/files/lib/data/language/SetupLanguage.class.php index ca2689653f..264ba1d799 100644 --- a/wcfsetup/install/files/lib/data/language/SetupLanguage.class.php +++ b/wcfsetup/install/files/lib/data/language/SetupLanguage.class.php @@ -46,13 +46,13 @@ class SetupLanguage extends Language { $xml->load(TMP_DIR.'setup/lang/setup_'.$this->languageCode.'.xml'); // get language items - $categoriesToCache = array(); + $categoriesToCache = []; $items = $xml->xpath()->query('/ns:language/ns:category/ns:item'); foreach ($items as $item) { - $categoriesToCache[] = array( + $categoriesToCache[] = [ 'name' => $item->getAttribute('name'), 'cdata' => $item->nodeValue - ); + ]; } // update language files here diff --git a/wcfsetup/install/files/lib/data/language/category/LanguageCategoryAction.class.php b/wcfsetup/install/files/lib/data/language/category/LanguageCategoryAction.class.php index 76b08b1660..1c4ecc56f5 100644 --- a/wcfsetup/install/files/lib/data/language/category/LanguageCategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/language/category/LanguageCategoryAction.class.php @@ -21,20 +21,20 @@ class LanguageCategoryAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.language.canManageLanguage'); + protected $permissionsCreate = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.language.canManageLanguage'); + protected $permissionsDelete = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.language.canManageLanguage'); + protected $permissionsUpdate = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; } diff --git a/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php b/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php index cc7ffc304e..7ef16cdabe 100644 --- a/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php +++ b/wcfsetup/install/files/lib/data/language/item/LanguageItemAction.class.php @@ -25,22 +25,22 @@ class LanguageItemAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.language.canManageLanguage'); + protected $permissionsCreate = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.language.canManageLanguage'); + protected $permissionsDelete = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.language.canManageLanguage'); + protected $permissionsUpdate = ['admin.language.canManageLanguage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'edit', 'prepareEdit', 'update'); + protected $requireACP = ['create', 'delete', 'edit', 'prepareEdit', 'update']; /** * Validates parameters to prepare edit. @@ -61,14 +61,14 @@ class LanguageItemAction extends AbstractDatabaseObjectAction { */ public function prepareEdit() { $item = reset($this->objects); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'item' => $item - )); + ]); - return array( + return [ 'languageItem' => $item->languageItem, 'template' => WCF::getTPL()->fetch('languageItemEditDialog') - ); + ]; } /** @@ -96,15 +96,15 @@ class LanguageItemAction extends AbstractDatabaseObjectAction { // save item $editor = reset($this->objects); if ($editor->languageItemOriginIsSystem) { - $updateData = array( + $updateData = [ 'languageCustomItemValue' => !$this->parameters['languageUseCustomValue'] && empty($this->parameters['languageCustomItemValue']) ? null : $this->parameters['languageCustomItemValue'], 'languageUseCustomValue' => ($this->parameters['languageUseCustomValue'] ? 1 : 0) - ); + ]; } else { - $updateData = array( + $updateData = [ 'languageItemValue' => $this->parameters['languageItemValue'] - ); + ]; } $editor->update($updateData); diff --git a/wcfsetup/install/files/lib/data/like/Like.class.php b/wcfsetup/install/files/lib/data/like/Like.class.php index 69c38778a9..56c6ab6be0 100644 --- a/wcfsetup/install/files/lib/data/like/Like.class.php +++ b/wcfsetup/install/files/lib/data/like/Like.class.php @@ -59,16 +59,16 @@ class Like extends DatabaseObject { AND objectID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, $userID - )); + ]); $row = $statement->fetchArray(); if (!$row) { - $row = array(); + $row = []; } return new Like(null, $row); diff --git a/wcfsetup/install/files/lib/data/like/LikeAction.class.php b/wcfsetup/install/files/lib/data/like/LikeAction.class.php index f1541cee31..6a7898df83 100644 --- a/wcfsetup/install/files/lib/data/like/LikeAction.class.php +++ b/wcfsetup/install/files/lib/data/like/LikeAction.class.php @@ -28,7 +28,7 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getGroupedUserList', 'getLikeDetails', 'load'); + protected $allowGuestAccess = ['getGroupedUserList', 'getLikeDetails', 'load']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$className @@ -72,19 +72,19 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis AND objectTypeID = ? ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->parameters['data']['objectID'], $this->objectType->objectTypeID - )); - $data = array( - Like::LIKE => array(), - Like::DISLIKE => array() - ); + ]); + $data = [ + Like::LIKE => [], + Like::DISLIKE => [] + ]; while ($row = $statement->fetchArray()) { $data[$row['likeValue']][] = $row['userID']; } - $values = array(); + $values = []; if (!empty($data[Like::LIKE])) { $values[Like::LIKE] = new GroupedUserList(WCF::getLanguage()->get('wcf.like.details.like')); $values[Like::LIKE]->addUserIDs($data[Like::LIKE]); @@ -97,14 +97,14 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis // load user profiles GroupedUserList::loadUsers(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'groupedUsers' => $values - )); + ]); - return array( + return [ 'containerID' => $this->parameters['data']['containerID'], 'template' => WCF::getTPL()->fetch('groupedUserList') - ); + ]; } /** @@ -166,12 +166,12 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis UserActivityEventHandler::getInstance()->fireEvent($this->objectType->objectType.'.recentActivityEvent', $this->parameters['data']['objectID'], $this->likeableObject->getLanguageID()); } else { - UserActivityEventHandler::getInstance()->removeEvents($this->objectType->objectType.'.recentActivityEvent', array($this->parameters['data']['objectID'])); + UserActivityEventHandler::getInstance()->removeEvents($this->objectType->objectType.'.recentActivityEvent', [$this->parameters['data']['objectID']]); } } // get stats - return array( + return [ 'likes' => ($likeData['data']['likes'] === null) ? 0 : $likeData['data']['likes'], 'dislikes' => ($likeData['data']['dislikes'] === null) ? 0 : $likeData['data']['dislikes'], 'cumulativeLikes' => ($likeData['data']['cumulativeLikes'] === null) ? 0 : $likeData['data']['cumulativeLikes'], @@ -181,7 +181,7 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis 'newValue' => $likeData['newValue'], 'oldValue' => $likeData['oldValue'], 'users' => $likeData['users'] - ); + ]; } /** @@ -228,10 +228,10 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE objectID = ? AND objectTypeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->parameters['data']['objectID'], $this->objectType->objectTypeID - )); + ]); $pageCount = ceil($statement->fetchColumn() / 20); $sql = "SELECT userID, likeValue @@ -240,19 +240,19 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis AND objectTypeID = ? ORDER BY likeValue DESC, time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); - $statement->execute(array( + $statement->execute([ $this->parameters['data']['objectID'], $this->objectType->objectTypeID - )); - $data = array( - Like::LIKE => array(), - Like::DISLIKE => array() - ); + ]); + $data = [ + Like::LIKE => [], + Like::DISLIKE => [] + ]; while ($row = $statement->fetchArray()) { $data[$row['likeValue']][] = $row['userID']; } - $values = array(); + $values = []; if (!empty($data[Like::LIKE])) { $values[Like::LIKE] = new GroupedUserList(WCF::getLanguage()->get('wcf.like.details.like')); $values[Like::LIKE]->addUserIDs($data[Like::LIKE]); @@ -265,15 +265,15 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis // load user profiles GroupedUserList::loadUsers(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'groupedUsers' => $values - )); + ]); - return array( + return [ 'containerID' => $this->parameters['data']['containerID'], 'pageCount' => $pageCount, 'template' => WCF::getTPL()->fetch('groupedUserList') - ); + ]; } /** @@ -294,29 +294,29 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis public function load() { $likeList = new ViewableLikeList(); if ($this->parameters['lastLikeTime']) { - $likeList->getConditionBuilder()->add("like_table.time < ?", array($this->parameters['lastLikeTime'])); + $likeList->getConditionBuilder()->add("like_table.time < ?", [$this->parameters['lastLikeTime']]); } if ($this->parameters['likeType'] == 'received') { - $likeList->getConditionBuilder()->add("like_table.objectUserID = ?", array($this->parameters['userID'])); + $likeList->getConditionBuilder()->add("like_table.objectUserID = ?", [$this->parameters['userID']]); } else { - $likeList->getConditionBuilder()->add("like_table.userID = ?", array($this->parameters['userID'])); + $likeList->getConditionBuilder()->add("like_table.userID = ?", [$this->parameters['userID']]); } - $likeList->getConditionBuilder()->add("like_table.likeValue = ?", array($this->parameters['likeValue'])); + $likeList->getConditionBuilder()->add("like_table.likeValue = ?", [$this->parameters['likeValue']]); $likeList->readObjects(); if (!count($likeList)) { - return array(); + return []; } // parse template - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'likeList' => $likeList - )); + ]); - return array( + return [ 'lastLikeTime' => $likeList->getLastLikeTime(), 'template' => WCF::getTPL()->fetch('userProfileLikeItem') - ); + ]; } /** @@ -336,10 +336,10 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $sourceObjectType->objectTypeID, $this->parameters['sourceObjectID'] - )); + ]); $row = $statement->fetchArray(); // no (dis-)likes at all @@ -363,10 +363,10 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $sourceObjectType->objectTypeID, $this->parameters['sourceObjectID'] - )); + ]); // // step 3) update owner @@ -379,22 +379,22 @@ class LikeAction extends AbstractDatabaseObjectAction implements IGroupedUserLis AND objectID = ? AND likeValue = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $targetObjectType->objectTypeID, $this->parameters['targetObjectID'], Like::LIKE - )); + ]); $count = $statement->fetchSingleColumn(); if ($count) { // update received likes $userEditor = new UserEditor(new User($newLikeObject->objectUserID)); - $userEditor->updateCounters(array( + $userEditor->updateCounters([ 'likesReceived' => $count - )); + ]); // add activity points - UserActivityPointHandler::getInstance()->fireEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($newLikeObject->objectUserID => $count)); + UserActivityPointHandler::getInstance()->fireEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$newLikeObject->objectUserID => $count]); } } } diff --git a/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php b/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php index 4dc9a60fcd..a75c7adae2 100644 --- a/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php +++ b/wcfsetup/install/files/lib/data/like/ViewableLikeList.class.php @@ -46,17 +46,17 @@ class ViewableLikeList extends LikeList { public function readObjects() { parent::readObjects(); - $userIDs = array(); - $likeGroups = array(); + $userIDs = []; + $likeGroups = []; foreach ($this->objects as &$like) { $userIDs[] = $like->userID; if (!isset($likeGroups[$like->objectTypeID])) { $objectType = ObjectTypeCache::getInstance()->getObjectType($like->objectTypeID); - $likeGroups[$like->objectTypeID] = array( + $likeGroups[$like->objectTypeID] = [ 'provider' => $objectType->getProcessor(), - 'objects' => array() - ); + 'objects' => [] + ]; } $likeGroups[$like->objectTypeID]['objects'][] = $like; diff --git a/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php b/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php index 04321f9711..13125ae858 100644 --- a/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php +++ b/wcfsetup/install/files/lib/data/like/object/LikeObject.class.php @@ -45,7 +45,7 @@ class LikeObject extends DatabaseObject { * list of users who liked this object * @var User[] */ - protected $users = array(); + protected $users = []; /** * @inheritDoc @@ -110,14 +110,14 @@ class LikeObject extends DatabaseObject { WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID - )); + ]); $row = $statement->fetchArray(); if (!$row) { - $row = array(); + $row = []; } return new LikeObject(null, $row); diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php index cb4608a8be..110543abfe 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItemAction.class.php @@ -63,7 +63,7 @@ class MenuItemAction extends AbstractDatabaseObjectAction implements ISortableAc */ public function toggle() { foreach ($this->objects as $object) { - $object->update(array('isDisabled' => ($object->isDisabled) ? 0 : 1)); + $object->update(['isDisabled' => ($object->isDisabled) ? 0 : 1]); } } diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php index cc1b679199..7fab9127e0 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php @@ -123,7 +123,7 @@ class MenuItemNodeTree { * @return MenuItemNode[] nested menu item tree */ protected function generateNodeTree($parentID = null, MenuItemNode $parentNode = null) { - $nodes = array(); + $nodes = []; $itemIDs = (isset($this->menuItemStructure[$parentID]) ? $this->menuItemStructure[$parentID] : []); foreach ($itemIDs as $itemID) { diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php index 13646a7f54..51579c5962 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php @@ -70,13 +70,13 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $this->readObjects(); } - $queueIDs = array(); + $queueIDs = []; foreach ($this->objects as $queue) { $queueIDs[] = $queue->queueID; } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("queueID IN (?)", array($queueIDs)); + $conditions->add("queueID IN (?)", [$queueIDs]); $sql = "UPDATE wcf".WCF_N."_moderation_queue SET status = ".ModerationQueue::STATUS_DONE." @@ -92,7 +92,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { * Validates parameters to fetch a list of outstanding queues. */ public function validateGetOutstandingQueues() { - WCF::getSession()->checkPermissions(array('mod.general.canUseModeration')); + WCF::getSession()->checkPermissions(['mod.general.canUseModeration']); } /** @@ -102,10 +102,10 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { */ public function getOutstandingQueues() { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("moderation_queue_to_user.userID = ?", array(WCF::getUser()->userID)); - $conditions->add("moderation_queue_to_user.isAffected = ?", array(1)); - $conditions->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); - $conditions->add("moderation_queue.time > ?", array(VisitTracker::getInstance()->getVisitTime('com.woltlab.wcf.moderation.queue'))); + $conditions->add("moderation_queue_to_user.userID = ?", [WCF::getUser()->userID]); + $conditions->add("moderation_queue_to_user.isAffected = ?", [1]); + $conditions->add("moderation_queue.status IN (?)", [[ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING]]); + $conditions->add("moderation_queue.time > ?", [VisitTracker::getInstance()->getVisitTime('com.woltlab.wcf.moderation.queue')]); $conditions->add("(moderation_queue.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)"); $sql = "SELECT moderation_queue.queueID @@ -120,10 +120,10 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $statement->execute($conditions->getParameters()); $queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); - $queues = array(); + $queues = []; if (!empty($queueIDs)) { $queueList = new ViewableModerationQueueList(); - $queueList->getConditionBuilder()->add("moderation_queue.queueID IN (?)", array($queueIDs)); + $queueList->getConditionBuilder()->add("moderation_queue.queueID IN (?)", [$queueIDs]); $queueList->sqlOrderBy = "moderation_queue.lastChangeTime DESC"; $queueList->loadUserProfiles = true; $queueList->readObjects(); @@ -138,8 +138,8 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { if ($count < 5) { // load more entries to fill up list $queueList = new ViewableModerationQueueList(); - $queueList->getConditionBuilder()->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); - if (!empty($queueIDs)) $queueList->getConditionBuilder()->add("moderation_queue.queueID NOT IN (?)", array($queueIDs)); + $queueList->getConditionBuilder()->add("moderation_queue.status IN (?)", [[ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING]]); + if (!empty($queueIDs)) $queueList->getConditionBuilder()->add("moderation_queue.queueID NOT IN (?)", [$queueIDs]); $queueList->sqlOrderBy = "moderation_queue.lastChangeTime DESC"; $queueList->sqlLimit = 5 - $count; $queueList->loadUserProfiles = true; @@ -150,7 +150,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { // check if stored count is out of sync if ($count < $totalCount) { - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'outstandingModerationCount'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'outstandingModerationCount'); // check for orphaned queues $queueCount = ModerationQueueManager::getInstance()->getUnreadModerationCount(); @@ -160,14 +160,14 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { } } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'queues' => $queues - )); + ]); - return array( + return [ 'template' => WCF::getTPL()->fetch('moderationQueueList'), 'totalCount' => $totalCount - ); + ]; } /** @@ -190,14 +190,14 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { public function getAssignUserForm() { $assignedUser = ($this->moderationQueueEditor->assignedUserID) ? new User($this->moderationQueueEditor->assignedUserID) : null; - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'assignedUser' => $assignedUser, 'queue' => $this->moderationQueueEditor - )); + ]); - return array( + return [ 'template' => WCF::getTPL()->fetch('moderationQueueAssignUser') - ); + ]; } /** @@ -242,7 +242,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { * @return string[] */ public function assignUser() { - $data = array('assignedUserID' => ($this->parameters['assignedUserID'] ?: null)); + $data = ['assignedUserID' => ($this->parameters['assignedUserID'] ?: null)]; if ($this->user->userID) { if ($this->moderationQueueEditor->status == ModerationQueue::STATUS_OUTSTANDING) { $data['status'] = ModerationQueue::STATUS_PROCESSING; @@ -259,7 +259,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $username = ($this->user->userID) ? $this->user->username : WCF::getLanguage()->get('wcf.moderation.assignedUser.nobody'); $link = ''; if ($this->user->userID) { - $link = LinkHandler::getInstance()->getLink('User', array('object' => $this->user)); + $link = LinkHandler::getInstance()->getLink('User', ['object' => $this->user]); } $newStatus = ''; @@ -267,12 +267,12 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $newStatus = ($data['status'] == ModerationQueue::STATUS_OUTSTANDING) ? 'outstanding' : 'processing'; } - return array( + return [ 'link' => $link, 'newStatus' => $newStatus, 'userID' => $this->user->userID, 'username' => $username - ); + ]; } /** @@ -292,15 +292,15 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { } // reset storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'unreadModerationCount'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'unreadModerationCount'); if (count($this->objects) == 1) { $queue = reset($this->objects); - return array( + return [ 'markAsRead' => $queue->queueID, 'totalCount' => ModerationQueueManager::getInstance()->getUnreadModerationCount(true) - ); + ]; } } @@ -326,11 +326,11 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { VisitTracker::getInstance()->trackTypeVisit('com.woltlab.wcf.moderation.queue'); // reset storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'unreadModerationCount'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'unreadModerationCount'); - return array( + return [ 'markAllAsRead' => true - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueActivationAction.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueActivationAction.class.php index 252b102685..2b273a8836 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueActivationAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueActivationAction.class.php @@ -17,7 +17,7 @@ class ModerationQueueActivationAction extends ModerationQueueAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('enableContent', 'removeContent'); + protected $allowGuestAccess = ['enableContent', 'removeContent']; /** * moderation queue editor object diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueReportAction.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueReportAction.class.php index aa6845cc11..fe2992b0d1 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueReportAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueReportAction.class.php @@ -20,7 +20,7 @@ class ModerationQueueReportAction extends ModerationQueueAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('prepareReport', 'removeContent', 'removeReport', 'report'); + protected $allowGuestAccess = ['prepareReport', 'removeContent', 'removeReport', 'report']; /** * moderation queue editor object @@ -68,7 +68,7 @@ class ModerationQueueReportAction extends ModerationQueueAction { * Validates parameters to prepare a report. */ public function validatePrepareReport() { - WCF::getSession()->checkPermissions(array('user.profile.canReportContent')); + WCF::getSession()->checkPermissions(['user.profile.canReportContent']); $this->readInteger('objectID'); $this->readString('objectType'); @@ -95,22 +95,22 @@ class ModerationQueueReportAction extends ModerationQueueAction { // content was already reported $alreadyReported = (ModerationQueueReportManager::getInstance()->hasPendingReport($this->parameters['objectType'], $this->parameters['objectID'])) ? 1 : 0; - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'alreadyReported' => $alreadyReported, 'object' => ModerationQueueReportManager::getInstance()->getReportedObject($this->parameters['objectType'], $this->parameters['objectID']) - )); + ]); - return array( + return [ 'alreadyReported' => $alreadyReported, 'template' => WCF::getTPL()->fetch('moderationReportDialog') - ); + ]; } /** * Validates parameters for reporting. */ public function validateReport() { - WCF::getSession()->checkPermissions(array('user.profile.canReportContent')); + WCF::getSession()->checkPermissions(['user.profile.canReportContent']); $this->readString('message'); if (mb_strlen($this->parameters['message']) > 64000) { @@ -135,8 +135,8 @@ class ModerationQueueReportAction extends ModerationQueueAction { ); } - return array( + return [ 'reported' => 1 - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/modification/log/ModificationLog.class.php b/wcfsetup/install/files/lib/data/modification/log/ModificationLog.class.php index 9299a34dc6..5939c6509b 100644 --- a/wcfsetup/install/files/lib/data/modification/log/ModificationLog.class.php +++ b/wcfsetup/install/files/lib/data/modification/log/ModificationLog.class.php @@ -57,7 +57,7 @@ class ModificationLog extends DatabaseObject { $this->data['additionalData'] = @unserialize($this->data['additionalData']); if (!is_array($this->data['additionalData'])) { - $this->data['additionalData'] = array(); + $this->data['additionalData'] = []; } } } diff --git a/wcfsetup/install/files/lib/data/notice/Notice.class.php b/wcfsetup/install/files/lib/data/notice/Notice.class.php index 0bb31b5f45..db25179adc 100644 --- a/wcfsetup/install/files/lib/data/notice/Notice.class.php +++ b/wcfsetup/install/files/lib/data/notice/Notice.class.php @@ -96,11 +96,11 @@ class Notice extends DatabaseObject implements IRouteController { FROM wcf".WCF_N."_notice_dismissed WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ WCF::getUser()->userID - )); + ]); - $noticeIDs = array(); + $noticeIDs = []; while ($noticeID = $statement->fetchColumn()) { $noticeIDs[] = $noticeID; diff --git a/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php b/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php index aa6179dd69..bd675464bc 100644 --- a/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php +++ b/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php @@ -22,22 +22,22 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('dismiss'); + protected $allowGuestAccess = ['dismiss']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.notice.canManageNotice'); + protected $permissionsDelete = ['admin.notice.canManageNotice']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.notice.canManageNotice'); + protected $permissionsUpdate = ['admin.notice.canManageNotice']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update', 'updatePosition'); + protected $requireACP = ['create', 'delete', 'toggle', 'update', 'updatePosition']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -76,12 +76,12 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi (noticeID, userID) VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ reset($this->objectIDs), WCF::getUser()->userID - )); + ]); - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'dismissedNotices'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'dismissedNotices'); } else { $dismissedNotices = WCF::getSession()->getVar('dismissedNotices'); @@ -90,17 +90,17 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi $dismissedNotices[] = reset($this->objectIDs); } else { - $dismissedNotices = array( + $dismissedNotices = [ reset($this->objectIDs) - ); + ]; } WCF::getSession()->register('dismissedNotices', serialize($dismissedNotices)); } - return array( + return [ 'noticeID' => reset($this->objectIDs) - ); + ]; } /** @@ -108,9 +108,9 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi */ public function toggle() { foreach ($this->objects as $notice) { - $notice->update(array( + $notice->update([ 'isDisabled' => $notice->isDisabled ? 0 : 1 - )); + ]); } } @@ -170,10 +170,10 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi $showOrder = $this->parameters['data']['offset']; WCF::getDB()->beginTransaction(); foreach ($this->parameters['data']['structure'][0] as $noticeID) { - $statement->execute(array( + $statement->execute([ $showOrder++, $noticeID - )); + ]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/data/object/type/AbstractObjectTypeProvider.class.php b/wcfsetup/install/files/lib/data/object/type/AbstractObjectTypeProvider.class.php index e43c235188..dd941fca85 100644 --- a/wcfsetup/install/files/lib/data/object/type/AbstractObjectTypeProvider.class.php +++ b/wcfsetup/install/files/lib/data/object/type/AbstractObjectTypeProvider.class.php @@ -46,14 +46,14 @@ abstract class AbstractObjectTypeProvider implements IObjectTypeProvider { * @see \wcf\data\object\type\IObjectTypeProvider::getObjectsByIDs() */ public function getObjectsByIDs(array $objectIDs) { - $tableAlias = call_user_func(array($this->className, 'getDatabaseTableAlias')); - $tableIndex = call_user_func(array($this->className, 'getDatabaseTableIndexName')); + $tableAlias = call_user_func([$this->className, 'getDatabaseTableAlias']); + $tableIndex = call_user_func([$this->className, 'getDatabaseTableIndexName']); $objectList = new $this->listClassName(); if ($this->decoratorClassName) { $objectList->decoratorClassName = $this->decoratorClassName; } - $objectList->getConditionBuilder()->add($tableAlias.".".$tableIndex." IN (?)", array($objectIDs)); + $objectList->getConditionBuilder()->add($tableAlias.".".$tableIndex." IN (?)", [$objectIDs]); $objectList->readObjects(); return $objectList->getObjects(); diff --git a/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php b/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php index 59ca7255cf..893fc66958 100644 --- a/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php +++ b/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php @@ -19,46 +19,46 @@ class ObjectTypeCache extends SingletonFactory { * object type definitions * @var ObjectTypeDefinition[] */ - protected $definitions = array(); + protected $definitions = []; /** * object type definition ids grouped by category name * @var integer[][] */ - protected $definitionsByCategory = array(); + protected $definitionsByCategory = []; /** * object type definitions sorted by name * @var ObjectTypeDefinition[] */ - protected $definitionsByName = array(); + protected $definitionsByName = []; /** * object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * object types grouped by definition * @var array */ - protected $groupedObjectTypes = array(); + protected $groupedObjectTypes = []; /** * @see \wcf\system\SingletonFactory::init() */ protected function init() { // get definition cache - $this->definitionsByCategory = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'categories'); - $this->definitions = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'definitions'); + $this->definitionsByCategory = ObjectTypeCacheBuilder::getInstance()->getData([], 'categories'); + $this->definitions = ObjectTypeCacheBuilder::getInstance()->getData([], 'definitions'); foreach ($this->definitions as $definition) { $this->definitionsByName[$definition->definitionName] = $definition; } // get object type cache - $this->objectTypes = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'objectTypes'); - $this->groupedObjectTypes = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'groupedObjectTypes'); + $this->objectTypes = ObjectTypeCacheBuilder::getInstance()->getData([], 'objectTypes'); + $this->groupedObjectTypes = ObjectTypeCacheBuilder::getInstance()->getData([], 'groupedObjectTypes'); } /** @@ -100,7 +100,7 @@ class ObjectTypeCache extends SingletonFactory { */ public function getDefinitionsByCategory($categoryName) { if (isset($this->definitionsByCategory[$categoryName])) { - $definitions = array(); + $definitions = []; foreach ($this->definitionsByCategory[$categoryName] as $definitionID) { $definitions[$definitionID] = $this->getDefinition($definitionID); } @@ -137,7 +137,7 @@ class ObjectTypeCache extends SingletonFactory { return $this->groupedObjectTypes[$definitionName]; } - return array(); + return []; } /** diff --git a/wcfsetup/install/files/lib/data/option/Option.class.php b/wcfsetup/install/files/lib/data/option/Option.class.php index 802f39ae69..563b0e41e0 100644 --- a/wcfsetup/install/files/lib/data/option/Option.class.php +++ b/wcfsetup/install/files/lib/data/option/Option.class.php @@ -70,7 +70,7 @@ class Option extends DatabaseObject { parent::handleData($data); // unserialize additional data - $this->data['additionalData'] = (empty($data['additionalData']) ? array() : @unserialize($data['additionalData'])); + $this->data['additionalData'] = (empty($data['additionalData']) ? [] : @unserialize($data['additionalData'])); } /** @@ -84,7 +84,7 @@ class Option extends DatabaseObject { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - $options = array(); + $options = []; while ($row = $statement->fetchArray()) { $option = new Option(null, $row); $options[$option->getConstantName()] = $option; @@ -117,10 +117,10 @@ class Option extends DatabaseObject { } } - return array( + return [ 'disableOptions' => $disableOptions, 'enableOptions' => $enableOptions - ); + ]; } /** @@ -129,7 +129,7 @@ class Option extends DatabaseObject { * @return array */ public function parseSelectOptions() { - $result = array(); + $result = []; $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($this->selectOptions))); foreach ($options as $option) { $key = $value = $option; @@ -151,7 +151,7 @@ class Option extends DatabaseObject { * @return array */ public function parseMultipleEnableOptions() { - $result = array(); + $result = []; if (!empty($this->enableOptions)) { $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($this->enableOptions))); $key = -1; diff --git a/wcfsetup/install/files/lib/data/option/OptionAction.class.php b/wcfsetup/install/files/lib/data/option/OptionAction.class.php index 375678816c..dd303be0df 100644 --- a/wcfsetup/install/files/lib/data/option/OptionAction.class.php +++ b/wcfsetup/install/files/lib/data/option/OptionAction.class.php @@ -21,22 +21,22 @@ class OptionAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.configuration.canEditOption'); + protected $permissionsCreate = ['admin.configuration.canEditOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.configuration.canEditOption'); + protected $permissionsDelete = ['admin.configuration.canEditOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.configuration.canEditOption'); + protected $permissionsUpdate = ['admin.configuration.canEditOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'import', 'update', 'updateAll'); + protected $requireACP = ['create', 'delete', 'import', 'update', 'updateAll']; /** * Validates permissions and parameters. @@ -57,7 +57,7 @@ class OptionAction extends AbstractDatabaseObjectAction { */ public function import() { // create data - call_user_func(array($this->className, 'import'), $this->parameters['data']); + call_user_func([$this->className, 'import'], $this->parameters['data']); } /** @@ -65,6 +65,6 @@ class OptionAction extends AbstractDatabaseObjectAction { */ public function updateAll() { // create data - call_user_func(array($this->className, 'updateAll'), $this->parameters['data']); + call_user_func([$this->className, 'updateAll'], $this->parameters['data']); } } diff --git a/wcfsetup/install/files/lib/data/option/category/OptionCategoryAction.class.php b/wcfsetup/install/files/lib/data/option/category/OptionCategoryAction.class.php index fdad3caf74..d7ac94bffd 100644 --- a/wcfsetup/install/files/lib/data/option/category/OptionCategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/option/category/OptionCategoryAction.class.php @@ -21,20 +21,20 @@ class OptionCategoryAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.configuration.canEditOption'); + protected $permissionsCreate = ['admin.configuration.canEditOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.configuration.canEditOption'); + protected $permissionsDelete = ['admin.configuration.canEditOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.configuration.canEditOption'); + protected $permissionsUpdate = ['admin.configuration.canEditOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; } diff --git a/wcfsetup/install/files/lib/data/package/Package.class.php b/wcfsetup/install/files/lib/data/package/Package.class.php index a2217e9477..f451713332 100644 --- a/wcfsetup/install/files/lib/data/package/Package.class.php +++ b/wcfsetup/install/files/lib/data/package/Package.class.php @@ -138,7 +138,7 @@ class Package extends DatabaseObject { if ($this->requiredPackages === null) { self::loadRequirements(); - $this->requiredPackages = array(); + $this->requiredPackages = []; if (isset(self::$requirements[$this->packageID])) { foreach (self::$requirements[$this->packageID] as $packageID) { $this->requiredPackages[$packageID] = PackageCache::getInstance()->getPackage($packageID); @@ -181,7 +181,7 @@ class Package extends DatabaseObject { if ($this->dependentPackages === null) { self::loadRequirements(); - $this->dependentPackages = array(); + $this->dependentPackages = []; foreach (self::$requirements as $packageID => $requiredPackageIDs) { if (in_array($this->packageID, $requiredPackageIDs)) { $this->dependentPackages[$packageID] = PackageCache::getInstance()->getPackage($packageID); @@ -213,11 +213,11 @@ class Package extends DatabaseObject { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - self::$requiredPackageIDs = array(); - self::$requirements = array(); + self::$requiredPackageIDs = []; + self::$requirements = []; while ($row = $statement->fetchArray()) { if (!isset(self::$requirements[$row['packageID']])) { - self::$requirements[$row['packageID']] = array(); + self::$requirements[$row['packageID']] = []; } self::$requirements[$row['packageID']][] = $row['requirement']; @@ -240,7 +240,7 @@ class Package extends DatabaseObject { FROM wcf".WCF_N."_package WHERE package = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($package)); + $statement->execute([$package]); return $statement->fetchSingleColumn() > 0; } diff --git a/wcfsetup/install/files/lib/data/package/PackageAction.class.php b/wcfsetup/install/files/lib/data/package/PackageAction.class.php index cbe01d7c1d..92e20f6a5b 100644 --- a/wcfsetup/install/files/lib/data/package/PackageAction.class.php +++ b/wcfsetup/install/files/lib/data/package/PackageAction.class.php @@ -28,35 +28,35 @@ class PackageAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.configuration.package.canInstallPackage'); + protected $permissionsCreate = ['admin.configuration.package.canInstallPackage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.configuration.package.canUninstallPackage'); + protected $permissionsDelete = ['admin.configuration.package.canUninstallPackage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.configuration.package.canUpdatePackage'); + protected $permissionsUpdate = ['admin.configuration.package.canUpdatePackage']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('searchForPurchasedItems'); + protected $requireACP = ['searchForPurchasedItems']; /** * Validates parameters to search for purchased items in the WoltLab Plugin-Store. */ public function validateSearchForPurchasedItems() { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canInstallPackage', 'admin.configuration.package.canUpdatePackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage', 'admin.configuration.package.canUpdatePackage']); $this->readString('password', true); $this->readString('username', true); if (empty($this->parameters['username'])) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("serverURL IN (?)", array(array('http://store.woltlab.com/maelstrom/', 'http://store.woltlab.com/typhoon/'))); + $conditions->add("serverURL IN (?)", [['http://store.woltlab.com/maelstrom/', 'http://store.woltlab.com/typhoon/']]); $conditions->add("loginUsername <> ''"); $conditions->add("loginPassword <> ''"); @@ -82,24 +82,24 @@ class PackageAction extends AbstractDatabaseObjectAction { */ public function searchForPurchasedItems() { if (!RemoteFile::supportsSSL()) { - return array( + return [ 'noSSL' => WCF::getLanguage()->get('wcf.acp.pluginStore.api.noSSL') - ); + ]; } if (empty($this->parameters['username']) || empty($this->parameters['password'])) { - return array( + return [ 'template' => $this->renderAuthorizationDialog(false) - ); + ]; } - $request = new HTTPRequest('https://api.woltlab.com/1.0/customer/purchases/list.json', array( + $request = new HTTPRequest('https://api.woltlab.com/1.0/customer/purchases/list.json', [ 'method' => 'POST' - ), array( + ], [ 'username' => $this->parameters['username'], 'password' => $this->parameters['password'], 'wcfVersion' => WCF_VERSION - )); + ]); $request->execute(); $reply = $request->getReply(); @@ -109,30 +109,30 @@ class PackageAction extends AbstractDatabaseObjectAction { switch ($code) { case 200: if (empty($response['products'])) { - return array( + return [ 'noResults' => WCF::getLanguage()->get('wcf.acp.pluginStore.purchasedItems.noResults') - ); + ]; } else { WCF::getSession()->register('__pluginStoreProducts', $response['products']); WCF::getSession()->register('__pluginStoreWcfMajorReleases', $response['wcfMajorReleases']); - return array( + return [ 'redirectURL' => LinkHandler::getInstance()->getLink('PluginStorePurchasedItems') - ); + ]; } break; // authentication error case 401: - return array( + return [ 'template' => $this->renderAuthorizationDialog(true) - ); + ]; break; // any other kind of errors default: - throw new SystemException(WCF::getLanguage()->getDynamicVariable('wcf.acp.pluginStore.api.error', array('status' => $code))); + throw new SystemException(WCF::getLanguage()->getDynamicVariable('wcf.acp.pluginStore.api.error', ['status' => $code])); break; } } @@ -144,9 +144,9 @@ class PackageAction extends AbstractDatabaseObjectAction { * @return string */ protected function renderAuthorizationDialog($rejected) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'rejected' => $rejected - )); + ]); return WCF::getTPL()->fetch('pluginStoreAuthorization'); } diff --git a/wcfsetup/install/files/lib/data/package/PackageCache.class.php b/wcfsetup/install/files/lib/data/package/PackageCache.class.php index 7ff190f157..1457477f35 100644 --- a/wcfsetup/install/files/lib/data/package/PackageCache.class.php +++ b/wcfsetup/install/files/lib/data/package/PackageCache.class.php @@ -18,7 +18,7 @@ class PackageCache extends SingletonFactory { * list of cached packages * @var mixed[][] */ - protected $packages = array(); + protected $packages = []; /** * @see \wcf\system\SingletonFactory::init() diff --git a/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueueAction.class.php b/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueueAction.class.php index 0849eb0b60..caef4db76d 100644 --- a/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/package/installation/queue/PackageInstallationQueueAction.class.php @@ -38,7 +38,7 @@ class PackageInstallationQueueAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('cancelInstallation', 'prepareQueue'); + protected $requireACP = ['cancelInstallation', 'prepareQueue']; /** * Validates the 'prepareQueue' action: @@ -51,7 +51,7 @@ class PackageInstallationQueueAction extends AbstractDatabaseObjectAction { throw new UserInputException('packageID'); } - if (!isset($this->parameters['action']) || !in_array($this->parameters['action'], array('install', 'update', 'uninstall', 'rollback'))) { + if (!isset($this->parameters['action']) || !in_array($this->parameters['action'], ['install', 'update', 'uninstall', 'rollback'])) { throw new UserInputException('action'); } } @@ -64,7 +64,7 @@ class PackageInstallationQueueAction extends AbstractDatabaseObjectAction { public function prepareQueue() { $processNo = PackageInstallationQueue::getNewProcessNo(); - $queue = PackageInstallationQueueEditor::create(array( + $queue = PackageInstallationQueueEditor::create([ 'processNo' => $processNo, 'userID' => WCF::getUser()->userID, 'package' => $this->package->package, @@ -72,11 +72,11 @@ class PackageInstallationQueueAction extends AbstractDatabaseObjectAction { 'packageID' => $this->package->packageID, 'action' => $this->parameters['action'], 'installationType' => 'other' - )); + ]); - return array( + return [ 'queueID' => $queue->queueID - ); + ]; } /** @@ -84,7 +84,7 @@ class PackageInstallationQueueAction extends AbstractDatabaseObjectAction { */ public function validateCancelInstallation() { // check permissions - WCF::getSession()->checkPermissions(array('admin.configuration.package.canInstallPackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage']); // validate queue $this->queue = $this->getSingleObject(); @@ -105,8 +105,8 @@ class PackageInstallationQueueAction extends AbstractDatabaseObjectAction { $this->queue->delete(); - return array( + return [ 'url' => LinkHandler::getInstance()->getLink('PackageList') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php index cb15636cb7..26b39cb87a 100644 --- a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php @@ -35,7 +35,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('getResultList', 'prepareInstallation', 'prepareUpdate', 'search', 'searchForUpdates'); + protected $requireACP = ['getResultList', 'prepareInstallation', 'prepareUpdate', 'search', 'searchForUpdates']; /** * search object @@ -47,7 +47,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { * Validates parameters to search for installable packages. */ public function validateSearch() { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canInstallPackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage']); $this->readString('package', true); $this->readString('packageDescription', true); @@ -70,28 +70,28 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // there are no available package update servers if (empty($availableUpdateServers)) { - WCF::getTPL()->assign(array( - 'packageUpdates' => array() - )); + WCF::getTPL()->assign([ + 'packageUpdates' => [] + ]); - return array( + return [ 'count' => 0, 'pageCount' => 0, 'searchID' => 0, 'template' => WCF::getTPL()->fetch('packageSearchResultList') - ); + ]; } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package_update.packageUpdateServerID IN (?)", array(array_keys($availableUpdateServers))); + $conditions->add("package_update.packageUpdateServerID IN (?)", [array_keys($availableUpdateServers)]); if (!empty($this->parameters['package'])) { - $conditions->add("package_update.package LIKE ?", array('%'.$this->parameters['package'].'%')); + $conditions->add("package_update.package LIKE ?", ['%'.$this->parameters['package'].'%']); } if (!empty($this->parameters['packageDescription'])) { - $conditions->add("package_update.packageDescription LIKE ?", array('%'.$this->parameters['packageDescription'].'%')); + $conditions->add("package_update.packageDescription LIKE ?", ['%'.$this->parameters['packageDescription'].'%']); } if (!empty($this->parameters['packageName'])) { - $conditions->add("package_update.packageName LIKE ?", array('%'.$this->parameters['packageName'].'%')); + $conditions->add("package_update.packageName LIKE ?", ['%'.$this->parameters['packageName'].'%']); } $conditions->add("package.packageID IS NULL"); @@ -104,23 +104,23 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { ORDER BY package_update.packageName ASC"; $statement = WCF::getDB()->prepareStatement($sql, 1000); $statement->execute($conditions->getParameters()); - $packageUpdateIDs = array(); + $packageUpdateIDs = []; while ($row = $statement->fetchArray()) { $packageUpdateIDs[] = $row['packageUpdateID']; } // no matches found if (empty($packageUpdateIDs)) { - WCF::getTPL()->assign(array( - 'packageUpdates' => array() - )); + WCF::getTPL()->assign([ + 'packageUpdates' => [] + ]); - return array( + return [ 'count' => 0, 'pageCount' => 0, 'searchID' => 0, 'template' => WCF::getTPL()->fetch('packageSearchResultList') - ); + ]; } // get excluded packages @@ -128,7 +128,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_package_update_exclusion"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - $excludedPackages = array(); + $excludedPackages = []; while ($row = $statement->fetchArray()) { $package = $row['excludedPackage']; $packageVersion = $row['excludedPackageVersion']; @@ -147,14 +147,14 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_package"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - $installedPackages = array(); + $installedPackages = []; while ($row = $statement->fetchArray()) { $installedPackages[$row['package']] = $row['packageVersion']; } // filter by version $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("puv.packageUpdateID IN (?)", array($packageUpdateIDs)); + $conditions->add("puv.packageUpdateID IN (?)", [$packageUpdateIDs]); $sql = "SELECT pu.package, puv.packageUpdateVersionID, puv.packageUpdateID, puv.packageVersion, puv.isAccessible FROM wcf".WCF_N."_package_update_version puv LEFT JOIN wcf".WCF_N."_package_update pu @@ -162,7 +162,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $packageVersions = array(); + $packageVersions = []; while ($row = $statement->fetchArray()) { $package = $row['package']; $packageVersion = $row['packageVersion']; @@ -185,15 +185,15 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { } if (!isset($packageVersions[$package])) { - $packageVersions[$package] = array(); + $packageVersions[$package] = []; } $packageUpdateID = $row['packageUpdateID']; if (!isset($packageVersions[$package][$packageUpdateID])) { - $packageVersions[$package][$packageUpdateID] = array( - 'accessible' => array(), - 'existing' => array() - ); + $packageVersions[$package][$packageUpdateID] = [ + 'accessible' => [], + 'existing' => [] + ]; } if ($row['isAccessible']) { @@ -204,22 +204,22 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // all found versions are excluded if (empty($packageVersions)) { - WCF::getTPL()->assign(array( - 'packageUpdates' => array() - )); + WCF::getTPL()->assign([ + 'packageUpdates' => [] + ]); - return array( + return [ 'count' => 0, 'pageCount' => 0, 'searchID' => 0, 'template' => WCF::getTPL()->fetch('packageSearchResultList') - ); + ]; } // determine highest versions - $packageUpdates = array(); + $packageUpdates = []; foreach ($packageVersions as $package => $versionData) { - $accessible = $existing = $versions = array(); + $accessible = $existing = $versions = []; foreach ($versionData as $packageUpdateID => $versionTypes) { // ignore unaccessible packages @@ -227,8 +227,8 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { continue; } - uasort($versionTypes['accessible'], array('wcf\data\package\Package', 'compareVersion')); - uasort($versionTypes['existing'], array('wcf\data\package\Package', 'compareVersion')); + uasort($versionTypes['accessible'], ['wcf\data\package\Package', 'compareVersion']); + uasort($versionTypes['existing'], ['wcf\data\package\Package', 'compareVersion']); $accessibleVersion = array_slice($versionTypes['accessible'], -1, 1, true); $existingVersion = array_slice($versionTypes['existing'], -1, 1, true); @@ -249,43 +249,43 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { continue; } - uksort($accessible, array('wcf\data\package\Package', 'compareVersion')); - uksort($existing, array('wcf\data\package\Package', 'compareVersion')); + uksort($accessible, ['wcf\data\package\Package', 'compareVersion']); + uksort($existing, ['wcf\data\package\Package', 'compareVersion']); $accessible = array_pop($accessible); $existing = array_pop($existing); - $packageUpdates[$versions[$accessible]] = array( + $packageUpdates[$versions[$accessible]] = [ 'accessible' => $accessible, 'existing' => $existing - ); + ]; } // no found packages is accessible if (empty($packageUpdates)) { - WCF::getTPL()->assign(array( - 'packageUpdates' => array() - )); + WCF::getTPL()->assign([ + 'packageUpdates' => [] + ]); - return array( + return [ 'count' => 0, 'pageCount' => 0, 'searchID' => 0, 'template' => WCF::getTPL()->fetch('packageSearchResultList') - ); + ]; } - $search = SearchEditor::create(array( + $search = SearchEditor::create([ 'userID' => WCF::getUser()->userID, 'searchData' => serialize($packageUpdates), 'searchTime' => TIME_NOW, 'searchType' => 'acpPackageSearch' - )); + ]); // forward call to build the actual result list - $updateAction = new PackageUpdateAction(array(), 'getResultList', array( + $updateAction = new PackageUpdateAction([], 'getResultList', [ 'pageNo' => 1, 'search' => $search - )); + ]); $returnValues = $updateAction->executeAction(); return $returnValues['returnValues']; @@ -295,7 +295,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { * Validates parameters to return a result list for a previous search. */ public function validateGetResultList() { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canInstallPackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage']); $this->readInteger('pageNo'); $this->readInteger('searchID'); @@ -319,14 +319,14 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // get package updates $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("packageUpdateID IN (?)", array(array_keys($updateData))); + $conditions->add("packageUpdateID IN (?)", [array_keys($updateData)]); $sql = "SELECT * FROM wcf".WCF_N."_package_update ".$conditions; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); $statement->execute($conditions->getParameters()); - $packageUpdates = $packageVersionIDs = array(); + $packageUpdates = $packageVersionIDs = []; while ($packageUpdate = $statement->fetchObject('wcf\data\package\update\PackageUpdate')) { $packageUpdates[$packageUpdate->packageUpdateID] = new ViewablePackageUpdate($packageUpdate); @@ -338,14 +338,14 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // read update versions $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("packageUpdateVersionID IN (?)", array($packageVersionIDs)); + $conditions->add("packageUpdateVersionID IN (?)", [$packageVersionIDs]); $sql = "SELECT packageUpdateVersionID, packageVersion, packageDate, license, licenseURL FROM wcf".WCF_N."_package_update_version ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $updateVersions = array(); + $updateVersions = []; while ($updateVersion = $statement->fetchObject('wcf\data\package\update\version\PackageUpdateVersion')) { $updateVersions[$updateVersion->packageUpdateVersionID] = $updateVersion; } @@ -357,24 +357,24 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $packageUpdate->setLatestVersion($updateVersions[$versionIDs['existing']]); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'packageUpdates' => $packageUpdates - )); + ]); $count = count($updateData); - return array( + return [ 'count' => $count, 'pageCount' => ceil($count / 20), 'searchID' => $this->search->searchID, 'template' => WCF::getTPL()->fetch('packageSearchResultList') - ); + ]; } /** * Validates permissions to search for updates. */ public function validateSearchForUpdates() { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canUpdatePackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canUpdatePackage']); $this->readBoolean('ignoreCache', true); } @@ -385,7 +385,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { * @return array */ public function searchForUpdates() { - PackageUpdateDispatcher::getInstance()->refreshPackageDatabase(array(), $this->parameters['ignoreCache']); + PackageUpdateDispatcher::getInstance()->refreshPackageDatabase([], $this->parameters['ignoreCache']); $updates = PackageUpdateDispatcher::getInstance()->getAvailableUpdates(); $url = ''; @@ -393,16 +393,16 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $url = LinkHandler::getInstance()->getLink('PackageUpdate'); } - return array( + return [ 'url' => $url - ); + ]; } /** * Validates parameters to perform a system update. */ public function validatePrepareUpdate() { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canUpdatePackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canUpdatePackage']); if (!isset($this->parameters['packages']) || !is_array($this->parameters['packages'])) { throw new UserInputException('packages'); @@ -453,7 +453,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { * Validates parameters to prepare a package installation. */ public function validatePrepareInstallation() { - WCF::getSession()->checkPermissions(array('admin.configuration.package.canInstallPackage')); + WCF::getSession()->checkPermissions(['admin.configuration.package.canInstallPackage']); if (!isset($this->parameters['packages']) || !is_array($this->parameters['packages']) || count($this->parameters['packages']) != 1) { throw new UserInputException('packages'); @@ -497,9 +497,9 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $scheduler->buildPackageInstallationStack(($queueType == 'install')); } catch (PackageUpdateUnauthorizedException $e) { - return array( + return [ 'template' => $e->getRenderedTemplate() - ); + ]; } // validate exclusions @@ -507,10 +507,10 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $excludedPackages = $scheduler->getExcludedPackages(); if (!empty($excludedPackages)) { - return array( + return [ 'excludedPackages' => true, - 'template' => WCF::getTPL()->fetch('packageUpdateExcludedPackages', 'wcf', array('excludedPackages' => $excludedPackages)) - ); + 'template' => WCF::getTPL()->fetch('packageUpdateExcludedPackages', 'wcf', ['excludedPackages' => $excludedPackages]) + ]; } } @@ -520,7 +520,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $parentQueueID = 0; $processNo = PackageInstallationQueue::getNewProcessNo(); foreach ($stack as $package) { - $queue = PackageInstallationQueueEditor::create(array( + $queue = PackageInstallationQueueEditor::create([ 'parentQueueID' => $parentQueueID, 'processNo' => $processNo, 'userID' => WCF::getUser()->userID, @@ -529,7 +529,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { 'packageID' => ($package['packageID'] ?: null), 'archive' => $package['archive'], 'action' => $package['action'] - )); + ]); $parentQueueID = $queue->queueID; if ($queueID === null) { @@ -538,8 +538,8 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { } } - return array( + return [ 'queueID' => $queueID - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php index 12dc7677a7..cf3a7d813a 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php @@ -22,22 +22,22 @@ class PackageUpdateServerAction extends AbstractDatabaseObjectAction implements /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.configuration.package.canEditServer'); + protected $permissionsCreate = ['admin.configuration.package.canEditServer']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.configuration.package.canEditServer'); + protected $permissionsDelete = ['admin.configuration.package.canEditServer']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.configuration.package.canEditServer'); + protected $permissionsUpdate = ['admin.configuration.package.canEditServer']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update'); + protected $requireACP = ['create', 'delete', 'toggle', 'update']; /** * @see \wcf\data\IToggleAction::validateToggle() @@ -51,7 +51,7 @@ class PackageUpdateServerAction extends AbstractDatabaseObjectAction implements */ public function toggle() { foreach ($this->objects as $server) { - $server->update(array('isDisabled' => ($server->isDisabled) ? 0 : 1)); + $server->update(['isDisabled' => ($server->isDisabled) ? 0 : 1]); } } } diff --git a/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscription.class.php b/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscription.class.php index 2fec461a23..04efb91912 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscription.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscription.class.php @@ -47,7 +47,7 @@ class PaidSubscription extends DatabaseObject { */ public function getPurchaseButtons() { $objectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.payment.type', 'com.woltlab.wcf.payment.type.paidSubscription'); - $buttons = array(); + $buttons = []; foreach (PaymentMethodHandler::getInstance()->getPaymentMethods() as $paymentMethod) { // check if payment method supports recurring payments if ($this->isRecurring && !$paymentMethod->supportsRecurringPayments()) continue; diff --git a/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php b/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php index cd49e40e85..08cca11bab 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/PaidSubscriptionAction.class.php @@ -17,17 +17,17 @@ class PaidSubscriptionAction extends AbstractDatabaseObjectAction implements ITo /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.paidSubscription.canManageSubscription'); + protected $permissionsDelete = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.paidSubscription.canManageSubscription'); + protected $permissionsUpdate = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update'); + protected $requireACP = ['create', 'delete', 'toggle', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -62,9 +62,9 @@ class PaidSubscriptionAction extends AbstractDatabaseObjectAction implements ITo */ public function toggle() { foreach ($this->objects as $object) { - $object->update(array( + $object->update([ 'isDisabled' => $object->isDisabled ? 0 : 1 - )); + ]); } } diff --git a/wcfsetup/install/files/lib/data/paid/subscription/transaction/log/PaidSubscriptionTransactionLog.class.php b/wcfsetup/install/files/lib/data/paid/subscription/transaction/log/PaidSubscriptionTransactionLog.class.php index 2b36203ce6..68803b1425 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/transaction/log/PaidSubscriptionTransactionLog.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/transaction/log/PaidSubscriptionTransactionLog.class.php @@ -107,7 +107,7 @@ class PaidSubscriptionTransactionLog extends DatabaseObject { WHERE paymentMethodObjectTypeID = ? AND transactionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($paymentMethodObjectTypeID, $transactionID)); + $statement->execute([$paymentMethodObjectTypeID, $transactionID]); $row = $statement->fetchArray(); if ($row !== false) { return new PaidSubscriptionTransactionLog(null, $row); diff --git a/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUser.class.php b/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUser.class.php index 1bfed0864b..fa923fd918 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUser.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUser.class.php @@ -73,7 +73,7 @@ class PaidSubscriptionUser extends DatabaseObject { WHERE subscriptionID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($subscriptionID, $userID)); + $statement->execute([$subscriptionID, $userID]); $row = $statement->fetchArray(); if ($row !== false) { return new PaidSubscriptionUser(null, $row); diff --git a/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php b/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php index a8dc5a5a46..20f3629643 100644 --- a/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php +++ b/wcfsetup/install/files/lib/data/paid/subscription/user/PaidSubscriptionUserAction.class.php @@ -22,17 +22,17 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.paidSubscription.canManageSubscription'); + protected $permissionsDelete = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.paidSubscription.canManageSubscription'); + protected $permissionsUpdate = ['admin.paidSubscription.canManageSubscription']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -56,7 +56,7 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $subscriptionUser = parent::create(); // update group memberships - $action = new PaidSubscriptionUserAction(array($subscriptionUser), 'addGroupMemberships'); + $action = new PaidSubscriptionUserAction([$subscriptionUser], 'addGroupMemberships'); $action->executeAction(); return $subscriptionUser; @@ -98,14 +98,14 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { $endDate = $this->parameters['data']['endDate']; } - $subscriptionUser->update(array( + $subscriptionUser->update([ 'endDate' => $endDate, 'isActive' => 1 - )); + ]); if (!$subscriptionUser->isActive) { // update group memberships - $action = new PaidSubscriptionUserAction(array($subscriptionUser), 'addGroupMemberships'); + $action = new PaidSubscriptionUserAction([$subscriptionUser], 'addGroupMemberships'); $action->executeAction(); } } @@ -129,10 +129,10 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { } foreach ($this->objects as $subscriptionUser) { - $subscriptionUser->update(array('isActive' => 0)); + $subscriptionUser->update(['isActive' => 0]); // update group memberships - $action = new PaidSubscriptionUserAction(array($subscriptionUser), 'removeGroupMemberships'); + $action = new PaidSubscriptionUserAction([$subscriptionUser], 'removeGroupMemberships'); $action->executeAction(); } } @@ -161,10 +161,10 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { } foreach ($this->objects as $subscriptionUser) { - $subscriptionUser->update(array('isActive' => 1)); + $subscriptionUser->update(['isActive' => 1]); // update group memberships - $action = new PaidSubscriptionUserAction(array($subscriptionUser), 'addGroupMemberships'); + $action = new PaidSubscriptionUserAction([$subscriptionUser], 'addGroupMemberships'); $action->executeAction(); } } @@ -193,18 +193,18 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { } foreach ($this->objects as $subscriptionUser) { - $groupIDs = array(); + $groupIDs = []; foreach (explode(',', $subscriptionUser->getSubscription()->groupIDs) as $groupID) { if (UserGroup::getGroupByID($groupID) !== null) { $groupIDs[] = $groupID; } } if (!empty($groupIDs)) { - $action = new UserAction(array($subscriptionUser->userID), 'addToGroups', array( + $action = new UserAction([$subscriptionUser->userID], 'addToGroups', [ 'groups' => $groupIDs, 'deleteOldGroups' => false, 'addDefaultGroups' => false - )); + ]); $action->executeAction(); } } @@ -219,16 +219,16 @@ class PaidSubscriptionUserAction extends AbstractDatabaseObjectAction { } foreach ($this->objects as $subscriptionUser) { - $groupIDs = array(); + $groupIDs = []; foreach (explode(',', $subscriptionUser->getSubscription()->groupIDs) as $groupID) { if (UserGroup::getGroupByID($groupID) !== null) { $groupIDs[] = $groupID; } } if (!empty($groupIDs)) { - $action = new UserAction(array($subscriptionUser->userID), 'removeFromGroups', array( + $action = new UserAction([$subscriptionUser->userID], 'removeFromGroups', [ 'groups' => $groupIDs, - )); + ]); $action->executeAction(); } } diff --git a/wcfsetup/install/files/lib/data/poll/Poll.class.php b/wcfsetup/install/files/lib/data/poll/Poll.class.php index e411a6ee7e..71011a0e20 100644 --- a/wcfsetup/install/files/lib/data/poll/Poll.class.php +++ b/wcfsetup/install/files/lib/data/poll/Poll.class.php @@ -50,7 +50,7 @@ class Poll extends DatabaseObject { * list of poll options * @var PollOption[] */ - protected $options = array(); + protected $options = []; /** * related object @@ -120,7 +120,7 @@ class Poll extends DatabaseObject { return; } - $optionList = PollManager::getInstance()->getPollOptions(array($this->pollID)); + $optionList = PollManager::getInstance()->getPollOptions([$this->pollID]); foreach ($optionList as $option) { $this->options[$option->optionID] = $option; diff --git a/wcfsetup/install/files/lib/data/poll/PollAction.class.php b/wcfsetup/install/files/lib/data/poll/PollAction.class.php index e99613d613..a44894cdf4 100644 --- a/wcfsetup/install/files/lib/data/poll/PollAction.class.php +++ b/wcfsetup/install/files/lib/data/poll/PollAction.class.php @@ -24,7 +24,7 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getGroupedUserList'); + protected $allowGuestAccess = ['getGroupedUserList']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$className @@ -54,11 +54,11 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WCF::getDB()->beginTransaction(); foreach ($this->parameters['options'] as $showOrder => $option) { - $statement->execute(array( + $statement->execute([ $poll->pollID, $option['optionValue'], $showOrder - )); + ]); } WCF::getDB()->commitTransaction(); @@ -76,31 +76,31 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis // get current options $optionList = new PollOptionList(); - $optionList->getConditionBuilder()->add("poll_option.pollID = ?", array($pollEditor->pollID)); + $optionList->getConditionBuilder()->add("poll_option.pollID = ?", [$pollEditor->pollID]); $optionList->sqlOrderBy = "poll_option.showOrder ASC"; $optionList->readObjects(); $options = $optionList->getObjects(); - $newOptions = $updateOptions = array(); + $newOptions = $updateOptions = []; foreach ($this->parameters['options'] as $showOrder => $option) { // check if editing an existing option if ($option['optionID']) { // check if an update is required if ($options[$option['optionID']]->showOrder != $showOrder || $options[$option['optionID']]->optionValue != $option['optionValue']) { - $updateOptions[$option['optionID']] = array( + $updateOptions[$option['optionID']] = [ 'optionValue' => $option['optionValue'], 'showOrder' => $showOrder - ); + ]; } // remove option unset($options[$option['optionID']]); } else { - $newOptions[] = array( + $newOptions[] = [ 'optionValue' => $option['optionValue'], 'showOrder' => $showOrder - ); + ]; } } @@ -114,11 +114,11 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($newOptions as $option) { - $statement->execute(array( + $statement->execute([ $pollEditor->pollID, $option['optionValue'], $option['showOrder'] - )); + ]); } } @@ -130,11 +130,11 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($updateOptions as $optionID => $option) { - $statement->execute(array( + $statement->execute([ $option['optionValue'], $option['showOrder'], $optionID - )); + ]); } } @@ -144,7 +144,7 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($options as $option) { - $statement->execute(array($option->optionID)); + $statement->execute([$option->optionID]); } } @@ -167,12 +167,12 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE pollID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $poll->pollID, WCF::getUser()->userID - )); + ]); $alreadyVoted = false; - $optionIDs = array(); + $optionIDs = []; while ($row = $statement->fetchArray()) { $alreadyVoted = true; $optionIDs[] = $row['optionID']; @@ -195,11 +195,11 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($this->parameters['optionIDs'] as $optionID) { - $statement->execute(array( + $statement->execute([ $poll->pollID, $optionID, WCF::getUser()->userID - )); + ]); } // increase votes per option @@ -208,7 +208,7 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($this->parameters['optionIDs'] as $optionID) { - $statement->execute(array($optionID)); + $statement->execute([$optionID]); } } @@ -219,10 +219,10 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($optionIDs as $optionID) { - $statement->execute(array( + $statement->execute([ $optionID, WCF::getUser()->userID - )); + ]); } // decrease votes per option @@ -231,7 +231,7 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($optionIDs as $optionID) { - $statement->execute(array($optionID)); + $statement->execute([$optionID]); } } @@ -267,8 +267,8 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE pollID = ? ORDER BY ".($this->poll->sortByVotes ? "votes DESC" : "showOrder ASC"); $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->poll->pollID)); - $options = array(); + $statement->execute([$this->poll->pollID]); + $options = []; while ($row = $statement->fetchArray()) { $options[$row['optionID']] = new GroupedUserList($row['optionValue'], 'wcf.poll.noVotes'); } @@ -278,11 +278,11 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis FROM wcf".WCF_N."_poll_option_vote WHERE pollID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->poll->pollID)); - $voteData = array(); + $statement->execute([$this->poll->pollID]); + $voteData = []; while ($row = $statement->fetchArray()) { if (!isset($voteData[$row['optionID']])) { - $voteData[$row['optionID']] = array(); + $voteData[$row['optionID']] = []; } $voteData[$row['optionID']][] = $row['userID']; @@ -296,14 +296,14 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis // load user profiles GroupedUserList::loadUsers(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'groupedUsers' => $options - )); + ]); - return array( + return [ 'pageCount' => 1, 'template' => WCF::getTPL()->fetch('groupedUserList') - ); + ]; } /** @@ -323,21 +323,21 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $sourceObjectType->objectTypeID, $this->parameters['sourceObjectID'] - )); + ]); $row = $statement->fetchArray(); if ($row === false) { - return array( + return [ 'pollID' => null - ); + ]; } // get options $pollOptionList = new PollOptionList(); - $pollOptionList->getConditionBuilder()->add("poll_option.pollID = ?", array($row['pollID'])); + $pollOptionList->getConditionBuilder()->add("poll_option.pollID = ?", [$row['pollID']]); $pollOptionList->readObjects(); // @@ -353,14 +353,14 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis $newPoll = PollEditor::create($pollData); // create options - $newOptionIDs = array(); + $newOptionIDs = []; foreach ($pollOptionList as $pollOption) { - $newOption = PollOptionEditor::create(array( + $newOption = PollOptionEditor::create([ 'pollID' => $newPoll->pollID, 'optionValue' => $pollOption->optionValue, 'votes' => $pollOption->votes, 'showOrder' => $pollOption->showOrder - )); + ]); $newOptionIDs[$pollOption->optionID] = $newOption->optionID; } @@ -374,12 +374,12 @@ class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserLis FROM wcf".WCF_N."_poll_option_vote WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($oldOptionID)); + $statement->execute([$oldOptionID]); } WCF::getDB()->commitTransaction(); - return array( + return [ 'pollID' => $newPoll->pollID - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/search/keyword/SearchKeywordAction.class.php b/wcfsetup/install/files/lib/data/search/keyword/SearchKeywordAction.class.php index 0d530b9fe8..c5cb182a71 100644 --- a/wcfsetup/install/files/lib/data/search/keyword/SearchKeywordAction.class.php +++ b/wcfsetup/install/files/lib/data/search/keyword/SearchKeywordAction.class.php @@ -23,7 +23,7 @@ class SearchKeywordAction extends AbstractDatabaseObjectAction implements ISearc /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getSearchResultList'); + protected $allowGuestAccess = ['getSearchResultList']; /** * @see \wcf\data\ISearchAction::validateGetSearchResultList() @@ -36,7 +36,7 @@ class SearchKeywordAction extends AbstractDatabaseObjectAction implements ISearc * @see \wcf\data\ISearchAction::getSearchResultList() */ public function getSearchResultList() { - $list = array(); + $list = []; // find users $sql = "SELECT * @@ -44,12 +44,12 @@ class SearchKeywordAction extends AbstractDatabaseObjectAction implements ISearc WHERE keyword LIKE ? ORDER BY searches DESC"; $statement = WCF::getDB()->prepareStatement($sql, 10); - $statement->execute(array($this->parameters['data']['searchString'].'%')); + $statement->execute([$this->parameters['data']['searchString'].'%']); while ($row = $statement->fetchArray()) { - $list[] = array( + $list[] = [ 'label' => $row['keyword'], 'objectID' => $row['keywordID'] - ); + ]; } return $list; diff --git a/wcfsetup/install/files/lib/data/session/SessionAction.class.php b/wcfsetup/install/files/lib/data/session/SessionAction.class.php index e55c4c8fa0..b3a8fc276e 100644 --- a/wcfsetup/install/files/lib/data/session/SessionAction.class.php +++ b/wcfsetup/install/files/lib/data/session/SessionAction.class.php @@ -20,7 +20,7 @@ class SessionAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('keepAlive'); + protected $allowGuestAccess = ['keepAlive']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$className @@ -31,7 +31,7 @@ class SessionAction extends AbstractDatabaseObjectAction { * list of data values returned upon a keep alive request * @var mixed[] */ - public $keepAliveData = array(); + public $keepAliveData = []; /** * Validates the 'keepAlive' action. @@ -56,9 +56,9 @@ class SessionAction extends AbstractDatabaseObjectAction { SessionHandler::getInstance()->keepAlive(); // update notification counts - $this->keepAliveData = array( + $this->keepAliveData = [ 'userNotificationCount' => UserNotificationHandler::getInstance()->getNotificationCount(true) - ); + ]; // notify 3rd party components EventHandler::getInstance()->fireAction($this, 'keepAlive'); diff --git a/wcfsetup/install/files/lib/data/sitemap/SitemapAction.class.php b/wcfsetup/install/files/lib/data/sitemap/SitemapAction.class.php index 83a21decaf..064f2c35f5 100644 --- a/wcfsetup/install/files/lib/data/sitemap/SitemapAction.class.php +++ b/wcfsetup/install/files/lib/data/sitemap/SitemapAction.class.php @@ -18,7 +18,7 @@ class SitemapAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getSitemap'); + protected $allowGuestAccess = ['getSitemap']; /** * Validates the 'getSitemap' action. @@ -36,24 +36,24 @@ class SitemapAction extends AbstractDatabaseObjectAction { */ public function getSitemap() { if (isset($this->parameters['sitemapName'])) { - return array( + return [ 'sitemapName' => $this->parameters['sitemapName'], 'template' => SitemapHandler::getInstance()->getSitemap($this->parameters['sitemapName']) - ); + ]; } else { $sitemapName = SitemapHandler::getInstance()->getDefaultSitemapName(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'defaultSitemapName' => $sitemapName, 'sitemap' => SitemapHandler::getInstance()->getSitemap($sitemapName), 'tree' => SitemapHandler::getInstance()->getTree() - )); + ]); - return array( + return [ 'sitemapName' => $sitemapName, 'template' => WCF::getTPL()->fetch('sitemap') - ); + ]; } } } diff --git a/wcfsetup/install/files/lib/data/smiley/Smiley.class.php b/wcfsetup/install/files/lib/data/smiley/Smiley.class.php index bc028c01d9..853bd14e5a 100644 --- a/wcfsetup/install/files/lib/data/smiley/Smiley.class.php +++ b/wcfsetup/install/files/lib/data/smiley/Smiley.class.php @@ -49,7 +49,7 @@ class Smiley extends DatabaseObject { * @return string[] */ public function getAliases() { - if (!$this->aliases) return array(); + if (!$this->aliases) return []; return explode("\n", StringUtil::unifyNewlines($this->aliases)); } diff --git a/wcfsetup/install/files/lib/data/smiley/SmileyAction.class.php b/wcfsetup/install/files/lib/data/smiley/SmileyAction.class.php index d7769374b7..7a80ec8b4b 100644 --- a/wcfsetup/install/files/lib/data/smiley/SmileyAction.class.php +++ b/wcfsetup/install/files/lib/data/smiley/SmileyAction.class.php @@ -25,17 +25,17 @@ class SmileyAction extends AbstractDatabaseObjectAction implements ISortableActi /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.content.smiley.canManageSmiley'); + protected $permissionsDelete = ['admin.content.smiley.canManageSmiley']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.content.smiley.canManageSmiley'); + protected $permissionsUpdate = ['admin.content.smiley.canManageSmiley']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('delete', 'update', 'updatePosition'); + protected $requireACP = ['delete', 'update', 'updatePosition']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -48,9 +48,9 @@ class SmileyAction extends AbstractDatabaseObjectAction implements ISortableActi @rename($this->parameters['fileLocation'], WCF_DIR.'images/smilies/'.$smileyFilename); $smileyEditor = new SmileyEditor($smiley); - $smileyEditor->update(array( + $smileyEditor->update([ 'smileyPath' => 'images/smilies/'.$smileyFilename - )); + ]); $smiley = new Smiley($smiley->smileyID); } @@ -110,7 +110,7 @@ class SmileyAction extends AbstractDatabaseObjectAction implements ISortableActi if ($smiley === null) continue; $editor = new SmileyEditor($smiley); - $editor->update(array('showOrder' => $i++)); + $editor->update(['showOrder' => $i++]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php b/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php index 0a1343c4b7..2ee225f7db 100644 --- a/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php +++ b/wcfsetup/install/files/lib/data/smiley/SmileyCache.class.php @@ -21,13 +21,13 @@ class SmileyCache extends SingletonFactory { * cached smilies * @var array */ - protected $cachedSmilies = array(); + protected $cachedSmilies = []; /** * cached smiley categories * @var SmileyCategory[] */ - protected $cachedCategories = array(); + protected $cachedCategories = []; /** * enabled smiley categories with at least one smiley @@ -40,17 +40,17 @@ class SmileyCache extends SingletonFactory { */ protected function init() { // get smiley cache - $this->cachedSmilies = SmileyCacheBuilder::getInstance()->getData(array(), 'smilies'); + $this->cachedSmilies = SmileyCacheBuilder::getInstance()->getData([], 'smilies'); $smileyCategories = CategoryHandler::getInstance()->getCategories('com.woltlab.wcf.bbcode.smiley'); - $this->cachedCategories[null] = new SmileyCategory(new Category(null, array( + $this->cachedCategories[null] = new SmileyCategory(new Category(null, [ 'categoryID' => null, 'parentCategoryID' => 0, 'title' => 'wcf.acp.smiley.categoryID.default', 'description' => '', 'showOrder' => -1, 'isDisabled' => 0 - ))); + ])); foreach ($smileyCategories as $key => $smileyCategory) { $this->cachedCategories[$key] = new SmileyCategory($smileyCategory); @@ -82,7 +82,7 @@ class SmileyCache extends SingletonFactory { */ public function getVisibleCategories() { if ($this->visibleCategories === null) { - $this->visibleCategories = array(); + $this->visibleCategories = []; foreach ($this->cachedCategories as $key => $category) { if (!$category->isDisabled) { @@ -107,6 +107,6 @@ class SmileyCache extends SingletonFactory { public function getCategorySmilies($categoryID = null) { if (isset($this->cachedSmilies[$categoryID])) return $this->cachedSmilies[$categoryID]; - return array(); + return []; } } diff --git a/wcfsetup/install/files/lib/data/smiley/category/SmileyCategoryAction.class.php b/wcfsetup/install/files/lib/data/smiley/category/SmileyCategoryAction.class.php index ddf14c798b..1245f8045e 100644 --- a/wcfsetup/install/files/lib/data/smiley/category/SmileyCategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/smiley/category/SmileyCategoryAction.class.php @@ -23,7 +23,7 @@ class SmileyCategoryAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getSmilies'); + protected $allowGuestAccess = ['getSmilies']; /** * active smiley category @@ -48,13 +48,13 @@ class SmileyCategoryAction extends AbstractDatabaseObjectAction { public function getSmilies() { $this->smileyCategory->loadSmilies(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'smilies' => $this->smileyCategory - )); + ]); - return array( + return [ 'smileyCategoryID' => $this->smileyCategory->categoryID, 'template' => WCF::getTPL()->fetch('__messageFormSmilies') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php b/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php index 8eb8a73acb..53fc9264e2 100644 --- a/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php +++ b/wcfsetup/install/files/lib/data/stat/daily/StatDailyAction.class.php @@ -26,7 +26,7 @@ class StatDailyAction extends AbstractDatabaseObjectAction { * Validates the getData action. */ public function validateGetData() { - WCF::getSession()->checkPermissions(array('admin.management.canViewLog')); + WCF::getSession()->checkPermissions(['admin.management.canViewLog']); // validate start date if (empty($this->parameters['startDate']) || !preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $this->parameters['startDate'])) { @@ -57,10 +57,10 @@ class StatDailyAction extends AbstractDatabaseObjectAction { * Returns the stat data. */ public function getData() { - $data = array(); + $data = []; $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('objectTypeID IN (?)', array($this->parameters['objectTypeIDs'])); - $conditionBuilder->add('date BETWEEN ? AND ?', array($this->parameters['startDate'], $this->parameters['endDate'])); + $conditionBuilder->add('objectTypeID IN (?)', [$this->parameters['objectTypeIDs']]); + $conditionBuilder->add('date BETWEEN ? AND ?', [$this->parameters['startDate'], $this->parameters['endDate']]); $limit = 0; if ($this->parameters['dateGrouping'] == 'yearly') { @@ -102,13 +102,13 @@ class StatDailyAction extends AbstractDatabaseObjectAction { $objectType = ObjectTypeCache::getInstance()->getObjectType($row['objectTypeID']); if (!isset($data[$row['objectTypeID']])) { - $data[$row['objectTypeID']] = array( + $data[$row['objectTypeID']] = [ 'label' => WCF::getLanguage()->get('wcf.acp.stat.'.$objectType->objectType), - 'data' => array() - ); + 'data' => [] + ]; } - $data[$row['objectTypeID']]['data'][] = array(strtotime($row['date'] . ' UTC'), $objectType->getProcessor()->getFormattedCounter($value)); + $data[$row['objectTypeID']]['data'][] = [strtotime($row['date'] . ' UTC'), $objectType->getProcessor()->getFormattedCounter($value)]; } return $data; diff --git a/wcfsetup/install/files/lib/data/style/Style.class.php b/wcfsetup/install/files/lib/data/style/Style.class.php index 462ad4a56b..f76b400a4f 100644 --- a/wcfsetup/install/files/lib/data/style/Style.class.php +++ b/wcfsetup/install/files/lib/data/style/Style.class.php @@ -46,7 +46,7 @@ class Style extends DatabaseObject { * list of style variables * @var string[] */ - protected $variables = array(); + protected $variables = []; const PREVIEW_IMAGE_MAX_HEIGHT = 64; const PREVIEW_IMAGE_MAX_WIDTH = 102; @@ -104,7 +104,7 @@ class Style extends DatabaseObject { ON (value.variableID = variable.variableID AND value.styleID = ?) ORDER BY variable.variableID ASC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->styleID)); + $statement->execute([$this->styleID]); while ($row = $statement->fetchArray()) { $variableName = $row['variableName']; $variableValue = (isset($row['variableValue'])) ? $row['variableValue'] : $row['defaultValue']; diff --git a/wcfsetup/install/files/lib/data/tag/Tag.class.php b/wcfsetup/install/files/lib/data/tag/Tag.class.php index d0e8a0bc00..6b9910c5c0 100644 --- a/wcfsetup/install/files/lib/data/tag/Tag.class.php +++ b/wcfsetup/install/files/lib/data/tag/Tag.class.php @@ -44,7 +44,7 @@ class Tag extends DatabaseObject implements IRouteController { WHERE languageID = ? AND name = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($languageID, $name)); + $statement->execute([$languageID, $name]); $row = $statement->fetchArray(); if ($row !== false) return new Tag(null, $row); diff --git a/wcfsetup/install/files/lib/data/tag/TagAction.class.php b/wcfsetup/install/files/lib/data/tag/TagAction.class.php index c41754f2e0..fc6e4ce7e8 100644 --- a/wcfsetup/install/files/lib/data/tag/TagAction.class.php +++ b/wcfsetup/install/files/lib/data/tag/TagAction.class.php @@ -21,7 +21,7 @@ class TagAction extends AbstractDatabaseObjectAction implements ISearchAction { /** * @see \wcf\data\AbstractDatabaseObjectAction */ - protected $allowGuestAccess = array('getSearchResultList'); + protected $allowGuestAccess = ['getSearchResultList']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$className @@ -31,17 +31,17 @@ class TagAction extends AbstractDatabaseObjectAction implements ISearchAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.content.tag.canManageTag'); + protected $permissionsDelete = ['admin.content.tag.canManageTag']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.content.tag.canManageTag'); + protected $permissionsUpdate = ['admin.content.tag.canManageTag']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('delete', 'update'); + protected $requireACP = ['delete', 'update']; /** * tag for which other tags will be used as synonyms @@ -64,16 +64,16 @@ class TagAction extends AbstractDatabaseObjectAction implements ISearchAction { * @see \wcf\data\ISearchAction::getSearchResultList() */ public function getSearchResultList() { - $excludedSearchValues = array(); + $excludedSearchValues = []; if (isset($this->parameters['data']['excludedSearchValues'])) { $excludedSearchValues = $this->parameters['data']['excludedSearchValues']; } - $list = array(); + $list = []; $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add("name LIKE ?", array($this->parameters['data']['searchString'].'%')); + $conditionBuilder->add("name LIKE ?", [$this->parameters['data']['searchString'].'%']); if (!empty($excludedSearchValues)) { - $conditionBuilder->add("name NOT IN (?)", array($excludedSearchValues)); + $conditionBuilder->add("name NOT IN (?)", [$excludedSearchValues]); } // find tags @@ -83,10 +83,10 @@ class TagAction extends AbstractDatabaseObjectAction implements ISearchAction { $statement = WCF::getDB()->prepareStatement($sql, 5); $statement->execute($conditionBuilder->getParameters()); while ($row = $statement->fetchArray()) { - $list[] = array( + $list[] = [ 'label' => $row['name'], 'objectID' => $row['tagID'] - ); + ]; } return $list; @@ -151,7 +151,7 @@ class TagAction extends AbstractDatabaseObjectAction implements ISearchAction { * @param integer[] $tagIDs * @since 2.2 */ - protected function unmarkItems(array $tagIDs = array()) { + protected function unmarkItems(array $tagIDs = []) { if (empty($tagIDs)) { $tagIDs = $this->objectIDs; } diff --git a/wcfsetup/install/files/lib/data/template/Template.class.php b/wcfsetup/install/files/lib/data/template/Template.class.php index 386b83d94e..0213ed0ca6 100644 --- a/wcfsetup/install/files/lib/data/template/Template.class.php +++ b/wcfsetup/install/files/lib/data/template/Template.class.php @@ -48,7 +48,7 @@ class Template extends DatabaseObject { ON (package.packageID = template.packageID) WHERE template.templateID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($id)); + $statement->execute([$id]); $row = $statement->fetchArray(); if ($row !== false) { @@ -63,7 +63,7 @@ class Template extends DatabaseObject { $row['packageDir'] = PackageCache::getInstance()->getPackage($application->packageID)->packageDir; } else { - $row = array(); + $row = []; } } else if ($object !== null) { diff --git a/wcfsetup/install/files/lib/data/template/TemplateAction.class.php b/wcfsetup/install/files/lib/data/template/TemplateAction.class.php index 65bb2fefa3..9f1703eb42 100644 --- a/wcfsetup/install/files/lib/data/template/TemplateAction.class.php +++ b/wcfsetup/install/files/lib/data/template/TemplateAction.class.php @@ -22,22 +22,22 @@ class TemplateAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.template.canManageTemplate'); + protected $permissionsCreate = ['admin.template.canManageTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.template.canManageTemplate'); + protected $permissionsDelete = ['admin.template.canManageTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.template.canManageTemplate'); + protected $permissionsUpdate = ['admin.template.canManageTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() diff --git a/wcfsetup/install/files/lib/data/template/group/TemplateGroup.class.php b/wcfsetup/install/files/lib/data/template/group/TemplateGroup.class.php index 663a0d8c66..8acd1a623d 100644 --- a/wcfsetup/install/files/lib/data/template/group/TemplateGroup.class.php +++ b/wcfsetup/install/files/lib/data/template/group/TemplateGroup.class.php @@ -40,9 +40,9 @@ class TemplateGroup extends DatabaseObject { * @param integer $initialDepth Specifies the initial indentation depth of the list * @return array */ - public static function getSelectList($ignore = array(), $initialDepth = 0) { + public static function getSelectList($ignore = [], $initialDepth = 0) { if (self::$templateGroupStructure === null) { - self::$templateGroupStructure = array(); + self::$templateGroupStructure = []; $sql = "SELECT templateGroupID, templateGroupName, parentTemplateGroupID FROM wcf".WCF_N."_template_group @@ -54,7 +54,7 @@ class TemplateGroup extends DatabaseObject { } } - self::$selectList = array(); + self::$selectList = []; self::makeSelectList(0, $initialDepth, $ignore); return self::$selectList; @@ -67,7 +67,7 @@ class TemplateGroup extends DatabaseObject { * @param integer $depth current list depth * @param array $ignore list of template group ids to ignore in result */ - protected static function makeSelectList($parentID = 0, $depth = 0, $ignore = array()) { + protected static function makeSelectList($parentID = 0, $depth = 0, $ignore = []) { if (!isset(self::$templateGroupStructure[$parentID ?: 0])) return; foreach (self::$templateGroupStructure[$parentID ?: 0] as $templateGroup) { diff --git a/wcfsetup/install/files/lib/data/template/group/TemplateGroupAction.class.php b/wcfsetup/install/files/lib/data/template/group/TemplateGroupAction.class.php index 5cf8de5259..d0186c00c9 100644 --- a/wcfsetup/install/files/lib/data/template/group/TemplateGroupAction.class.php +++ b/wcfsetup/install/files/lib/data/template/group/TemplateGroupAction.class.php @@ -21,20 +21,20 @@ class TemplateGroupAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.template.canManageTemplate'); + protected $permissionsCreate = ['admin.template.canManageTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.template.canManageTemplate'); + protected $permissionsDelete = ['admin.template.canManageTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.template.canManageTemplate'); + protected $permissionsUpdate = ['admin.template.canManageTemplate']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; } diff --git a/wcfsetup/install/files/lib/data/user/TeamList.class.php b/wcfsetup/install/files/lib/data/user/TeamList.class.php index c4ed80279a..60bb1a7170 100644 --- a/wcfsetup/install/files/lib/data/user/TeamList.class.php +++ b/wcfsetup/install/files/lib/data/user/TeamList.class.php @@ -19,7 +19,7 @@ class TeamList extends UserProfileList { * teams included in the list * @var Team[] */ - protected $teams = array(); + protected $teams = []; /** * @see \wcf\data\DatabaseObjectList::countObjects() @@ -40,7 +40,7 @@ class TeamList extends UserProfileList { * @see \wcf\data\DatabaseObjectList::readObjectIDs() */ public function readObjectIDs() { - $this->objectIDs = array(); + $this->objectIDs = []; $sql = "SELECT user_to_group.userID AS objectID FROM wcf".WCF_N."_user_group user_group, wcf".WCF_N."_user_to_group user_to_group diff --git a/wcfsetup/install/files/lib/data/user/UserBirthdayAction.class.php b/wcfsetup/install/files/lib/data/user/UserBirthdayAction.class.php index ba10a6d01f..4abf03dbc7 100644 --- a/wcfsetup/install/files/lib/data/user/UserBirthdayAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserBirthdayAction.class.php @@ -20,7 +20,7 @@ class UserBirthdayAction extends UserProfileAction implements IGroupedUserListAc /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getGroupedUserList'); + protected $allowGuestAccess = ['getGroupedUserList']; /** * @see \wcf\data\IGroupedUserListAction::validateGetGroupedUserList() @@ -44,8 +44,8 @@ class UserBirthdayAction extends UserProfileAction implements IGroupedUserListAc if (isset($value[2])) $day = intval($value[2]); // get users - $users = array(); - $userOptions = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); + $users = []; + $userOptions = UserOptionCacheBuilder::getInstance()->getData([], 'options'); if (isset($userOptions['birthday'])) { $birthdayUserOption = $userOptions['birthday']; @@ -63,13 +63,13 @@ class UserBirthdayAction extends UserProfileAction implements IGroupedUserListAc } } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'users' => $users, 'year' => $year - )); - return array( + ]); + return [ 'pageCount' => 1, 'template' => WCF::getTPL()->fetch('userBirthdayList') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php index 55bd29005f..ae2235aee8 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfileAction.class.php @@ -28,7 +28,7 @@ class UserProfileAction extends UserAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getUserProfile', 'getDetailedActivityPointList'); + protected $allowGuestAccess = ['getUserProfile', 'getDetailedActivityPointList']; /** * user profile object @@ -49,9 +49,9 @@ class UserProfileAction extends UserAction { if (isset($this->parameters['options']['enableBBCodes']) && WCF::getSession()->getPermission('user.signature.canUseBBCodes')) { $disallowedBBCodes = BBCodeParser::getInstance()->validateBBCodes($this->parameters['data']['message'], explode(',', WCF::getSession()->getPermission('user.signature.allowedBBCodes'))); if (!empty($disallowedBBCodes)) { - throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', array( + throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', [ 'disallowedBBCodes' => $disallowedBBCodes - ))); + ])); } } } @@ -76,9 +76,9 @@ class UserProfileAction extends UserAction { $message = StringUtil::trim($this->parameters['data']['message']); $preview = MessageParser::getInstance()->parse($message, $enableSmilies, $enableHtml, $enableBBCodes, false); - return array( + return [ 'message' => $preview - ); + ]; } /** @@ -100,7 +100,7 @@ class UserProfileAction extends UserAction { if ($userID) { $userProfileList = new UserProfileList(); - $userProfileList->getConditionBuilder()->add("user_table.userID = ?", array($userID)); + $userProfileList->getConditionBuilder()->add("user_table.userID = ?", [$userID]); $userProfileList->readObjects(); $userProfiles = $userProfileList->getObjects(); @@ -115,10 +115,10 @@ class UserProfileAction extends UserAction { WCF::getTPL()->assign('unknownUser', true); } - return array( + return [ 'template' => WCF::getTPL()->fetch('userProfilePreview'), 'userID' => $userID - ); + ]; } /** @@ -141,14 +141,14 @@ class UserProfileAction extends UserAction { * @return array */ public function getDetailedActivityPointList() { - $activityPointObjectTypes = array(); + $activityPointObjectTypes = []; foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.activityPointEvent') as $objectType) { $activityPointObjectTypes[$objectType->objectTypeID] = $objectType; } $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('userID = ?', array($this->userProfile->userID)); - $conditionBuilder->add('objectTypeID IN (?)', array(array_keys($activityPointObjectTypes))); + $conditionBuilder->add('userID = ?', [$this->userProfile->userID]); + $conditionBuilder->add('objectTypeID IN (?)', [array_keys($activityPointObjectTypes)]); $sql = "SELECT objectTypeID, activityPoints FROM wcf".WCF_N."_user_activity_point @@ -159,15 +159,15 @@ class UserProfileAction extends UserAction { $activityPointObjectTypes[$row['objectTypeID']]->activityPoints = $row['activityPoints']; } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'activityPointObjectTypes' => $activityPointObjectTypes, 'user' => $this->userProfile - )); + ]); - return array( + return [ 'template' => WCF::getTPL()->fetch('detailedActivityPointList'), 'userID' => $this->userProfile->userID - ); + ]; } /** @@ -200,15 +200,15 @@ class UserProfileAction extends UserAction { */ public function beginEdit() { $optionTree = $this->getOptionHandler($this->userProfile->getDecoratedObject())->getOptionTree(); - WCF::getTPL()->assign(array( - 'errorType' => array(), + WCF::getTPL()->assign([ + 'errorType' => [], 'optionTree' => $optionTree, '__userTitle' => $this->userProfile->userTitle - )); + ]); - return array( + return [ 'template' => WCF::getTPL()->fetch('userProfileAboutEditable') - ); + ]; } /** @@ -218,7 +218,7 @@ class UserProfileAction extends UserAction { $this->validateBeginEdit(); if (!isset($this->parameters['values']) || !is_array($this->parameters['values'])) { - $this->parameters['values'] = array(); + $this->parameters['values'] = []; } if (isset($this->parameters['values']['__userTitle']) && !WCF::getSession()->getPermission('user.profile.canEditUserTitle')) { @@ -261,23 +261,23 @@ class UserProfileAction extends UserAction { // validation was successful if (empty($errors)) { $saveOptions = $optionHandler->save(); - $data = array( + $data = [ 'options' => $saveOptions - ); + ]; // save user title if ($userTitle !== null) { - $data['data'] = array( + $data['data'] = [ 'userTitle' => $userTitle - ); + ]; } - $userAction = new UserAction(array($this->userProfile->userID), 'update', $data); + $userAction = new UserAction([$this->userProfile->userID], 'update', $data); $userAction->executeAction(); // check if the user will be automatically added to new // user groups because of the changed user options - UserGroupAssignmentHandler::getInstance()->checkUsers(array($this->userProfile->userID)); + UserGroupAssignmentHandler::getInstance()->checkUsers([$this->userProfile->userID]); // return parsed template $user = new User($this->userProfile->userID); @@ -286,28 +286,28 @@ class UserProfileAction extends UserAction { $optionHandler = $this->getOptionHandler($user, false); $options = $optionHandler->getOptionTree(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'options' => $options, 'userID' => $this->userProfile->userID - )); + ]); - return array( + return [ 'success' => true, 'template' => WCF::getTPL()->fetch('userProfileAbout') - ); + ]; } else { // validation failed - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'errorType' => $errors, 'optionTree' => $optionHandler->getOptionTree(), '__userTitle' => ($userTitle !== null ? $userTitle : $this->userProfile->userTitle) - )); + ]); - return array( + return [ 'success' => false, 'template' => WCF::getTPL()->fetch('userProfileAboutEditable') - ); + ]; } } @@ -319,13 +319,13 @@ class UserProfileAction extends UserAction { $this->readObjects(); } - $resetUserIDs = array(); + $resetUserIDs = []; foreach ($this->objects as $user) { $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('user_rank.groupID IN (?)', array($user->getGroupIDs())); - $conditionBuilder->add('user_rank.requiredPoints <= ?', array($user->activityPoints)); - if ($user->gender) $conditionBuilder->add('user_rank.requiredGender IN (?)', array(array(0, $user->gender))); - else $conditionBuilder->add('user_rank.requiredGender = ?', array(0)); + $conditionBuilder->add('user_rank.groupID IN (?)', [$user->getGroupIDs()]); + $conditionBuilder->add('user_rank.requiredPoints <= ?', [$user->activityPoints]); + if ($user->gender) $conditionBuilder->add('user_rank.requiredGender IN (?)', [[0, $user->gender]]); + else $conditionBuilder->add('user_rank.requiredGender = ?', [0]); $sql = "SELECT user_rank.rankID FROM wcf".WCF_N."_user_rank user_rank @@ -338,13 +338,13 @@ class UserProfileAction extends UserAction { $row = $statement->fetchArray(); if ($row === false) { if ($user->rankID) { - $user->update(array('rankID' => null)); + $user->update(['rankID' => null]); $resetUserIDs[] = $user->userID; } } else { if ($row['rankID'] != $user->rankID) { - $user->update(array('rankID' => $row['rankID'])); + $user->update(['rankID' => $row['rankID']]); $resetUserIDs[] = $user->userID; } } @@ -363,10 +363,10 @@ class UserProfileAction extends UserAction { $this->readObjects(); } - $userToGroup = array(); + $userToGroup = []; foreach ($this->objects as $user) { $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('groupID IN (?)', array($user->getGroupIDs())); + $conditionBuilder->add('groupID IN (?)', [$user->getGroupIDs()]); $sql = "SELECT groupID FROM wcf".WCF_N."_user_group @@ -388,10 +388,10 @@ class UserProfileAction extends UserAction { WCF::getDB()->beginTransaction(); foreach ($userToGroup as $userID => $groupID) { - $statement->execute(array( + $statement->execute([ $groupID, $userID - )); + ]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/data/user/UserRegistrationAction.class.php b/wcfsetup/install/files/lib/data/user/UserRegistrationAction.class.php index 459607afee..e17fbf360b 100644 --- a/wcfsetup/install/files/lib/data/user/UserRegistrationAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserRegistrationAction.class.php @@ -17,7 +17,7 @@ class UserRegistrationAction extends UserAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('validateEmailAddress', 'validatePassword', 'validateUsername'); + protected $allowGuestAccess = ['validateEmailAddress', 'validatePassword', 'validateUsername']; /** * Validates the validate username function. @@ -47,22 +47,22 @@ class UserRegistrationAction extends UserAction { */ public function validateUsername() { if (!UserRegistrationUtil::isValidUsername($this->parameters['username'])) { - return array( + return [ 'isValid' => false, 'error' => 'notValid' - ); + ]; } if (!UserUtil::isAvailableUsername($this->parameters['username'])) { - return array( + return [ 'isValid' => false, 'error' => 'notUnique' - ); + ]; } - return array( + return [ 'isValid' => true - ); + ]; } /** @@ -72,22 +72,22 @@ class UserRegistrationAction extends UserAction { */ public function validateEmailAddress() { if (!UserRegistrationUtil::isValidEmail($this->parameters['email'])) { - return array( + return [ 'isValid' => false, 'error' => 'notValid' - ); + ]; } if (!UserUtil::isAvailableEmail($this->parameters['email'])) { - return array( + return [ 'isValid' => false, 'error' => 'notUnique' - ); + ]; } - return array( + return [ 'isValid' => true - ); + ]; } /** @@ -97,14 +97,14 @@ class UserRegistrationAction extends UserAction { */ public function validatePassword() { if (!UserRegistrationUtil::isSecurePassword($this->parameters['password'])) { - return array( + return [ 'isValid' => false, 'error' => 'notSecure' - ); + ]; } - return array( + return [ 'isValid' => true - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEvent.class.php b/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEvent.class.php index 1a2b7dae2c..ca37110bd8 100644 --- a/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEvent.class.php @@ -53,7 +53,7 @@ class UserActivityEvent extends DatabaseObject { $this->data['additionalData'] = @unserialize($this->data['additionalData']); if (!is_array($this->data['additionalData'])) { - $this->data['additionalData'] = array(); + $this->data['additionalData'] = []; } } } diff --git a/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEventAction.class.php b/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEventAction.class.php index b4e1685f22..a6c26a2731 100644 --- a/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEventAction.class.php +++ b/wcfsetup/install/files/lib/data/user/activity/event/UserActivityEventAction.class.php @@ -20,7 +20,7 @@ class UserActivityEventAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - public $allowGuestAccess = array('load'); + public $allowGuestAccess = ['load']; /** * Validates parameters to load recent activity entries. @@ -40,46 +40,46 @@ class UserActivityEventAction extends AbstractDatabaseObjectAction { public function load() { $eventList = new ViewableUserActivityEventList(); if ($this->parameters['lastEventID']) { - $eventList->getConditionBuilder()->add("user_activity_event.time <= ?", array($this->parameters['lastEventTime'])); - $eventList->getConditionBuilder()->add("user_activity_event.eventID < ?", array($this->parameters['lastEventID'])); + $eventList->getConditionBuilder()->add("user_activity_event.time <= ?", [$this->parameters['lastEventTime']]); + $eventList->getConditionBuilder()->add("user_activity_event.eventID < ?", [$this->parameters['lastEventID']]); } else { - $eventList->getConditionBuilder()->add("user_activity_event.time < ?", array($this->parameters['lastEventTime'])); + $eventList->getConditionBuilder()->add("user_activity_event.time < ?", [$this->parameters['lastEventTime']]); } // profile view if ($this->parameters['userID']) { - $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", array($this->parameters['userID'])); + $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", [$this->parameters['userID']]); } else if ($this->parameters['filteredByFollowedUsers'] && count(WCF::getUserProfileHandler()->getFollowingUsers())) { - $eventList->getConditionBuilder()->add('user_activity_event.userID IN (?)', array(WCF::getUserProfileHandler()->getFollowingUsers())); + $eventList->getConditionBuilder()->add('user_activity_event.userID IN (?)', [WCF::getUserProfileHandler()->getFollowingUsers()]); } $eventList->readObjects(); $lastEventTime = $eventList->getLastEventTime(); if (!$lastEventTime) { - return array(); + return []; } // removes orphaned and non-accessable events UserActivityEventHandler::validateEvents($eventList); if (!count($eventList)) { - return array(); + return []; } // parse template - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'eventList' => $eventList - )); + ]); $events = $eventList->getObjects(); - return array( + return [ 'lastEventID' => end($events)->eventID, 'lastEventTime' => $lastEventTime, 'template' => WCF::getTPL()->fetch('recentActivityListItem') - ); + ]; } /** @@ -88,11 +88,11 @@ class UserActivityEventAction extends AbstractDatabaseObjectAction { public function validateSwitchContext() { } public function switchContext() { - $userAction = new UserAction(array(WCF::getUser()), 'update', array( - 'options' => array( + $userAction = new UserAction([WCF::getUser()], 'update', [ + 'options' => [ User::getUserOptionID('recentActivitiesFilterByFollowing') => (WCF::getUser()->recentActivitiesFilterByFollowing ? 0 : 1) - ) - )); + ] + ]); $userAction->executeAction(); } } diff --git a/wcfsetup/install/files/lib/data/user/authentication/failure/UserAuthenticationFailure.class.php b/wcfsetup/install/files/lib/data/user/authentication/failure/UserAuthenticationFailure.class.php index 8e152880e5..bf5e15088a 100644 --- a/wcfsetup/install/files/lib/data/user/authentication/failure/UserAuthenticationFailure.class.php +++ b/wcfsetup/install/files/lib/data/user/authentication/failure/UserAuthenticationFailure.class.php @@ -54,7 +54,7 @@ class UserAuthenticationFailure extends DatabaseObject { WHERE ipAddress = ? AND time > ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($ipAddress, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT)); + $statement->execute([$ipAddress, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT]); return $statement->fetchColumn(); } @@ -71,7 +71,7 @@ class UserAuthenticationFailure extends DatabaseObject { WHERE userID = ? AND time > ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($userID, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT)); + $statement->execute([$userID, TIME_NOW - USER_AUTHENTICATION_FAILURE_TIMEOUT]); return $statement->fetchColumn(); } diff --git a/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php b/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php index e9f95fdd50..8d160b8b58 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php @@ -58,7 +58,7 @@ class Gravatar extends DefaultAvatar { * urls of this gravatar * @var string[] */ - protected $url = array(); + protected $url = []; /** * Creates a new Gravatar object. @@ -97,9 +97,9 @@ class Gravatar extends DefaultAvatar { $this->url[$size] = WCF::getPath().$cachedFilename; } else { - $this->url[$size] = LinkHandler::getInstance()->getLink('GravatarDownload', array( + $this->url[$size] = LinkHandler::getInstance()->getLink('GravatarDownload', [ 'forceFrontend' => true - ), 'userID='.$this->userID.'&size='.$size); + ], 'userID='.$this->userID.'&size='.$size); } } diff --git a/wcfsetup/install/files/lib/data/user/avatar/UserAvatar.class.php b/wcfsetup/install/files/lib/data/user/avatar/UserAvatar.class.php index 77c9df921a..be2c7c4b61 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/UserAvatar.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/UserAvatar.class.php @@ -29,7 +29,7 @@ class UserAvatar extends DatabaseObject implements IUserAvatar { * needed avatar thumbnail sizes * @var integer[] */ - public static $avatarThumbnailSizes = array(32, 96, 128); + public static $avatarThumbnailSizes = [32, 96, 128]; /** * @see \wcf\data\DatabaseObject::$databaseTableName diff --git a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php index 36f18e15f3..b9e4f1e1ea 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php @@ -78,14 +78,14 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { $fileLocation = $this->enforceDimensions($file->getLocation()); $imageData = getimagesize($fileLocation); - $data = array( + $data = [ 'avatarName' => $file->getFilename(), 'avatarExtension' => $file->getFileExtension(), 'width' => $imageData[0], 'height' => $imageData[1], 'userID' => $userID, 'fileHash' => sha1_file($fileLocation) - ); + ]; // create avatar $avatar = UserAvatarEditor::create($data); @@ -102,31 +102,31 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { @unlink($fileLocation); // create thumbnails - $action = new UserAvatarAction(array($avatar), 'generateThumbnails'); + $action = new UserAvatarAction([$avatar], 'generateThumbnails'); $action->executeAction(); // delete old avatar if ($user->avatarID) { - $action = new UserAvatarAction(array($user->avatarID), 'delete'); + $action = new UserAvatarAction([$user->avatarID], 'delete'); $action->executeAction(); } // update user $userEditor = new UserEditor($user); - $userEditor->update(array( + $userEditor->update([ 'avatarID' => $avatar->avatarID, 'enableGravatar' => 0 - )); + ]); // reset user storage - UserStorageHandler::getInstance()->reset(array($userID), 'avatar'); + UserStorageHandler::getInstance()->reset([$userID], 'avatar'); // return result - return array( + return [ 'avatarID' => $avatar->avatarID, 'canCrop' => $avatar->canCrop(), 'url' => $avatar->getURL(96) - ); + ]; } else { // moving failed; delete avatar @@ -140,7 +140,7 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { $file->setValidationErrorType($e->getType()); } - return array('errorType' => $file->getValidationErrorType()); + return ['errorType' => $file->getValidationErrorType()]; } /** @@ -214,14 +214,14 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { return; } - $data = array( + $data = [ 'avatarName' => $tmp['basename'], 'avatarExtension' => $tmp['extension'], 'width' => $imageData[0], 'height' => $imageData[1], 'userID' => $this->parameters['userEditor']->userID, 'fileHash' => sha1_file($filename) - ); + ]; // create avatar $avatar = UserAvatarEditor::create($data); @@ -238,7 +238,7 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { @unlink($filename); // create thumbnails - $action = new UserAvatarAction(array($avatar), 'generateThumbnails'); + $action = new UserAvatarAction([$avatar], 'generateThumbnails'); $action->executeAction(); $avatarID = $avatar->avatarID; @@ -253,20 +253,20 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { // update user if ($avatarID) { - $this->parameters['userEditor']->update(array( + $this->parameters['userEditor']->update([ 'avatarID' => $avatarID, 'enableGravatar' => 0 - )); + ]); // delete old avatar if ($this->parameters['userEditor']->avatarID) { - $action = new UserAvatarAction(array($this->parameters['userEditor']->avatarID), 'delete'); + $action = new UserAvatarAction([$this->parameters['userEditor']->avatarID], 'delete'); $action->executeAction(); } } // reset user storage - UserStorageHandler::getInstance()->reset(array($this->parameters['userEditor']->userID), 'avatar'); + UserStorageHandler::getInstance()->reset([$this->parameters['userEditor']->userID], 'avatar'); } /** @@ -320,13 +320,13 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { * @return array */ public function getCropDialog() { - return array( + return [ 'cropX' => $this->avatar->cropX, 'cropY' => $this->avatar->cropY, - 'template' => WCF::getTPL()->fetch('avatarCropDialog', 'wcf', array( + 'template' => WCF::getTPL()->fetch('avatarCropDialog', 'wcf', [ 'avatar' => $this->avatar - )) - ); + ]) + ]; } /** @@ -372,13 +372,13 @@ class UserAvatarAction extends AbstractDatabaseObjectAction { } // update database entry - $this->avatar->update(array( + $this->avatar->update([ 'cropX' => $this->parameters['cropX'], 'cropY' => $this->parameters['cropY'] - )); + ]); - return array( + return [ 'url' => $this->avatar->getURL(96) - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarEditor.class.php b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarEditor.class.php index 315f19d684..4a3fb92091 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/UserAvatarEditor.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/UserAvatarEditor.class.php @@ -29,7 +29,7 @@ class UserAvatarEditor extends DatabaseObjectEditor { $sql = "DELETE FROM wcf".WCF_N."_user_avatar WHERE avatarID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->avatarID)); + $statement->execute([$this->avatarID]); $this->deleteFiles(); } @@ -37,7 +37,7 @@ class UserAvatarEditor extends DatabaseObjectEditor { /** * @inheritDoc */ - public static function deleteAll(array $objectIDs = array()) { + public static function deleteAll(array $objectIDs = []) { $sql = "SELECT * FROM wcf".WCF_N."_user_avatar WHERE avatarID IN (".str_repeat('?,', count($objectIDs) - 1)."?)"; diff --git a/wcfsetup/install/files/lib/data/user/follow/UserFollow.class.php b/wcfsetup/install/files/lib/data/user/follow/UserFollow.class.php index 624fe9a4f8..c8ecbfcb8a 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollow.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollow.class.php @@ -42,13 +42,13 @@ class UserFollow extends DatabaseObject { WHERE userID = ? AND followUserID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $userID, $followUserID - )); + ]); $row = $statement->fetchArray(); - if (!$row) $row = array(); + if (!$row) $row = []; return new UserFollow(null, $row); } diff --git a/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php b/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php index 6a64c914a8..b7f3ecd7a0 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowAction.class.php @@ -27,7 +27,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getGroupedUserList'); + protected $allowGuestAccess = ['getGroupedUserList']; /** * user profile object @@ -72,26 +72,26 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU // not following right now if (!$follow->followID) { - $follow = UserFollowEditor::create(array( + $follow = UserFollowEditor::create([ 'userID' => WCF::getUser()->userID, 'followUserID' => $this->parameters['data']['userID'], 'time' => TIME_NOW - )); + ]); // send notification - UserNotificationHandler::getInstance()->fireEvent('following', 'com.woltlab.wcf.user.follow', new UserFollowUserNotificationObject($follow), array($follow->followUserID)); + UserNotificationHandler::getInstance()->fireEvent('following', 'com.woltlab.wcf.user.follow', new UserFollowUserNotificationObject($follow), [$follow->followUserID]); // fire activity event UserActivityEventHandler::getInstance()->fireEvent('com.woltlab.wcf.user.recentActivityEvent.follow', $this->parameters['data']['userID']); // reset storage - UserStorageHandler::getInstance()->reset(array($this->parameters['data']['userID']), 'followerUserIDs'); - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'followingUserIDs'); + UserStorageHandler::getInstance()->reset([$this->parameters['data']['userID']], 'followerUserIDs'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'followingUserIDs'); } - return array( + return [ 'following' => 1 - ); + ]; } /** @@ -114,16 +114,16 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU $followEditor->delete(); // remove activity event - UserActivityEventHandler::getInstance()->removeEvents('com.woltlab.wcf.user.recentActivityEvent.follow', array($this->parameters['data']['userID'])); + UserActivityEventHandler::getInstance()->removeEvents('com.woltlab.wcf.user.recentActivityEvent.follow', [$this->parameters['data']['userID']]); } // reset storage - UserStorageHandler::getInstance()->reset(array($this->parameters['data']['userID']), 'followerUserIDs'); - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'followingUserIDs'); + UserStorageHandler::getInstance()->reset([$this->parameters['data']['userID']], 'followerUserIDs'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'followingUserIDs'); - return array( + return [ 'following' => 0 - ); + ]; } /** @@ -153,16 +153,16 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU public function delete() { $returnValues = parent::delete(); - $followUserIDs = array(); + $followUserIDs = []; foreach ($this->objects as $follow) { $followUserIDs[] = $follow->followUserID; // remove activity event - UserActivityEventHandler::getInstance()->removeEvents('com.woltlab.wcf.user.recentActivityEvent.follow', array($follow->followUserID)); + UserActivityEventHandler::getInstance()->removeEvents('com.woltlab.wcf.user.recentActivityEvent.follow', [$follow->followUserID]); } // reset storage UserStorageHandler::getInstance()->reset($followUserIDs, 'followerUserIDs'); - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'followingUserIDs'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'followingUserIDs'); return $returnValues; } @@ -189,7 +189,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU FROM wcf".WCF_N."_user_follow WHERE followUserID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->parameters['userID'])); + $statement->execute([$this->parameters['userID']]); $pageCount = ceil($statement->fetchSingleColumn() / 20); // get user ids @@ -197,7 +197,7 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU FROM wcf".WCF_N."_user_follow WHERE followUserID = ?"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); - $statement->execute(array($this->parameters['userID'])); + $statement->execute([$this->parameters['userID']]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // create group @@ -207,13 +207,13 @@ class UserFollowAction extends AbstractDatabaseObjectAction implements IGroupedU // load user profiles GroupedUserList::loadUsers(); - WCF::getTPL()->assign(array( - 'groupedUsers' => array($group) - )); + WCF::getTPL()->assign([ + 'groupedUsers' => [$group] + ]); - return array( + return [ 'pageCount' => $pageCount, 'template' => WCF::getTPL()->fetch('groupedUserList') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php b/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php index 93fd45fd0d..10c2f7faf8 100644 --- a/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php +++ b/wcfsetup/install/files/lib/data/user/follow/UserFollowingAction.class.php @@ -43,7 +43,7 @@ class UserFollowingAction extends UserFollowAction { FROM wcf".WCF_N."_user_follow WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->parameters['userID'])); + $statement->execute([$this->parameters['userID']]); $pageCount = ceil($statement->fetchSingleColumn() / 20); // get user ids @@ -51,7 +51,7 @@ class UserFollowingAction extends UserFollowAction { FROM wcf".WCF_N."_user_follow WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); - $statement->execute(array($this->parameters['userID'])); + $statement->execute([$this->parameters['userID']]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // create group @@ -61,13 +61,13 @@ class UserFollowingAction extends UserFollowAction { // load user profiles GroupedUserList::loadUsers(); - WCF::getTPL()->assign(array( - 'groupedUsers' => array($group) - )); + WCF::getTPL()->assign([ + 'groupedUsers' => [$group] + ]); - return array( + return [ 'pageCount' => $pageCount, 'template' => WCF::getTPL()->fetch('groupedUserList') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index 3bb469156f..b9e2eb6bd1 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -88,7 +88,7 @@ class UserGroup extends DatabaseObject implements ITitledObject { public static function getGroupIDsByType(array $types) { self::getCache(); - $groupIDs = array(); + $groupIDs = []; foreach ($types as $type) { if (isset(self::$cache['types'][$type])) { $groupIDs = array_merge($groupIDs, self::$cache['types'][$type]); @@ -106,10 +106,10 @@ class UserGroup extends DatabaseObject implements ITitledObject { * @param integer[] $invalidGroupTypes * @return UserGroup[] */ - public static function getGroupsByType(array $types = array(), array $invalidGroupTypes = array()) { + public static function getGroupsByType(array $types = [], array $invalidGroupTypes = []) { self::getCache(); - $groups = array(); + $groups = []; foreach (self::$cache['groups'] as $group) { if ((empty($types) || in_array($group->groupType, $types)) && !in_array($group->groupType, $invalidGroupTypes)) { $groups[$group->groupID] = $group; @@ -131,7 +131,7 @@ class UserGroup extends DatabaseObject implements ITitledObject { throw new SystemException('invalid value for type argument'); } - $groups = self::getGroupsByType(array($type)); + $groups = self::getGroupsByType([$type]); return array_shift($groups); } @@ -182,7 +182,7 @@ class UserGroup extends DatabaseObject implements ITitledObject { * @param array $groupIDs * @return boolean */ - public static function isAccessibleGroup(array $groupIDs = array()) { + public static function isAccessibleGroup(array $groupIDs = []) { if (self::$accessibleGroups === null) { self::$accessibleGroups = explode(',', WCF::getSession()->getPermission('admin.user.accessibleGroups')); } @@ -205,11 +205,11 @@ class UserGroup extends DatabaseObject implements ITitledObject { * @param integer[] $invalidGroupTypes * @return UserGroup[] */ - public static function getAccessibleGroups(array $groupTypes = array(), array $invalidGroupTypes = array()) { + public static function getAccessibleGroups(array $groupTypes = [], array $invalidGroupTypes = []) { $groups = self::getGroupsByType($groupTypes, $invalidGroupTypes); foreach ($groups as $key => $value) { - if (!self::isAccessibleGroup(array($key))) { + if (!self::isAccessibleGroup([$key])) { unset($groups[$key]); } } @@ -261,7 +261,7 @@ class UserGroup extends DatabaseObject implements ITitledObject { * @return boolean */ public function isAccessible() { - return self::isAccessibleGroup(array($this->groupID)); + return self::isAccessibleGroup([$this->groupID]); } /** @@ -337,7 +337,7 @@ class UserGroup extends DatabaseObject implements ITitledObject { public function getGroupOption($name) { if ($this->groupOptions === null) { // get all options and filter options with low priority - $this->groupOptions = $groupOptionIDs = array(); + $this->groupOptions = $groupOptionIDs = []; $sql = "SELECT optionName, optionID FROM wcf".WCF_N."_user_group_option"; @@ -350,8 +350,8 @@ class UserGroup extends DatabaseObject implements ITitledObject { if (!empty($groupOptionIDs)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("option_value.groupID = ?", array($this->groupID)); - $conditions->add("option_value.optionID IN (?)", array($groupOptionIDs)); + $conditions->add("option_value.groupID = ?", [$this->groupID]); + $conditions->add("option_value.optionID IN (?)", [$groupOptionIDs]); $sql = "SELECT group_option.optionName, option_value.optionValue FROM wcf".WCF_N."_user_group_option_value option_value diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php index 3ae0f45b26..0a65eeca7c 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroupAction.class.php @@ -32,22 +32,22 @@ class UserGroupAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.user.canAddGroup'); + protected $permissionsCreate = ['admin.user.canAddGroup']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.user.canDeleteGroup'); + protected $permissionsDelete = ['admin.user.canDeleteGroup']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.user.canEditGroup'); + protected $permissionsUpdate = ['admin.user.canEditGroup']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('copy', 'create', 'delete', 'update'); + protected $requireACP = ['copy', 'create', 'delete', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::create() @@ -81,10 +81,10 @@ class UserGroupAction extends AbstractDatabaseObjectAction { * Validates the 'copy' action. */ public function validateCopy() { - WCF::getSession()->checkPermissions(array( + WCF::getSession()->checkPermissions([ 'admin.user.canAddGroup', 'admin.user.canEditGroup' - )); + ]); $this->readBoolean('copyACLOptions'); $this->readBoolean('copyMembers'); @@ -106,7 +106,7 @@ class UserGroupAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_user_group_option_value WHERE groupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->groupEditor->groupID)); + $statement->execute([$this->groupEditor->groupID]); } else { $sql = "SELECT optionID, defaultValue AS optionValue @@ -115,21 +115,21 @@ class UserGroupAction extends AbstractDatabaseObjectAction { $statement->execute(); } - $optionValues = array(); + $optionValues = []; while ($row = $statement->fetchArray()) { $optionValues[$row['optionID']] = $row['optionValue']; } - $groupAction = new UserGroupAction(array(), 'create', array( - 'data' => array( + $groupAction = new UserGroupAction([], 'create', [ + 'data' => [ 'groupName' => $this->groupEditor->groupName, 'groupDescription' => $this->groupEditor->groupDescription, 'priority' => $this->groupEditor->priority, 'userOnlineMarking' => $this->groupEditor->userOnlineMarking, 'showOnTeamPage' => $this->groupEditor->showOnTeamPage - ), + ], 'options' => $optionValues - )); + ]); $returnValues = $groupAction->executeAction(); $group = $returnValues['returnValues']; $groupEditor = new UserGroupEditor($group); @@ -146,7 +146,7 @@ class UserGroupAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_language_item WHERE languageItem = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->groupEditor->groupName)); + $statement->execute([$this->groupEditor->groupName]); } else { $groupName .= ' (2)'; @@ -164,13 +164,13 @@ class UserGroupAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_language_item WHERE languageItem = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->groupEditor->groupDescription)); + $statement->execute([$this->groupEditor->groupDescription]); } - $groupEditor->update(array( + $groupEditor->update([ 'groupDescription' => $groupDescription, 'groupName' => $groupName - )); + ]); // copy members if ($this->parameters['copyMembers']) { @@ -180,7 +180,7 @@ class UserGroupAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_user_to_group WHERE groupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->groupEditor->groupID)); + $statement->execute([$this->groupEditor->groupID]); } // copy acl options @@ -191,7 +191,7 @@ class UserGroupAction extends AbstractDatabaseObjectAction { FROM wcf".WCF_N."_acl_option_to_group WHERE groupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->groupEditor->groupID)); + $statement->execute([$this->groupEditor->groupID]); // it is likely that applications or plugins use caches // for acl option values like for the labels which have @@ -206,10 +206,10 @@ class UserGroupAction extends AbstractDatabaseObjectAction { UserGroupEditor::resetCache(); - return array( - 'redirectURL' => LinkHandler::getInstance()->getLink('UserGroupEdit', array( + return [ + 'redirectURL' => LinkHandler::getInstance()->getLink('UserGroupEdit', [ 'id' => $group->groupID - )) - ); + ]) + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php b/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php index c31bd8f8d9..ec491afbd7 100644 --- a/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php +++ b/wcfsetup/install/files/lib/data/user/group/assignment/UserGroupAssignmentAction.class.php @@ -18,17 +18,17 @@ class UserGroupAssignmentAction extends AbstractDatabaseObjectAction implements /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.user.canManageGroupAssignment'); + protected $permissionsDelete = ['admin.user.canManageGroupAssignment']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.user.canManageGroupAssignment'); + protected $permissionsUpdate = ['admin.user.canManageGroupAssignment']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update'); + protected $requireACP = ['create', 'delete', 'toggle', 'update']; /** * @see \wcf\data\IDeleteAction::delete() @@ -44,9 +44,9 @@ class UserGroupAssignmentAction extends AbstractDatabaseObjectAction implements */ public function toggle() { foreach ($this->objects as $assignment) { - $assignment->update(array( + $assignment->update([ 'isDisabled' => $assignment->isDisabled ? 0 : 1 - )); + ]); } } diff --git a/wcfsetup/install/files/lib/data/user/group/option/UserGroupOptionAction.class.php b/wcfsetup/install/files/lib/data/user/group/option/UserGroupOptionAction.class.php index 1c42a2dde4..c6bbce6717 100644 --- a/wcfsetup/install/files/lib/data/user/group/option/UserGroupOptionAction.class.php +++ b/wcfsetup/install/files/lib/data/user/group/option/UserGroupOptionAction.class.php @@ -30,9 +30,9 @@ class UserGroupOptionAction extends AbstractDatabaseObjectAction { $sql = "DELETE FROM wcf".WCF_N."_user_group_option_value WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $option->optionID - )); + ]); if (!empty($this->parameters['values'])) { $sql = "INSERT INTO wcf".WCF_N."_user_group_option_value @@ -42,11 +42,11 @@ class UserGroupOptionAction extends AbstractDatabaseObjectAction { WCF::getDB()->beginTransaction(); foreach ($this->parameters['values'] as $groupID => $optionValue) { - $statement->execute(array( + $statement->execute([ $option->optionID, $groupID, $optionValue - )); + ]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/data/user/ignore/UserIgnore.class.php b/wcfsetup/install/files/lib/data/user/ignore/UserIgnore.class.php index ee759823c7..d4f6e43a93 100644 --- a/wcfsetup/install/files/lib/data/user/ignore/UserIgnore.class.php +++ b/wcfsetup/install/files/lib/data/user/ignore/UserIgnore.class.php @@ -41,13 +41,13 @@ class UserIgnore extends DatabaseObject { WHERE userID = ? AND ignoreUserID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ WCF::getUser()->userID, $ignoreUserID - )); + ]); $row = $statement->fetchArray(); - if (!$row) $row = array(); + if (!$row) $row = []; return new UserIgnore(null, $row); } diff --git a/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php b/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php index 276c187375..46c312497c 100644 --- a/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php +++ b/wcfsetup/install/files/lib/data/user/menu/item/UserMenuItem.class.php @@ -78,7 +78,7 @@ class UserMenuItem extends ProcessibleDatabaseObject implements ITreeMenuItem { } $this->parseController(); - return LinkHandler::getInstance()->getLink($this->controller, array('application' => $this->application), $this->menuItemLink); + return LinkHandler::getInstance()->getLink($this->controller, ['application' => $this->application], $this->menuItemLink); } /** diff --git a/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php b/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php index 875a99ac20..6437bbfbbe 100644 --- a/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php +++ b/wcfsetup/install/files/lib/data/user/notification/UserNotification.class.php @@ -61,7 +61,7 @@ class UserNotification extends DatabaseObject { $this->data['additionalData'] = @unserialize($this->data['additionalData']); if (!is_array($this->data['additionalData'])) { - $this->data['additionalData'] = array(); + $this->data['additionalData'] = []; } } @@ -80,7 +80,7 @@ class UserNotification extends DatabaseObject { AND eventID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID, $eventID, $objectID)); + $statement->execute([$packageID, $eventID, $objectID]); $row = $statement->fetchArray(); if ($row !== false) return new UserNotification(null, $row); diff --git a/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatch.class.php b/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatch.class.php index e1b35944a3..fa866807c2 100644 --- a/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatch.class.php +++ b/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatch.class.php @@ -46,7 +46,7 @@ class UserObjectWatch extends DatabaseObject { AND userID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($objectTypeID, $userID, $objectID)); + $statement->execute([$objectTypeID, $userID, $objectID]); $row = $statement->fetch(); if (!$row) return null; return new UserObjectWatch(null, $row); diff --git a/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatchAction.class.php b/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatchAction.class.php index dee4aaf6b4..b48a583089 100644 --- a/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatchAction.class.php +++ b/wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatchAction.class.php @@ -55,15 +55,15 @@ class UserObjectWatchAction extends AbstractDatabaseObjectAction { * @return array */ public function manageSubscription() { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'objectType' => $this->objectType, 'userObjectWatch' => $this->userObjectWatch - )); + ]); - return array( + return [ 'objectID' => $this->parameters['objectID'], 'template' => WCF::getTPL()->fetch('manageSubscription') - ); + ]; } /** @@ -84,23 +84,23 @@ class UserObjectWatchAction extends AbstractDatabaseObjectAction { if ($this->parameters['subscribe']) { // newly subscribed if ($this->userObjectWatch === null) { - UserObjectWatchEditor::create(array( + UserObjectWatchEditor::create([ 'notification' => ($this->parameters['enableNotification'] ? 1 : 0), 'objectID' => $this->parameters['objectID'], 'objectTypeID' => $this->objectType->objectTypeID, 'userID' => WCF::getUser()->userID - )); + ]); } else if ($this->userObjectWatch->notification != $this->parameters['enableNotification']) { // update notification type $editor = new UserObjectWatchEditor($this->userObjectWatch); - $editor->update(array( + $editor->update([ 'notification' => ($this->parameters['enableNotification'] ? 1 : 0) - )); + ]); } // reset user storage - $this->objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID)); + $this->objectType->getProcessor()->resetUserStorage([WCF::getUser()->userID]); } else if ($this->userObjectWatch !== null) { // unsubscribe @@ -108,13 +108,13 @@ class UserObjectWatchAction extends AbstractDatabaseObjectAction { $editor->delete(); // reset user storage - $this->objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID)); + $this->objectType->getProcessor()->resetUserStorage([WCF::getUser()->userID]); } - return array( + return [ 'objectID' => $this->parameters['objectID'], 'subscribe' => $this->parameters['subscribe'] - ); + ]; } /** @@ -123,15 +123,15 @@ class UserObjectWatchAction extends AbstractDatabaseObjectAction { public function subscribe() { $objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $this->parameters['data']['objectType']); - UserObjectWatchEditor::create(array( + UserObjectWatchEditor::create([ 'userID' => WCF::getUser()->userID, 'objectID' => intval($this->parameters['data']['objectID']), 'objectTypeID' => $objectType->objectTypeID, 'notification' => (!empty($this->parameters['enableNotification']) ? 1 : 0) - )); + ]); // reset user storage - $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID)); + $objectType->getProcessor()->resetUserStorage([WCF::getUser()->userID]); } /** @@ -148,7 +148,7 @@ class UserObjectWatchAction extends AbstractDatabaseObjectAction { $editor->delete(); // reset user storage - $objectType->getProcessor()->resetUserStorage(array(WCF::getUser()->userID)); + $objectType->getProcessor()->resetUserStorage([WCF::getUser()->userID]); } /** diff --git a/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php b/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php index 415eea0d4e..7b19290090 100644 --- a/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php +++ b/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php @@ -32,12 +32,12 @@ class UsersOnlineList extends SessionList { * users online stats * @var array */ - public $stats = array( + public $stats = [ 'total' => 0, 'invisible' => 0, 'members' => 0, 'guests' => 0 - ); + ]; /** * users online markings @@ -58,7 +58,7 @@ class UsersOnlineList extends SessionList { $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_avatar user_avatar ON (user_avatar.avatarID = user_table.avatarID)"; $this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_group user_group ON (user_group.groupID = user_table.userOnlineGroupID)"; - $this->getConditionBuilder()->add('session.lastActivityTime > ?', array(TIME_NOW - USER_ONLINE_TIMEOUT)); + $this->getConditionBuilder()->add('session.lastActivityTime > ?', [TIME_NOW - USER_ONLINE_TIMEOUT]); } /** @@ -68,7 +68,7 @@ class UsersOnlineList extends SessionList { parent::readObjects(); $objects = $this->objects; - $this->indexToObject = $this->objects = array(); + $this->indexToObject = $this->objects = []; foreach ($objects as $object) { $object = new UserOnline(new User(null, null, $object)); @@ -117,7 +117,7 @@ class UsersOnlineList extends SessionList { */ public function getUsersOnlineMarkings() { if ($this->usersOnlineMarkings === null) { - $this->usersOnlineMarkings = $priorities = array(); + $this->usersOnlineMarkings = $priorities = []; // get groups foreach (UserGroup::getGroupsByType() as $group) { @@ -141,10 +141,10 @@ class UsersOnlineList extends SessionList { $usersOnlineTotal = (USERS_ONLINE_RECORD_NO_GUESTS ? $this->stats['members'] : $this->stats['total']); if ($usersOnlineTotal > USERS_ONLINE_RECORD) { // save new record - $optionAction = new OptionAction(array(), 'import', array('data' => array( + $optionAction = new OptionAction([], 'import', ['data' => [ 'users_online_record' => $usersOnlineTotal, 'users_online_record_time' => TIME_NOW - ))); + ]]); $optionAction->executeAction(); } } diff --git a/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php b/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php index 5b8f66200b..f5b1395298 100644 --- a/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php +++ b/wcfsetup/install/files/lib/data/user/option/UserOptionAction.class.php @@ -23,22 +23,22 @@ class UserOptionAction extends AbstractDatabaseObjectAction implements IToggleAc /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.user.canManageUserOption'); + protected $permissionsCreate = ['admin.user.canManageUserOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.user.canManageUserOption'); + protected $permissionsDelete = ['admin.user.canManageUserOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.user.canManageUserOption'); + protected $permissionsUpdate = ['admin.user.canManageUserOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'toggle', 'update'); + protected $requireACP = ['create', 'delete', 'toggle', 'update']; /** * @see \wcf\data\AbstractDatabaseObjectAction::validateDelete() @@ -58,9 +58,9 @@ class UserOptionAction extends AbstractDatabaseObjectAction implements IToggleAc */ public function toggle() { foreach ($this->objects as $optionEditor) { - $optionEditor->update(array( + $optionEditor->update([ 'isDisabled' => 1 - $optionEditor->isDisabled - )); + ]); } } diff --git a/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php b/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php index 36ecb86881..8add39cfdc 100644 --- a/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php +++ b/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php @@ -30,13 +30,13 @@ class ViewableUserOption extends DatabaseObjectDecorator { * list of output objects * @var IUserOptionOutput[] */ - public static $outputObjects = array(); + public static $outputObjects = []; /** * cached user options * @var ViewableUserOption[] */ - public static $userOptions = array(); + public static $userOptions = []; /** * user option value @@ -95,7 +95,7 @@ class ViewableUserOption extends DatabaseObjectDecorator { */ public static function getUserOption($name) { if (!isset(self::$userOptions[$name])) { - $options = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); + $options = UserOptionCacheBuilder::getInstance()->getData([], 'options'); self::$userOptions[$name] = new ViewableUserOption($options[$name]); } diff --git a/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategory.class.php b/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategory.class.php index de9ed9be87..711b6d09f3 100644 --- a/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategory.class.php +++ b/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategory.class.php @@ -42,7 +42,7 @@ class UserOptionCategory extends DatabaseObject { FROM wcf".WCF_N."_user_option_category option_category WHERE option_category.categoryID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($categoryID)); + $statement->execute([$categoryID]); $row = $statement->fetchArray(); } @@ -69,7 +69,7 @@ class UserOptionCategory extends DatabaseObject { FROM wcf".WCF_N."_user_option_category WHERE categoryName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($categoryName)); + $statement->execute([$categoryName]); $row = $statement->fetchArray(); if ($row === false) return null; diff --git a/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategoryAction.class.php b/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategoryAction.class.php index 479215485c..471e8e0500 100644 --- a/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/user/option/category/UserOptionCategoryAction.class.php @@ -21,20 +21,20 @@ class UserOptionCategoryAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsCreate */ - protected $permissionsCreate = array('admin.user.canManageUserOption'); + protected $permissionsCreate = ['admin.user.canManageUserOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.user.canManageUserOption'); + protected $permissionsDelete = ['admin.user.canManageUserOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.user.canManageUserOption'); + protected $permissionsUpdate = ['admin.user.canManageUserOption']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('create', 'delete', 'update'); + protected $requireACP = ['create', 'delete', 'update']; } diff --git a/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php b/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php index 02399a0cdc..e1ed1e1d71 100644 --- a/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php +++ b/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItem.class.php @@ -74,7 +74,7 @@ class UserProfileMenuItem extends DatabaseObject { throw new SystemException("'".$this->className."' does not implement 'wcf\system\menu\user\profile\content\IUserProfileMenuContent'"); } - $this->contentManager = call_user_func(array($this->className, 'getInstance')); + $this->contentManager = call_user_func([$this->className, 'getInstance']); } return $this->contentManager; diff --git a/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItemAction.class.php b/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItemAction.class.php index 5443127ce9..8b04c5095f 100644 --- a/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItemAction.class.php +++ b/wcfsetup/install/files/lib/data/user/profile/menu/item/UserProfileMenuItemAction.class.php @@ -19,7 +19,7 @@ class UserProfileMenuItemAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getContent'); + protected $allowGuestAccess = ['getContent']; /** * menu item @@ -50,9 +50,9 @@ class UserProfileMenuItemAction extends AbstractDatabaseObjectAction { public function getContent() { $contentManager = $this->menuItem->getContentManager(); - return array( + return [ 'containerID' => $this->parameters['data']['containerID'], 'template' => $contentManager->getContent($this->parameters['data']['userID']) - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitor.class.php b/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitor.class.php index a9d79311fb..4b4db76e53 100644 --- a/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitor.class.php +++ b/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitor.class.php @@ -42,7 +42,7 @@ class UserProfileVisitor extends DatabaseObject { WHERE ownerID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($ownerID, $userID)); + $statement->execute([$ownerID, $userID]); if ($row = $statement->fetchArray()) { return new UserProfileVisitor(null, $row); } diff --git a/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php b/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php index 06ebce9015..186acbf87a 100644 --- a/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php +++ b/wcfsetup/install/files/lib/data/user/profile/visitor/UserProfileVisitorAction.class.php @@ -22,7 +22,7 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I /** * @see \wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess */ - protected $allowGuestAccess = array('getGroupedUserList'); + protected $allowGuestAccess = ['getGroupedUserList']; /** * user profile object @@ -52,7 +52,7 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I FROM wcf".WCF_N."_user_profile_visitor WHERE ownerID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->parameters['userID'])); + $statement->execute([$this->parameters['userID']]); $pageCount = ceil($statement->fetchSingleColumn() / 20); // get user ids @@ -61,7 +61,7 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I WHERE ownerID = ? ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 20, ($this->parameters['pageNo'] - 1) * 20); - $statement->execute(array($this->parameters['userID'])); + $statement->execute([$this->parameters['userID']]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // create group @@ -71,13 +71,13 @@ class UserProfileVisitorAction extends AbstractDatabaseObjectAction implements I // load user profiles GroupedUserList::loadUsers(); - WCF::getTPL()->assign(array( - 'groupedUsers' => array($group) - )); + WCF::getTPL()->assign([ + 'groupedUsers' => [$group] + ]); - return array( + return [ 'pageCount' => $pageCount, 'template' => WCF::getTPL()->fetch('groupedUserList') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/data/user/rank/UserRankAction.class.php b/wcfsetup/install/files/lib/data/user/rank/UserRankAction.class.php index 89793136c3..818685c1cb 100644 --- a/wcfsetup/install/files/lib/data/user/rank/UserRankAction.class.php +++ b/wcfsetup/install/files/lib/data/user/rank/UserRankAction.class.php @@ -16,10 +16,10 @@ class UserRankAction extends AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.user.rank.canManageRank'); + protected $permissionsDelete = ['admin.user.rank.canManageRank']; /** * @see \wcf\data\AbstractDatabaseObjectAction::$requireACP */ - protected $requireACP = array('delete'); + protected $requireACP = ['delete']; } diff --git a/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php b/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php index 254774023f..752aaa597f 100644 --- a/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php +++ b/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php @@ -39,10 +39,10 @@ abstract class AbstractCaptchaForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'captchaObjectType' => $this->captchaObjectType, 'useCaptcha' => $this->useCaptcha - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/form/AbstractForm.class.php b/wcfsetup/install/files/lib/form/AbstractForm.class.php index c1eca91d77..2e0ba0877b 100644 --- a/wcfsetup/install/files/lib/form/AbstractForm.class.php +++ b/wcfsetup/install/files/lib/form/AbstractForm.class.php @@ -46,7 +46,7 @@ abstract class AbstractForm extends AbstractPage implements IForm { * additional fields * @var mixed[] */ - public $additionalFields = array(); + public $additionalFields = []; /** * @see \wcf\form\IForm::submit() @@ -124,10 +124,10 @@ abstract class AbstractForm extends AbstractPage implements IForm { parent::assignVariables(); // assign default variables - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'activeTabMenuItem' => $this->activeTabMenuItem, 'errorField' => $this->errorField, 'errorType' => $this->errorType - )); + ]); } } diff --git a/wcfsetup/install/files/lib/form/AccountManagementForm.class.php b/wcfsetup/install/files/lib/form/AccountManagementForm.class.php index 8c5d28a632..0d6d3babe7 100644 --- a/wcfsetup/install/files/lib/form/AccountManagementForm.class.php +++ b/wcfsetup/install/files/lib/form/AccountManagementForm.class.php @@ -273,7 +273,7 @@ class AccountManagementForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'password' => $this->password, 'email' => $this->email, 'confirmEmail' => $this->confirmEmail, @@ -292,7 +292,7 @@ class AccountManagementForm extends AbstractForm { 'facebookDisconnect' => $this->facebookDisconnect, 'googleConnect' => $this->googleConnect, 'googleDisconnect' => $this->googleDisconnect - )); + ]); } /** @@ -311,8 +311,8 @@ class AccountManagementForm extends AbstractForm { public function save() { parent::save(); - $success = array(); - $updateParameters = array(); + $success = []; + $updateParameters = []; // quit if (WCF::getSession()->getPermission('user.profile.canQuit')) { @@ -353,13 +353,13 @@ class AccountManagementForm extends AbstractForm { $updateParameters['reactivationCode'] = $activationCode; $updateParameters['newEmail'] = $this->email; - $messageData = array( + $messageData = [ 'username' => WCF::getUser()->username, 'userID' => WCF::getUser()->userID, 'activationCode' => $activationCode - ); + ]; - $mail = new Mail(array(WCF::getUser()->username => $this->email), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData)); + $mail = new Mail([WCF::getUser()->username => $this->email], WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData)); $mail->send(); $success[] = 'wcf.user.changeEmail.needReactivation'; } @@ -431,12 +431,12 @@ class AccountManagementForm extends AbstractForm { $success[] = 'wcf.user.3rdparty.google.disconnect.success'; } - $data = array(); + $data = []; if (!empty($updateParameters) || !empty($this->additionalFields)) { $data['data'] = array_merge($this->additionalFields, $updateParameters); } - $this->objectAction = new UserAction(array(WCF::getUser()), 'update', $data); + $this->objectAction = new UserAction([WCF::getUser()], 'update', $data); $this->objectAction->executeAction(); // update cookie @@ -449,7 +449,7 @@ class AccountManagementForm extends AbstractForm { $this->saved(); - $success = array_merge($success, WCF::getTPL()->get('success') ?: array()); + $success = array_merge($success, WCF::getTPL()->get('success') ?: []); // show success message WCF::getTPL()->assign('success', $success); diff --git a/wcfsetup/install/files/lib/form/AvatarEditForm.class.php b/wcfsetup/install/files/lib/form/AvatarEditForm.class.php index 185c1447ad..65ba16e61d 100644 --- a/wcfsetup/install/files/lib/form/AvatarEditForm.class.php +++ b/wcfsetup/install/files/lib/form/AvatarEditForm.class.php @@ -91,7 +91,7 @@ class AvatarEditForm extends AbstractForm { if ($this->avatarType != 'custom') { // delete custom avatar if (WCF::getUser()->avatarID) { - $action = new UserAvatarAction(array(WCF::getUser()->avatarID), 'delete'); + $action = new UserAvatarAction([WCF::getUser()->avatarID], 'delete'); $action->executeAction(); } } @@ -99,33 +99,33 @@ class AvatarEditForm extends AbstractForm { // update user switch ($this->avatarType) { case 'none': - $data = array( + $data = [ 'avatarID' => null, 'enableGravatar' => 0 - ); + ]; break; case 'custom': - $data = array( + $data = [ 'enableGravatar' => 0 - ); + ]; break; case 'gravatar': - $data = array( + $data = [ 'avatarID' => null, 'enableGravatar' => 1 - ); + ]; break; } - $this->objectAction = new UserAction(array(WCF::getUser()), 'update', array( + $this->objectAction = new UserAction([WCF::getUser()], 'update', [ 'data' => array_merge($this->additionalFields, $data) - )); + ]); $this->objectAction->executeAction(); // check if the user will be automatically added to new user groups // because of the changed avatar - UserGroupAssignmentHandler::getInstance()->checkUsers(array(WCF::getUser()->userID)); + UserGroupAssignmentHandler::getInstance()->checkUsers([WCF::getUser()->userID]); // reset gravatar cache if ($this->avatarType == 'gravatar') { @@ -162,9 +162,9 @@ class AvatarEditForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'avatarType' => $this->avatarType - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/form/EmailActivationForm.class.php b/wcfsetup/install/files/lib/form/EmailActivationForm.class.php index b7cf702883..e600caf9f1 100644 --- a/wcfsetup/install/files/lib/form/EmailActivationForm.class.php +++ b/wcfsetup/install/files/lib/form/EmailActivationForm.class.php @@ -95,13 +95,13 @@ class EmailActivationForm extends AbstractForm { parent::save(); // enable new email - $this->objectAction = new UserAction(array($this->user), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserAction([$this->user], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'email' => $this->user->newEmail, 'newEmail' => '', 'reactivationCode' => 0 - )) - )); + ]) + ]); $this->objectAction->executeAction(); $this->saved(); @@ -116,10 +116,10 @@ class EmailActivationForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'u' => $this->userID, 'a' => $this->activationCode - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php b/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php index 230fc9d40f..c3732a8d13 100644 --- a/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php +++ b/wcfsetup/install/files/lib/form/EmailNewActivationCodeForm.class.php @@ -59,20 +59,20 @@ class EmailNewActivationCodeForm extends RegisterNewActivationCodeForm { $activationCode = UserRegistrationUtil::getActivationCode(); // save user - $this->objectAction = new UserAction(array($this->user), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserAction([$this->user], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'reactivationCode' => $activationCode - )) - )); + ]) + ]); $this->objectAction->executeAction(); // send activation mail - $messageData = array( + $messageData = [ 'username' => $this->user->username, 'userID' => $this->user->userID, 'activationCode' => $activationCode - ); - $mail = new Mail(array($this->user->username => $this->user->newEmail), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData)); + ]; + $mail = new Mail([$this->user->username => $this->user->newEmail], WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.changeEmail.needReactivation.mail', $messageData)); $mail->send(); $this->saved(); diff --git a/wcfsetup/install/files/lib/form/LostPasswordForm.class.php b/wcfsetup/install/files/lib/form/LostPasswordForm.class.php index d601e08742..90391c46ba 100644 --- a/wcfsetup/install/files/lib/form/LostPasswordForm.class.php +++ b/wcfsetup/install/files/lib/form/LostPasswordForm.class.php @@ -91,7 +91,7 @@ class LostPasswordForm extends AbstractCaptchaForm { // check whether a lost password request was sent in the last 24 hours if ($this->user->lastLostPasswordRequestTime && TIME_NOW - 86400 < $this->user->lastLostPasswordRequestTime) { - throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.error.tooManyRequests', array('hours' => ceil(($this->user->lastLostPasswordRequestTime - (TIME_NOW - 86400)) / 3600)))); + throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.error.tooManyRequests', ['hours' => ceil(($this->user->lastLostPasswordRequestTime - (TIME_NOW - 86400)) / 3600)])); } } @@ -105,20 +105,20 @@ class LostPasswordForm extends AbstractCaptchaForm { $lostPasswordKey = StringUtil::getRandomID(); // save key and request time in database - $this->objectAction = new UserAction(array($this->user), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserAction([$this->user], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'lostPasswordKey' => $lostPasswordKey, 'lastLostPasswordRequestTime' => TIME_NOW - )) - )); + ]) + ]); $this->objectAction->executeAction(); // send mail - $mail = new Mail(array($this->user->username => $this->user->email), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail', array( + $mail = new Mail([$this->user->username => $this->user->email], WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail', [ 'username' => $this->user->username, 'userID' => $this->user->userID, 'key' => $lostPasswordKey - ))); + ])); $mail->send(); $this->saved(); @@ -133,9 +133,9 @@ class LostPasswordForm extends AbstractCaptchaForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'username' => $this->username, 'email' => $this->email - )); + ]); } } diff --git a/wcfsetup/install/files/lib/form/MessageForm.class.php b/wcfsetup/install/files/lib/form/MessageForm.class.php index 04b68237b6..9b140caf53 100644 --- a/wcfsetup/install/files/lib/form/MessageForm.class.php +++ b/wcfsetup/install/files/lib/form/MessageForm.class.php @@ -62,13 +62,13 @@ abstract class MessageForm extends AbstractCaptchaForm { * list of available content languages * @var Language[] */ - public $availableContentLanguages = array(); + public $availableContentLanguages = []; /** * list of default smilies * @var Smiley[] */ - public $defaultSmilies = array(); + public $defaultSmilies = []; /** * enables bbcodes @@ -146,7 +146,7 @@ abstract class MessageForm extends AbstractCaptchaForm { * list of smiley categories * @var SmileyCategory[] */ - public $smileyCategories = array(); + public $smileyCategories = []; /** * message subject @@ -369,7 +369,7 @@ abstract class MessageForm extends AbstractCaptchaForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'attachmentHandler' => $this->attachmentHandler, 'attachmentObjectID' => $this->attachmentObjectID, 'attachmentObjectType' => $this->attachmentObjectType, @@ -391,7 +391,7 @@ abstract class MessageForm extends AbstractCaptchaForm { 'subject' => $this->subject, 'text' => $this->text, 'tmpHash' => $this->tmpHash - )); + ]); if ($this->allowedBBCodesPermission) { WCF::getTPL()->assign('allowedBBCodes', explode(',', ArrayUtil::trim(WCF::getSession()->getPermission($this->allowedBBCodesPermission)))); diff --git a/wcfsetup/install/files/lib/form/ModerationActivationForm.class.php b/wcfsetup/install/files/lib/form/ModerationActivationForm.class.php index 2acc66286f..410e11b83e 100644 --- a/wcfsetup/install/files/lib/form/ModerationActivationForm.class.php +++ b/wcfsetup/install/files/lib/form/ModerationActivationForm.class.php @@ -35,9 +35,9 @@ class ModerationActivationForm extends AbstractModerationForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'disabledContent' => ModerationQueueActivationManager::getInstance()->getDisabledContent($this->queue), 'queueManager' => ModerationQueueActivationManager::getInstance() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/form/ModerationReportForm.class.php b/wcfsetup/install/files/lib/form/ModerationReportForm.class.php index 8acb077682..e0aff6fd41 100644 --- a/wcfsetup/install/files/lib/form/ModerationReportForm.class.php +++ b/wcfsetup/install/files/lib/form/ModerationReportForm.class.php @@ -38,11 +38,11 @@ class ModerationReportForm extends AbstractModerationForm { parent::assignVariables(); $reportUser = UserProfile::getUserProfile($this->queue->userID); - if ($reportUser === null) $reportUser = new UserProfile(new User(null, array())); - WCF::getTPL()->assign(array( + if ($reportUser === null) $reportUser = new UserProfile(new User(null, [])); + WCF::getTPL()->assign([ 'reportedContent' => ModerationQueueReportManager::getInstance()->getReportedContent($this->queue), 'queueManager' => ModerationQueueReportManager::getInstance(), 'reportUser' => $reportUser - )); + ]); } } diff --git a/wcfsetup/install/files/lib/form/NewPasswordForm.class.php b/wcfsetup/install/files/lib/form/NewPasswordForm.class.php index 9df1e06ef9..8aa2827c1d 100644 --- a/wcfsetup/install/files/lib/form/NewPasswordForm.class.php +++ b/wcfsetup/install/files/lib/form/NewPasswordForm.class.php @@ -103,21 +103,21 @@ class NewPasswordForm extends AbstractForm { $this->newPassword = PasswordUtil::getRandomPassword((REGISTER_PASSWORD_MIN_LENGTH > 12 ? REGISTER_PASSWORD_MIN_LENGTH : 12)); // update user - $this->objectAction = new UserAction(array($this->user), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserAction([$this->user], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'password' => $this->newPassword, 'lastLostPasswordRequestTime' => 0, 'lostPasswordKey' => '' - )) - )); + ]) + ]); $this->objectAction->executeAction(); // send mail - $mail = new Mail(array($this->user->username => $this->user->email), WCF::getLanguage()->getDynamicVariable('wcf.user.newPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.newPassword.mail', array( + $mail = new Mail([$this->user->username => $this->user->email], WCF::getLanguage()->getDynamicVariable('wcf.user.newPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.newPassword.mail', [ 'username' => $this->user->username, 'userID' => $this->user->userID, 'newPassword' => $this->newPassword - ))); + ])); $mail->send(); $this->saved(); @@ -132,10 +132,10 @@ class NewPasswordForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'userID' => $this->userID, 'lostPasswordKey' => $this->lostPasswordKey - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/form/NotificationSettingsForm.class.php b/wcfsetup/install/files/lib/form/NotificationSettingsForm.class.php index 8e5e9a7cc7..e152046569 100644 --- a/wcfsetup/install/files/lib/form/NotificationSettingsForm.class.php +++ b/wcfsetup/install/files/lib/form/NotificationSettingsForm.class.php @@ -33,13 +33,13 @@ class NotificationSettingsForm extends AbstractForm { * list of settings by event * @var mixed[][] */ - public $settings = array(); + public $settings = []; /** * list of valid options for the mail notification type. * @var string[] */ - protected static $validMailNotificationTypes = array('none', 'instant', 'daily'); + protected static $validMailNotificationTypes = ['none', 'instant', 'daily']; /** * @see \wcf\page\IPage::readParameters() @@ -79,7 +79,7 @@ class NotificationSettingsForm extends AbstractForm { parent::validate(); // valid event ids - $validEventIDs = array(); + $validEventIDs = []; foreach ($this->events as $events) { foreach ($events as $event) { $validEventIDs[] = $event->eventID; @@ -118,14 +118,14 @@ class NotificationSettingsForm extends AbstractForm { // default values if (empty($_POST)) { // get user settings - $eventIDs = array(); + $eventIDs = []; foreach ($this->events as $events) { foreach ($events as $event) { $eventIDs[] = $event->eventID; - $this->settings[$event->eventID] = array( + $this->settings[$event->eventID] = [ 'enabled' => false, 'mailNotificationType' => 'none' - ); + ]; } } @@ -134,7 +134,7 @@ class NotificationSettingsForm extends AbstractForm { FROM wcf".WCF_N."_user_notification_event_to_user WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); while ($row = $statement->fetchArray()) { $this->settings[$row['eventID']]['enabled'] = true; $this->settings[$row['eventID']]['mailNotificationType'] = $row['mailNotificationType']; @@ -148,13 +148,13 @@ class NotificationSettingsForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - $groupedEvents = array(); + $groupedEvents = []; foreach ($this->events as $objectType => $events) { $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.notification.objectType', $objectType); $category = ($objectTypeObj->category ?: $objectType); if (!isset($groupedEvents[$category])) { - $groupedEvents[$category] = array(); + $groupedEvents[$category] = []; } foreach ($events as $event) $groupedEvents[$category][] = $event; @@ -162,10 +162,10 @@ class NotificationSettingsForm extends AbstractForm { ksort($groupedEvents); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'events' => $groupedEvents, 'settings' => $this->settings - )); + ]); } /** @@ -200,18 +200,18 @@ class NotificationSettingsForm extends AbstractForm { AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); - $newSettings = array(); + $newSettings = []; foreach ($this->settings as $eventID => $setting) { - $statement->execute(array( + $statement->execute([ $eventID, WCF::getUser()->userID - )); + ]); if ($setting['enabled']) { - $newSettings[] = array( + $newSettings[] = [ 'eventID' => $eventID, 'mailNotificationType' => $setting['mailNotificationType'] - ); + ]; } } @@ -221,11 +221,11 @@ class NotificationSettingsForm extends AbstractForm { VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($newSettings as $newSetting) { - $statement->execute(array( + $statement->execute([ $newSetting['eventID'], WCF::getUser()->userID, $newSetting['mailNotificationType'] - )); + ]); } } WCF::getDB()->commitTransaction(); diff --git a/wcfsetup/install/files/lib/form/RecaptchaForm.class.php b/wcfsetup/install/files/lib/form/RecaptchaForm.class.php index 19b702755a..9139b34b02 100644 --- a/wcfsetup/install/files/lib/form/RecaptchaForm.class.php +++ b/wcfsetup/install/files/lib/form/RecaptchaForm.class.php @@ -111,13 +111,13 @@ abstract class RecaptchaForm extends AbstractForm { } else { // V2 - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'recaptchaLegacyMode' => true - )); + ]); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'useCaptcha' => $this->useCaptcha - )); + ]); } } diff --git a/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php b/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php index afae3d22a8..0ca3463f60 100644 --- a/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php +++ b/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php @@ -96,7 +96,7 @@ class RegisterActivationForm extends AbstractForm { parent::save(); // enable user - $this->objectAction = new UserAction(array($this->user), 'enable', array('skipNotification' => true)); + $this->objectAction = new UserAction([$this->user], 'enable', ['skipNotification' => true]); $this->objectAction->executeAction(); $this->saved(); @@ -111,10 +111,10 @@ class RegisterActivationForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'username' => $this->username, 'activationCode' => $this->activationCode - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php b/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php index 813e741f3c..7cfb463079 100644 --- a/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php +++ b/wcfsetup/install/files/lib/form/RegisterNewActivationCodeForm.class.php @@ -138,23 +138,23 @@ class RegisterNewActivationCodeForm extends AbstractForm { $activationCode = UserRegistrationUtil::getActivationCode(); // save user - $parameters = array('activationCode' => $activationCode); + $parameters = ['activationCode' => $activationCode]; if (!empty($this->email)) $parameters['email'] = $this->email; - $this->objectAction = new UserAction(array($this->user), 'update', array( + $this->objectAction = new UserAction([$this->user], 'update', [ 'data' => array_merge($this->additionalFields, $parameters) - )); + ]); $this->objectAction->executeAction(); // reload user to reflect changes $this->user = new User($this->user->userID); // send activation mail - $mail = new Mail(array($this->user->username => (!empty($this->email) ? $this->email : $this->user->email)), WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail', array('user' => $this->user))); + $mail = new Mail([$this->user->username => (!empty($this->email) ? $this->email : $this->user->email)], WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.register.needActivation.mail', ['user' => $this->user])); $mail->send(); $this->saved(); // forward to index page - HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.user.newActivationCode.success', array('email' => (!empty($this->email) ? $this->email : $this->user->email))), 10); + HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.user.newActivationCode.success', ['email' => (!empty($this->email) ? $this->email : $this->user->email)]), 10); exit; } @@ -175,11 +175,11 @@ class RegisterNewActivationCodeForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'username' => $this->username, 'password' => $this->password, 'email' => $this->email - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/form/SearchForm.class.php b/wcfsetup/install/files/lib/form/SearchForm.class.php index 3a2030fd5a..0ee3410e66 100644 --- a/wcfsetup/install/files/lib/form/SearchForm.class.php +++ b/wcfsetup/install/files/lib/form/SearchForm.class.php @@ -31,7 +31,7 @@ class SearchForm extends AbstractCaptchaForm { * list of additional conditions * @var string[] */ - public $additionalConditions = array(); + public $additionalConditions = []; /** * end date @@ -67,7 +67,7 @@ class SearchForm extends AbstractCaptchaForm { * list of search results * @var array */ - public $results = array(); + public $results = []; /** * @see \wcf\page\SortablePage::$sortField @@ -100,7 +100,7 @@ class SearchForm extends AbstractCaptchaForm { * parameters used for previous search * @var array */ - public $searchData = array(); + public $searchData = []; /** * search id @@ -124,7 +124,7 @@ class SearchForm extends AbstractCaptchaForm { * selected object types * @var string[] */ - public $selectedObjectTypes = array(); + public $selectedObjectTypes = []; /** * start date @@ -263,11 +263,11 @@ class SearchForm extends AbstractCaptchaForm { } // build search hash - $this->searchHash = StringUtil::getHash(serialize(array($this->query, $this->selectedObjectTypes, !$this->subjectOnly, $this->searchIndexCondition, $this->additionalConditions, $this->sortField.' '.$this->sortOrder, PACKAGE_ID))); + $this->searchHash = StringUtil::getHash(serialize([$this->query, $this->selectedObjectTypes, !$this->subjectOnly, $this->searchIndexCondition, $this->additionalConditions, $this->sortField.' '.$this->sortOrder, PACKAGE_ID])); // check search hash if (!empty($this->query)) { - $parameters = array($this->searchHash, 'messages', TIME_NOW - 1800); + $parameters = [$this->searchHash, 'messages', TIME_NOW - 1800]; if (WCF::getUser()->userID) $parameters[] = WCF::getUser()->userID; $sql = "SELECT searchID @@ -280,7 +280,7 @@ class SearchForm extends AbstractCaptchaForm { $statement->execute($parameters); $row = $statement->fetchArray(); if ($row !== false) { - HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', array('id' => $row['searchID']), 'highlight='.urlencode($this->query))); + HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', ['id' => $row['searchID']], 'highlight='.urlencode($this->query))); exit; } } @@ -304,7 +304,7 @@ class SearchForm extends AbstractCaptchaForm { throw new NamedUserException(WCF::getLanguage()->get('wcf.search.error.user.noMatches')); } else { - throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.search.error.noMatches', array('query' => $this->query))); + throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.search.error.noMatches', ['query' => $this->query])); } } @@ -327,7 +327,7 @@ class SearchForm extends AbstractCaptchaForm { parent::save(); // get additional data - $additionalData = array(); + $additionalData = []; foreach (SearchEngine::getInstance()->getAvailableObjectTypes() as $objectTypeName => $objectType) { if (($data = $objectType->getAdditionalData()) !== null) { $additionalData[$objectTypeName] = $data; @@ -335,7 +335,7 @@ class SearchForm extends AbstractCaptchaForm { } // save result in database - $this->searchData = array( + $this->searchData = [ 'packageID' => PACKAGE_ID, 'query' => $this->query, 'results' => $this->results, @@ -350,24 +350,24 @@ class SearchForm extends AbstractCaptchaForm { 'userID' => $this->userID, 'selectedObjectTypes' => $this->selectedObjectTypes, 'alterable' => (!$this->userID ? 1 : 0) - ); + ]; if ($this->modifySearchID) { - $this->objectAction = new SearchAction(array($this->modifySearchID), 'update', array('data' => array( + $this->objectAction = new SearchAction([$this->modifySearchID], 'update', ['data' => [ 'searchData' => serialize($this->searchData), 'searchTime' => TIME_NOW, 'searchType' => 'messages', 'searchHash' => $this->searchHash - ))); + ]]); $this->objectAction->executeAction(); } else { - $this->objectAction = new SearchAction(array(), 'create', array('data' => array( + $this->objectAction = new SearchAction([], 'create', ['data' => [ 'userID' => (WCF::getUser()->userID ?: null), 'searchData' => serialize($this->searchData), 'searchTime' => TIME_NOW, 'searchType' => 'messages', 'searchHash' => $this->searchHash - ))); + ]]); $resultValues = $this->objectAction->executeAction(); $this->searchID = $resultValues['returnValues']->searchID; } @@ -387,10 +387,10 @@ class SearchForm extends AbstractCaptchaForm { } // forward to result page - HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', array( + HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', [ 'id' => $this->searchID, 'application' => $application - ), 'highlight='.urlencode($this->query))); + ], 'highlight='.urlencode($this->query))); exit; } @@ -403,7 +403,7 @@ class SearchForm extends AbstractCaptchaForm { // init form foreach (SearchEngine::getInstance()->getAvailableObjectTypes() as $objectType) $objectType->show($this); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'query' => $this->query, 'subjectOnly' => $this->subjectOnly, 'username' => $this->username, @@ -414,7 +414,7 @@ class SearchForm extends AbstractCaptchaForm { 'sortOrder' => $this->sortOrder, 'selectedObjectTypes' => $this->selectedObjectTypes, 'objectTypes' => SearchEngine::getInstance()->getAvailableObjectTypes() - )); + ]); } /** @@ -444,25 +444,25 @@ class SearchForm extends AbstractCaptchaForm { // user ids if (!empty($userIDs)) { - $this->searchIndexCondition->add('userID IN (?)', array($userIDs)); + $this->searchIndexCondition->add('userID IN (?)', [$userIDs]); } // dates $startDate = @strtotime($this->startDate); $endDate = @strtotime($this->endDate); if ($startDate && $endDate) { - $this->searchIndexCondition->add('time BETWEEN ? AND ?', array($startDate, $endDate)); + $this->searchIndexCondition->add('time BETWEEN ? AND ?', [$startDate, $endDate]); } else if ($startDate) { - $this->searchIndexCondition->add('time > ?', array($startDate)); + $this->searchIndexCondition->add('time > ?', [$startDate]); } else if ($endDate) { - $this->searchIndexCondition->add('time < ?', array($endDate)); + $this->searchIndexCondition->add('time < ?', [$endDate]); } // language if (!empty($this->query) && LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) { - $this->searchIndexCondition->add('(languageID IN (?) OR languageID = 0)', array(WCF::getUser()->getLanguageIDs())); + $this->searchIndexCondition->add('(languageID IN (?) OR languageID = 0)', [WCF::getUser()->getLanguageIDs()]); } foreach ($this->selectedObjectTypes as $key => $objectTypeName) { @@ -498,7 +498,7 @@ class SearchForm extends AbstractCaptchaForm { * @return integer[] */ public function getUserIDs() { - $userIDs = array(); + $userIDs = []; // username if (!empty($this->username)) { @@ -506,7 +506,7 @@ class SearchForm extends AbstractCaptchaForm { FROM wcf".WCF_N."_user WHERE username ".($this->nameExactly ? "= ?" : "LIKE ?"); $statement = WCF::getDB()->prepareStatement($sql, 100); - $statement->execute(array($this->username.(!$this->nameExactly ? '%' : ''))); + $statement->execute([$this->username.(!$this->nameExactly ? '%' : '')]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (empty($userIDs)) { diff --git a/wcfsetup/install/files/lib/form/SettingsForm.class.php b/wcfsetup/install/files/lib/form/SettingsForm.class.php index 63739b77ca..9c4fe3e85f 100644 --- a/wcfsetup/install/files/lib/form/SettingsForm.class.php +++ b/wcfsetup/install/files/lib/form/SettingsForm.class.php @@ -44,7 +44,7 @@ class SettingsForm extends AbstractForm { /** * @see \wcf\form\AbstractForm::$errorType */ - public $errorType = array(); + public $errorType = []; /** * option category @@ -56,25 +56,25 @@ class SettingsForm extends AbstractForm { * list of available content languages * @var Language[] */ - public $availableContentLanguages = array(); + public $availableContentLanguages = []; /** * list of available languages * @var Language[] */ - public $availableLanguages = array(); + public $availableLanguages = []; /** * list of available styles * @var Style[] */ - public $availableStyles = array(); + public $availableStyles = []; /** * list of content language ids * @var integer[] */ - public $contentLanguageIDs = array(); + public $contentLanguageIDs = []; /** * language id @@ -193,23 +193,23 @@ class SettingsForm extends AbstractForm { parent::save(); $saveOptions = $this->optionHandler->save(); - $parameters = array('options' => $saveOptions); + $parameters = ['options' => $saveOptions]; // static options if ($this->category == 'general') { - $parameters['data'] = array_merge($this->additionalFields, array( + $parameters['data'] = array_merge($this->additionalFields, [ 'languageID' => $this->languageID, 'styleID' => $this->styleID - )); + ]); $parameters['languageIDs'] = $this->contentLanguageIDs; } - $this->objectAction = new UserAction(array(WCF::getUser()), 'update', $parameters); + $this->objectAction = new UserAction([WCF::getUser()], 'update', $parameters); $this->objectAction->executeAction(); // static options if ($this->category == 'general') { // reset user language ids cache - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'languageIDs'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'languageIDs'); } $this->saved(); @@ -222,20 +222,20 @@ class SettingsForm extends AbstractForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'optionTree' => $this->optionHandler->getOptionTree(), 'category' => $this->category - )); + ]); // static options if ($this->category == 'general') { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'availableContentLanguages' => $this->availableContentLanguages, 'availableLanguages' => $this->availableLanguages, 'availableStyles' => $this->availableStyles, 'contentLanguageIDs' => $this->contentLanguageIDs, 'languageID' => $this->languageID, 'styleID' => $this->styleID - )); + ]); } } diff --git a/wcfsetup/install/files/lib/form/SignatureEditForm.class.php b/wcfsetup/install/files/lib/form/SignatureEditForm.class.php index e3356f8a60..10fa4c8010 100644 --- a/wcfsetup/install/files/lib/form/SignatureEditForm.class.php +++ b/wcfsetup/install/files/lib/form/SignatureEditForm.class.php @@ -31,7 +31,7 @@ class SignatureEditForm extends MessageForm { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_USER_SIGNATURE'); + public $neededModules = ['MODULE_USER_SIGNATURE']; /** * @see \wcf\page\AbstractPage::$templateName @@ -116,9 +116,9 @@ class SignatureEditForm extends MessageForm { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'signatureCache' => $this->signatureCache - )); + ]); } /** @@ -137,14 +137,14 @@ class SignatureEditForm extends MessageForm { public function save() { parent::save(); - $this->objectAction = new UserAction(array(WCF::getUser()), 'update', array( - 'data' => array_merge($this->additionalFields, array( + $this->objectAction = new UserAction([WCF::getUser()], 'update', [ + 'data' => array_merge($this->additionalFields, [ 'signature' => $this->text, 'signatureEnableBBCodes' => $this->enableBBCodes, 'signatureEnableHtml' => $this->enableHtml, 'signatureEnableSmilies' => $this->enableSmilies - )) - )); + ]) + ]); $this->objectAction->executeAction(); SignatureCache::getInstance()->getSignature(new User(WCF::getUser()->userID)); $this->saved(); diff --git a/wcfsetup/install/files/lib/page/AbstractFeedPage.class.php b/wcfsetup/install/files/lib/page/AbstractFeedPage.class.php index 4fd64e6b99..13b59f7a48 100644 --- a/wcfsetup/install/files/lib/page/AbstractFeedPage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractFeedPage.class.php @@ -34,7 +34,7 @@ abstract class AbstractFeedPage extends AbstractAuthedPage { * parsed contents of $_REQUEST['id'] * @var integer[] */ - public $objectIDs = array(); + public $objectIDs = []; /** * list of feed-entries for the current page @@ -54,10 +54,10 @@ abstract class AbstractFeedPage extends AbstractAuthedPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'items' => $this->items, 'title' => $this->title - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/page/AbstractPage.class.php b/wcfsetup/install/files/lib/page/AbstractPage.class.php index 648ae54363..e682661b50 100644 --- a/wcfsetup/install/files/lib/page/AbstractPage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractPage.class.php @@ -65,13 +65,13 @@ abstract class AbstractPage implements IPage, ITrackablePage { * needed modules to view this page * @var string[] */ - public $neededModules = array(); + public $neededModules = []; /** * needed permissions to view this page * @var string[] */ - public $neededPermissions = array(); + public $neededPermissions = []; /** * name of the template for the called page @@ -132,10 +132,10 @@ abstract class AbstractPage implements IPage, ITrackablePage { EventHandler::getInstance()->fireAction($this, 'assignVariables'); // assign parameters - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'action' => $this->action, 'templateName' => $this->templateName - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/page/AttachmentPage.class.php b/wcfsetup/install/files/lib/page/AttachmentPage.class.php index fc3637437f..9237765067 100644 --- a/wcfsetup/install/files/lib/page/AttachmentPage.class.php +++ b/wcfsetup/install/files/lib/page/AttachmentPage.class.php @@ -58,7 +58,7 @@ class AttachmentPage extends AbstractPage { * list of mime types which belong to files that are displayed inline * @var string[] */ - public static $inlineMimeTypes = array('image/gif', 'image/jpeg', 'image/png', 'image/x-png', 'application/pdf', 'image/pjpeg'); + public static $inlineMimeTypes = ['image/gif', 'image/jpeg', 'image/png', 'image/x-png', 'application/pdf', 'image/pjpeg']; /** * etag for this attachment @@ -78,7 +78,7 @@ class AttachmentPage extends AbstractPage { throw new IllegalLinkException(); } - $parameters = array('object' => $this->attachment); + $parameters = ['object' => $this->attachment]; if (isset($_REQUEST['tiny']) && $this->attachment->tinyThumbnailType) { $this->tiny = intval($_REQUEST['tiny']); $parameters['tiny'] = $this->tiny; @@ -142,7 +142,7 @@ class AttachmentPage extends AbstractPage { } // init file reader - $this->fileReader = new FileReader($location, array( + $this->fileReader = new FileReader($location, [ 'filename' => $this->attachment->filename, 'mimeType' => $mimeType, 'filesize' => $filesize, @@ -151,7 +151,7 @@ class AttachmentPage extends AbstractPage { 'lastModificationTime' => $this->attachment->uploadTime, 'expirationDate' => TIME_NOW + 31536000, 'maxAge' => 31536000 - )); + ]); if ($this->eTag !== null) { $this->fileReader->addHeader('ETag', '"'.$this->eTag.'"'); @@ -173,10 +173,10 @@ class AttachmentPage extends AbstractPage { if (!$this->tiny && !$this->thumbnail) { // update download count $editor = new AttachmentEditor($this->attachment); - $editor->update(array( + $editor->update([ 'downloads' => $this->attachment->downloads + 1, 'lastDownloadTime' => TIME_NOW - )); + ]); } // send file to client diff --git a/wcfsetup/install/files/lib/page/DeletedContentListPage.class.php b/wcfsetup/install/files/lib/page/DeletedContentListPage.class.php index 25419cd848..d5a2454fe2 100644 --- a/wcfsetup/install/files/lib/page/DeletedContentListPage.class.php +++ b/wcfsetup/install/files/lib/page/DeletedContentListPage.class.php @@ -23,7 +23,7 @@ class DeletedContentListPage extends MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('mod.general.canUseModeration'); + public $neededPermissions = ['mod.general.canUseModeration']; /** * object type object @@ -65,11 +65,11 @@ class DeletedContentListPage extends MultipleLinkPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'availableObjectTypes' => ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.deletedContent'), 'objectType' => $this->objectType->objectType, 'resultListTemplateName' => $this->objectType->getProcessor()->getTemplateName(), 'resultListApplication' => $this->objectType->getProcessor()->getApplication() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/page/FollowingPage.class.php b/wcfsetup/install/files/lib/page/FollowingPage.class.php index f9fae50ba6..61cb0c7e03 100644 --- a/wcfsetup/install/files/lib/page/FollowingPage.class.php +++ b/wcfsetup/install/files/lib/page/FollowingPage.class.php @@ -35,7 +35,7 @@ class FollowingPage extends MultipleLinkPage { protected function initObjectList() { parent::initObjectList(); - $this->objectList->getConditionBuilder()->add("user_follow.userID = ?", array(WCF::getUser()->userID)); + $this->objectList->getConditionBuilder()->add("user_follow.userID = ?", [WCF::getUser()->userID]); } /** diff --git a/wcfsetup/install/files/lib/page/IgnoredUsersPage.class.php b/wcfsetup/install/files/lib/page/IgnoredUsersPage.class.php index a813dd976f..30409cc2ba 100644 --- a/wcfsetup/install/files/lib/page/IgnoredUsersPage.class.php +++ b/wcfsetup/install/files/lib/page/IgnoredUsersPage.class.php @@ -35,7 +35,7 @@ class IgnoredUsersPage extends MultipleLinkPage { protected function initObjectList() { parent::initObjectList(); - $this->objectList->getConditionBuilder()->add("user_ignore.userID = ?", array(WCF::getUser()->userID)); + $this->objectList->getConditionBuilder()->add("user_ignore.userID = ?", [WCF::getUser()->userID]); } /** diff --git a/wcfsetup/install/files/lib/page/ModerationListPage.class.php b/wcfsetup/install/files/lib/page/ModerationListPage.class.php index 95f311b518..f748cfb08f 100644 --- a/wcfsetup/install/files/lib/page/ModerationListPage.class.php +++ b/wcfsetup/install/files/lib/page/ModerationListPage.class.php @@ -26,7 +26,7 @@ class ModerationListPage extends SortablePage { * list of available definitions * @var string[] */ - public $availableDefinitions = array(); + public $availableDefinitions = []; /** * @see \wcf\page\SortablePage::$defaultSortField @@ -52,7 +52,7 @@ class ModerationListPage extends SortablePage { /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('mod.general.canUseModeration'); + public $neededPermissions = ['mod.general.canUseModeration']; /** * @see \wcf\page\MultipleLinkPage::$objectListClassName @@ -68,7 +68,7 @@ class ModerationListPage extends SortablePage { /** * @see \wcf\page\SortablePage::$validSortFields */ - public $validSortFields = array('assignedUsername', 'lastChangeTime', 'queueID', 'time', 'username', 'comments'); + public $validSortFields = ['assignedUsername', 'lastChangeTime', 'queueID', 'time', 'username', 'comments']; /** * @see \wcf\page\IPage::readParameters() @@ -95,25 +95,25 @@ class ModerationListPage extends SortablePage { parent::initObjectList(); // filter by object type id - $objectTypeIDs = ModerationQueueManager::getInstance()->getObjectTypeIDs( ($this->definitionID ? array($this->definitionID) : array_keys($this->availableDefinitions)) ); + $objectTypeIDs = ModerationQueueManager::getInstance()->getObjectTypeIDs( ($this->definitionID ? [$this->definitionID] : array_keys($this->availableDefinitions)) ); if (empty($objectTypeIDs)) { // no object type ids given? screw that, display nothing $this->objectList->getConditionBuilder()->add("0 = 1"); return; } - $this->objectList->getConditionBuilder()->add("moderation_queue.objectTypeID IN (?)", array($objectTypeIDs)); + $this->objectList->getConditionBuilder()->add("moderation_queue.objectTypeID IN (?)", [$objectTypeIDs]); // filter by assigned user id if ($this->assignedUserID == 0) $this->objectList->getConditionBuilder()->add("moderation_queue.assignedUserID IS NULL"); - else if ($this->assignedUserID > 0) $this->objectList->getConditionBuilder()->add("moderation_queue.assignedUserID = ?", array($this->assignedUserID)); + else if ($this->assignedUserID > 0) $this->objectList->getConditionBuilder()->add("moderation_queue.assignedUserID = ?", [$this->assignedUserID]); // filter by status if ($this->status == ModerationQueue::STATUS_DONE) { - $this->objectList->getConditionBuilder()->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_DONE, ModerationQueue::STATUS_CONFIRMED, ModerationQueue::STATUS_REJECTED))); + $this->objectList->getConditionBuilder()->add("moderation_queue.status IN (?)", [[ModerationQueue::STATUS_DONE, ModerationQueue::STATUS_CONFIRMED, ModerationQueue::STATUS_REJECTED]]); } else { - $this->objectList->getConditionBuilder()->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); + $this->objectList->getConditionBuilder()->add("moderation_queue.status IN (?)", [[ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING]]); } } @@ -123,12 +123,12 @@ class ModerationListPage extends SortablePage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'assignedUserID' => $this->assignedUserID, 'availableDefinitions' => $this->availableDefinitions, 'definitionID' => $this->definitionID, 'definitionNames' => ModerationQueueManager::getInstance()->getDefinitionNamesByObjectTypeIDs(), 'status' => $this->status - )); + ]); } } diff --git a/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php b/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php index 569eae1244..3802af7790 100644 --- a/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php +++ b/wcfsetup/install/files/lib/page/MultipleLinkPage.class.php @@ -218,7 +218,7 @@ abstract class MultipleLinkPage extends AbstractPage { parent::assignVariables(); // assign page parameters - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'pageNo' => $this->pageNo, 'pages' => $this->pages, 'items' => $this->items, @@ -226,6 +226,6 @@ abstract class MultipleLinkPage extends AbstractPage { 'startIndex' => $this->startIndex, 'endIndex' => $this->endIndex, 'objects' => $this->objectList - )); + ]); } } diff --git a/wcfsetup/install/files/lib/page/NotificationListPage.class.php b/wcfsetup/install/files/lib/page/NotificationListPage.class.php index 37887bcbbc..11c03b2fc9 100644 --- a/wcfsetup/install/files/lib/page/NotificationListPage.class.php +++ b/wcfsetup/install/files/lib/page/NotificationListPage.class.php @@ -24,7 +24,7 @@ class NotificationListPage extends MultipleLinkPage { * list of outstanding notifications * @var mixed[][] */ - public $notifications = array(); + public $notifications = []; /** * @see \wcf\page\MultipleLinkPage::countItems() @@ -58,9 +58,9 @@ class NotificationListPage extends MultipleLinkPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'notifications' => $this->notifications - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/page/PaidSubscriptionListPage.class.php b/wcfsetup/install/files/lib/page/PaidSubscriptionListPage.class.php index f089d7f1a3..a28cc217d1 100644 --- a/wcfsetup/install/files/lib/page/PaidSubscriptionListPage.class.php +++ b/wcfsetup/install/files/lib/page/PaidSubscriptionListPage.class.php @@ -24,19 +24,19 @@ class PaidSubscriptionListPage extends AbstractPage { /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_PAID_SUBSCRIPTION'); + public $neededModules = ['MODULE_PAID_SUBSCRIPTION']; /** * list of available paid subscriptions * @var array */ - public $subscriptions = array(); + public $subscriptions = []; /** * list of user subscriptions * @var \wcf\data\paid\subscription\user\PaidSubscriptionUserList */ - public $userSubscriptionList = array(); + public $userSubscriptionList = []; /** * @see \wcf\page\AbstractPage::readData() @@ -49,8 +49,8 @@ class PaidSubscriptionListPage extends AbstractPage { // get user subscriptions $this->userSubscriptionList = new PaidSubscriptionUserList(); - $this->userSubscriptionList->getConditionBuilder()->add('userID = ?', array(WCF::getUser()->userID)); - $this->userSubscriptionList->getConditionBuilder()->add('isActive = ?', array(1)); + $this->userSubscriptionList->getConditionBuilder()->add('userID = ?', [WCF::getUser()->userID]); + $this->userSubscriptionList->getConditionBuilder()->add('isActive = ?', [1]); $this->userSubscriptionList->readObjects(); foreach ($this->userSubscriptionList as $userSubscription) { @@ -74,10 +74,10 @@ class PaidSubscriptionListPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'subscriptions' => $this->subscriptions, 'userSubscriptions' => $this->userSubscriptionList - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/page/PaidSubscriptionReturnPage.class.php b/wcfsetup/install/files/lib/page/PaidSubscriptionReturnPage.class.php index 5d9bf0f2b3..cf13950ff7 100644 --- a/wcfsetup/install/files/lib/page/PaidSubscriptionReturnPage.class.php +++ b/wcfsetup/install/files/lib/page/PaidSubscriptionReturnPage.class.php @@ -25,10 +25,10 @@ class PaidSubscriptionReturnPage extends AbstractPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'message' => WCF::getLanguage()->get('wcf.paidSubscription.returnMessage'), 'wait' => 60, 'url' => LinkHandler::getInstance()->getLink() - )); + ]); } } diff --git a/wcfsetup/install/files/lib/page/SearchResultPage.class.php b/wcfsetup/install/files/lib/page/SearchResultPage.class.php index 4d2143640f..a125e32802 100644 --- a/wcfsetup/install/files/lib/page/SearchResultPage.class.php +++ b/wcfsetup/install/files/lib/page/SearchResultPage.class.php @@ -48,7 +48,7 @@ class SearchResultPage extends MultipleLinkPage { * messages * @var array */ - public $messages = array(); + public $messages = []; /** * search data @@ -114,14 +114,14 @@ class SearchResultPage extends MultipleLinkPage { * Caches the message data. */ protected function cacheMessageData() { - $types = array(); + $types = []; // group object id by object type for ($i = $this->startIndex - 1; $i < $this->endIndex; $i++) { $type = $this->searchData['results'][$i]['objectType']; $objectID = $this->searchData['results'][$i]['objectID']; - if (!isset($types[$type])) $types[$type] = array(); + if (!isset($types[$type])) $types[$type] = []; $types[$type][] = $objectID; } @@ -156,7 +156,7 @@ class SearchResultPage extends MultipleLinkPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'query' => $this->searchData['query'], 'objects' => $this->messages, 'searchData' => $this->searchData, @@ -169,7 +169,7 @@ class SearchResultPage extends MultipleLinkPage { 'resultListTemplateName' => $this->resultListTemplateName, 'resultListApplication' => $this->resultListApplication, 'application' => ApplicationHandler::getInstance()->getAbbreviation(ApplicationHandler::getInstance()->getActiveApplication()->packageID) - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/page/SortablePage.class.php b/wcfsetup/install/files/lib/page/SortablePage.class.php index 8c71eaf317..4461c0f4c3 100644 --- a/wcfsetup/install/files/lib/page/SortablePage.class.php +++ b/wcfsetup/install/files/lib/page/SortablePage.class.php @@ -31,7 +31,7 @@ abstract class SortablePage extends MultipleLinkPage { * list of valid sort fields * @var string[] */ - public $validSortFields = array(); + public $validSortFields = []; /** * @see \wcf\page\IPage::readParameters() @@ -90,9 +90,9 @@ abstract class SortablePage extends MultipleLinkPage { parent::assignVariables(); // assign sorting parameters - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'sortField' => $this->sortField, 'sortOrder' => $this->sortOrder - )); + ]); } } diff --git a/wcfsetup/install/files/lib/page/TaggedPage.class.php b/wcfsetup/install/files/lib/page/TaggedPage.class.php index 222e51cd5d..139dc29dc6 100644 --- a/wcfsetup/install/files/lib/page/TaggedPage.class.php +++ b/wcfsetup/install/files/lib/page/TaggedPage.class.php @@ -23,17 +23,17 @@ class TaggedPage extends MultipleLinkPage { * list of available taggable object types * @var ObjectType[] */ - public $availableObjectTypes = array(); + public $availableObjectTypes = []; /** * @see \wcf\page\AbstractPage::$neededModules */ - public $neededModules = array('MODULE_TAGGING'); + public $neededModules = ['MODULE_TAGGING']; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('user.tag.canViewTag'); + public $neededPermissions = ['user.tag.canViewTag']; /** * tag id @@ -120,14 +120,14 @@ class TaggedPage extends MultipleLinkPage { public function assignVariables() { parent::assignVariables(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'tag' => $this->tag, 'tags' => $this->tagCloud->getTags(100), 'availableObjectTypes' => $this->availableObjectTypes, 'objectType' => $this->objectType->objectType, 'resultListTemplateName' => $this->objectType->getProcessor()->getTemplateName(), 'resultListApplication' => $this->objectType->getProcessor()->getApplication() - )); + ]); if (count($this->objectList) === 0) { @header('HTTP/1.0 404 Not Found'); diff --git a/wcfsetup/install/files/lib/system/CLIWCF.class.php b/wcfsetup/install/files/lib/system/CLIWCF.class.php index c7b4cbfa25..fd83c3d4e3 100644 --- a/wcfsetup/install/files/lib/system/CLIWCF.class.php +++ b/wcfsetup/install/files/lib/system/CLIWCF.class.php @@ -22,7 +22,7 @@ use Zend\Console\Getopt as ArgvParser; use Zend\Loader\StandardAutoloader as ZendLoader; // set exception handler -set_exception_handler(array('wcf\system\CLIWCF', 'handleCLIException')); +set_exception_handler(['wcf\system\CLIWCF', 'handleCLIException']); /** * Extends WCF class with functions for CLI. @@ -60,12 +60,12 @@ class CLIWCF extends WCF { // register additional autoloaders require_once(WCF_DIR.'lib/system/api/phpline/phpline.phar'); require_once(WCF_DIR.'lib/system/api/zend/Loader/StandardAutoloader.php'); - $zendLoader = new ZendLoader(array(ZendLoader::AUTOREGISTER_ZF => true)); + $zendLoader = new ZendLoader([ZendLoader::AUTOREGISTER_ZF => true]); $zendLoader->register(); - $argv = new ArgvParser(array( + $argv = new ArgvParser([ 'packageID=i' => '' - )); + ]); $argv->setOption(ArgvParser::CONFIG_FREEFORM_FLAGS, true); $argv->parse(); define('PACKAGE_ID', $argv->packageID ?: 1); @@ -83,7 +83,7 @@ class CLIWCF extends WCF { $this->initApplications(); // the destructor registered in core.functions.php will only call the destructor of the parent class - register_shutdown_function(array('wcf\system\CLIWCF', 'destruct')); + register_shutdown_function(['wcf\system\CLIWCF', 'destruct']); $this->initArgv(); $this->initPHPLine(); @@ -116,7 +116,7 @@ class CLIWCF extends WCF { */ protected function initArgv() { // initialise ArgvParser - self::$argvParser = new ArgvParser(array( + self::$argvParser = new ArgvParser([ 'language=s' => WCF::getLanguage()->get('wcf.cli.help.language'), 'v' => WCF::getLanguage()->get('wcf.cli.help.v'), 'q' => WCF::getLanguage()->get('wcf.cli.help.q'), @@ -125,11 +125,11 @@ class CLIWCF extends WCF { 'disableUpdateCheck' => WCF::getLanguage()->get('wcf.cli.help.disableUpdateCheck'), 'exitOnFail' => WCF::getLanguage()->get('wcf.cli.help.exitOnFail'), 'packageID=i' => WCF::getLanguage()->get('wcf.cli.help.packageID') - )); - self::getArgvParser()->setOptions(array( + ]); + self::getArgvParser()->setOptions([ ArgvParser::CONFIG_CUMULATIVE_FLAGS => true, ArgvParser::CONFIG_DASHDASH => false - )); + ]); // parse arguments EventHandler::getInstance()->fireAction($this, 'beforeArgumentParsing'); @@ -154,7 +154,7 @@ class CLIWCF extends WCF { $help = WCF::getLanguage()->get('wcf.cli.help.'.self::getArgvParser()->help.'.description', true); if ($help) echo $help.PHP_EOL; else { - echo WCF::getLanguage()->getDynamicVariable('wcf.cli.help.noLongHelp', array('topic' => self::getArgvParser()->help)).PHP_EOL; + echo WCF::getLanguage()->getDynamicVariable('wcf.cli.help.noLongHelp', ['topic' => self::getArgvParser()->help]).PHP_EOL; } exit; } @@ -167,7 +167,7 @@ class CLIWCF extends WCF { // set language $language = LanguageFactory::getInstance()->getLanguageByCode(self::getArgvParser()->language); if ($language === null) { - echo WCF::getLanguage()->getDynamicVariable('wcf.cli.error.language.notFound', array('languageCode' => self::getArgvParser()->language)).PHP_EOL; + echo WCF::getLanguage()->getDynamicVariable('wcf.cli.error.language.notFound', ['languageCode' => self::getArgvParser()->language]).PHP_EOL; exit; } self::setLanguage($language->languageID); @@ -246,7 +246,7 @@ class CLIWCF extends WCF { WCF::getSession()->changeUser($user); } catch (UserInputException $e) { - $message = WCF::getLanguage()->getDynamicVariable('wcf.user.'.$e->getField().'.error.'.$e->getType(), array('username' => $username)); + $message = WCF::getLanguage()->getDynamicVariable('wcf.user.'.$e->getField().'.error.'.$e->getType(), ['username' => $username]); self::getReader()->println($message); exit(1); } @@ -281,8 +281,8 @@ class CLIWCF extends WCF { $command->execute(CLICommandHandler::getParameters($line)); } catch (IllegalLinkException $e) { - Log::error('notFound:'.JSON::encode(array('command' => $line))); - self::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.cli.error.command.notFound', array('command' => $line))); + Log::error('notFound:'.JSON::encode(['command' => $line])); + self::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.cli.error.command.notFound', ['command' => $line])); if (self::getArgvParser()->exitOnFail) { exit(1); @@ -331,20 +331,20 @@ class CLIWCF extends WCF { self::getReader()->println(count($updates) . ' update' . (count($updates) > 1 ? 's are' : ' is') . ' available'); if (VERBOSITY >= 1) { - $table = array( - array( + $table = [ + [ WCF::getLanguage()->get('wcf.acp.package.name'), WCF::getLanguage()->get('wcf.acp.package.version'), WCF::getLanguage()->get('wcf.acp.package.newVersion') - ) - ); + ] + ]; foreach ($updates as $update) { - $row = array( + $row = [ WCF::getLanguage()->get($update['packageName']), $update['packageVersion'], $update['version']['packageVersion'] - ); + ]; $table[] = $row; } diff --git a/wcfsetup/install/files/lib/system/MetaTagHandler.class.php b/wcfsetup/install/files/lib/system/MetaTagHandler.class.php index 101ce038b6..8043841505 100644 --- a/wcfsetup/install/files/lib/system/MetaTagHandler.class.php +++ b/wcfsetup/install/files/lib/system/MetaTagHandler.class.php @@ -29,7 +29,7 @@ class MetaTagHandler extends SingletonFactory implements \Countable, \Iterator { * list of meta tags * @var array */ - protected $objects = array(); + protected $objects = []; /** * @see \wcf\system\SingletonFactory::init() @@ -54,11 +54,11 @@ class MetaTagHandler extends SingletonFactory implements \Countable, \Iterator { $this->indexToObject[] = $identifier; } - $this->objects[$identifier] = array( + $this->objects[$identifier] = [ 'isProperty' => $isProperty, 'name' => $name, 'value' => $value - ); + ]; // replace description if Open Graph Protocol tag was given if ($name == 'og:description') { diff --git a/wcfsetup/install/files/lib/system/Regex.class.php b/wcfsetup/install/files/lib/system/Regex.class.php index 3d95a73f17..ad163203e7 100644 --- a/wcfsetup/install/files/lib/system/Regex.class.php +++ b/wcfsetup/install/files/lib/system/Regex.class.php @@ -126,7 +126,7 @@ final class Regex { * last matches * @var array */ - private $matches = array(); + private $matches = []; /** * Creates a regex. diff --git a/wcfsetup/install/files/lib/system/SingletonFactory.class.php b/wcfsetup/install/files/lib/system/SingletonFactory.class.php index a8afb3bb68..64773846f0 100644 --- a/wcfsetup/install/files/lib/system/SingletonFactory.class.php +++ b/wcfsetup/install/files/lib/system/SingletonFactory.class.php @@ -17,7 +17,7 @@ abstract class SingletonFactory { * list of singletons * @var SingletonFactory[] */ - protected static $__singletonObjects = array(); + protected static $__singletonObjects = []; /** * Singletons do not support a public constructor. Override init() if diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index c349b58029..f6eb9a1c36 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -71,31 +71,31 @@ class WCF { * list of currently loaded applications * @var Application[] */ - protected static $applications = array(); + protected static $applications = []; /** * list of currently loaded application objects * @var IApplication[] */ - protected static $applicationObjects = array(); + protected static $applicationObjects = []; /** * list of autoload directories * @var array */ - protected static $autoloadDirectories = array(); + protected static $autoloadDirectories = []; /** * list of unique instances of each core object * @var SingletonFactory[] */ - protected static $coreObject = array(); + protected static $coreObject = []; /** * list of cached core objects * @var string[] */ - protected static $coreObjectCache = array(); + protected static $coreObjectCache = []; /** * database object @@ -449,7 +449,7 @@ class WCF { */ protected function initApplications() { // step 1) load all applications - $loadedApplications = array(); + $loadedApplications = []; // register WCF as application self::$applications['wcf'] = ApplicationHandler::getInstance()->getApplicationByID(1); @@ -551,7 +551,7 @@ class WCF { } // init application and assign it as template variable - self::$applicationObjects[$application->packageID] = call_user_func(array($className, 'getInstance')); + self::$applicationObjects[$application->packageID] = call_user_func([$className, 'getInstance']); $this->getTPL()->assign('__'.$abbreviation, self::$applicationObjects[$application->packageID]); } else { @@ -620,11 +620,11 @@ class WCF { * Assigns some default variables to the template engine. */ protected function assignDefaultTemplateVariables() { - self::getTPL()->registerPrefilter(array('event', 'hascontent', 'lang')); - self::getTPL()->assign(array( + self::getTPL()->registerPrefilter(['event', 'hascontent', 'lang']); + self::getTPL()->assign([ '__wcf' => $this, '__wcfVersion' => LAST_UPDATE_TIME // @deprecated since 2.1, use LAST_UPDATE_TIME directly - )); + ]); } /** @@ -723,7 +723,7 @@ class WCF { throw new SystemException("class '".$objectName."' does not implement the interface 'SingletonFactory'"); } - self::$coreObject[$className] = call_user_func(array($objectName, 'getInstance')); + self::$coreObject[$className] = call_user_func([$objectName, 'getInstance']); return self::$coreObject[$className]; } } diff --git a/wcfsetup/install/files/lib/system/WCFACP.class.php b/wcfsetup/install/files/lib/system/WCFACP.class.php index 9a8c333c9e..bfe28b5fc1 100644 --- a/wcfsetup/install/files/lib/system/WCFACP.class.php +++ b/wcfsetup/install/files/lib/system/WCFACP.class.php @@ -162,14 +162,14 @@ class WCFACP extends WCF { // work-around for AJAX-requests within ACP if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { try { - WCF::getSession()->checkPermissions(array('admin.general.canUseAcp')); + WCF::getSession()->checkPermissions(['admin.general.canUseAcp']); } catch (PermissionDeniedException $e) { throw new AJAXException(self::getLanguage()->get('wcf.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS, $e->getTraceAsString()); } } else { - WCF::getSession()->checkPermissions(array('admin.general.canUseAcp')); + WCF::getSession()->checkPermissions(['admin.general.canUseAcp']); } // force debug mode if in ACP and authenticated @@ -210,9 +210,9 @@ class WCFACP extends WCF { $host = RouteHandler::getHost(); $path = RouteHandler::getPath(); - self::getTPL()->assign(array( + self::getTPL()->assign([ 'baseHref' => $host . $path - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php b/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php index 4fa5589ad8..53974372c7 100644 --- a/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php +++ b/wcfsetup/install/files/lib/system/acl/ACLHandler.class.php @@ -35,13 +35,13 @@ class ACLHandler extends SingletonFactory { * list of available object types * @var array */ - protected $availableObjectTypes = array(); + protected $availableObjectTypes = []; /** * list of acl option categories sorted by their object type id and name * @var ACLOptionCategory[][] */ - protected $categories = array(); + protected $categories = []; /** * Assignes the acl values to the template. @@ -50,23 +50,23 @@ class ACLHandler extends SingletonFactory { */ public function assignVariables($objectTypeID) { if (WCF::getTPL()->get('aclValues') === null) { - WCF::getTPL()->assign('aclValues', array()); + WCF::getTPL()->assign('aclValues', []); } if (!$this->assignVariablesDisabled && isset($_POST['aclValues'])) { $values = $_POST['aclValues']; - $data = $this->getPermissions($objectTypeID, array(), null, true); + $data = $this->getPermissions($objectTypeID, [], null, true); foreach ($values as $type => $optionData) { if ($type === 'user') { $users = User::getUsers(array_keys($optionData)); } - $values[$type] = array( - 'label' => array(), - 'option' => array() - ); + $values[$type] = [ + 'label' => [], + 'option' => [] + ]; foreach ($optionData as $typeID => $optionValues) { foreach ($optionValues as $optionID => $optionValue) { @@ -93,9 +93,9 @@ class ACLHandler extends SingletonFactory { $values['options'] = $data['options']; $values['categories'] = $data['categories']; - WCF::getTPL()->append('aclValues', array( + WCF::getTPL()->append('aclValues', [ $objectTypeID => $values - )); + ]); } } @@ -177,8 +177,8 @@ class ACLHandler extends SingletonFactory { // remove previous values $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionID IN (?)", array(array_keys($options))); - $conditions->add("objectID = ?", array($objectID)); + $conditions->add("optionID IN (?)", [array_keys($options)]); + $conditions->add("objectID = ?", [$objectID]); $sql = "DELETE FROM wcf".WCF_N."_acl_option_to_".$type." ".$conditions; @@ -204,12 +204,12 @@ class ACLHandler extends SingletonFactory { continue; } - $statement->execute(array( + $statement->execute([ $optionID, $objectID, $typeID, $optionValue - )); + ]); } } WCF::getDB()->commitTransaction(); @@ -227,11 +227,11 @@ class ACLHandler extends SingletonFactory { public function getPermissions($objectTypeID, array $objectIDs, $categoryName = '', $settingsView = false) { $optionList = $this->getOptions($objectTypeID, $categoryName); - $data = array( + $data = [ 'options' => $optionList, - 'group' => array(), - 'user' => array() - ); + 'group' => [], + 'user' => [] + ]; if (!empty($objectIDs)) { $this->getValues($optionList, 'group', $objectIDs, $data, $settingsView); @@ -242,17 +242,17 @@ class ACLHandler extends SingletonFactory { if ($settingsView) { $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID); - $data['options'] = array(); - $data['categories'] = array(); + $data['options'] = []; + $data['categories'] = []; if (count($optionList)) { - $categoryNames = array(); + $categoryNames = []; foreach ($optionList as $option) { - $data['options'][$option->optionID] = array( + $data['options'][$option->optionID] = [ 'categoryName' => $option->categoryName, 'label' => WCF::getLanguage()->get('wcf.acl.option.'.$objectType->objectType.'.'.$option->optionName), 'optionName' => $option->optionName - ); + ]; if (!in_array($option->categoryName, $categoryNames)) { $categoryNames[] = $option->categoryName; @@ -261,8 +261,8 @@ class ACLHandler extends SingletonFactory { // load categories $categoryList = new ACLOptionCategoryList(); - $categoryList->getConditionBuilder()->add("acl_option_category.categoryName IN (?)", array($categoryNames)); - $categoryList->getConditionBuilder()->add("acl_option_category.objectTypeID = ?", array($objectTypeID)); + $categoryList->getConditionBuilder()->add("acl_option_category.categoryName IN (?)", [$categoryNames]); + $categoryList->getConditionBuilder()->add("acl_option_category.objectTypeID = ?", [$objectTypeID]); $categoryList->readObjects(); foreach ($categoryList as $category) { @@ -284,8 +284,8 @@ class ACLHandler extends SingletonFactory { * @param boolean $settingsView */ protected function getValues(ACLOptionList $optionList, $type, array $objectIDs, array &$data, $settingsView) { - $data[$type] = array(); - $optionsIDs = array(); + $data[$type] = []; + $optionsIDs = []; foreach ($optionList as $option) { $optionsIDs[] = $option->optionID; } @@ -297,8 +297,8 @@ class ACLHandler extends SingletonFactory { $columnID = $type.'ID'; $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionID IN (?)", array($optionsIDs)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("optionID IN (?)", [$optionsIDs]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "SELECT * FROM wcf".WCF_N."_acl_option_to_".$type." ".$conditions; @@ -306,11 +306,11 @@ class ACLHandler extends SingletonFactory { $statement->execute($conditions->getParameters()); while ($row = $statement->fetchArray()) { if (!isset($data[$type][$row['objectID']])) { - $data[$type][$row['objectID']] = array(); + $data[$type][$row['objectID']] = []; } if (!isset($data[$type][$row['objectID']][$row[$columnID]])) { - $data[$type][$row['objectID']][$row[$columnID]] = array(); + $data[$type][$row['objectID']][$row[$columnID]] = []; } $data[$type][$row['objectID']][$row[$columnID]][$row['optionID']] = $row['optionValue']; @@ -320,21 +320,21 @@ class ACLHandler extends SingletonFactory { if ($settingsView) { $objectID = current($objectIDs); if (!isset($data[$type][$objectID])) { - $data[$type][$objectID] = array(); + $data[$type][$objectID] = []; } // build JS-compilant structure - $data[$type] = array( - 'label' => array(), + $data[$type] = [ + 'label' => [], 'option' => $data[$type][$objectID] - ); + ]; // load labels if (!empty($data[$type]['option'])) { $conditions = new PreparedStatementConditionBuilder(); if ($type == 'group') { - $conditions->add("groupID IN (?)", array(array_keys($data[$type]['option']))); + $conditions->add("groupID IN (?)", [array_keys($data[$type]['option'])]); $sql = "SELECT groupID, groupName FROM wcf".WCF_N."_user_group ".$conditions; @@ -346,7 +346,7 @@ class ACLHandler extends SingletonFactory { } } else { - $conditions->add("userID IN (?)", array(array_keys($data[$type]['option']))); + $conditions->add("userID IN (?)", [array_keys($data[$type]['option'])]); $sql = "SELECT userID, username FROM wcf".WCF_N."_user ".$conditions; @@ -373,13 +373,13 @@ class ACLHandler extends SingletonFactory { if (!empty($categoryName)) { if (StringUtil::endsWith($categoryName, '.*')) { $categoryName = mb_substr($categoryName, 0, -1) . '%'; - $optionList->getConditionBuilder()->add("acl_option.categoryName LIKE ?", array($categoryName)); + $optionList->getConditionBuilder()->add("acl_option.categoryName LIKE ?", [$categoryName]); } else { - $optionList->getConditionBuilder()->add("acl_option.categoryName = ?", array($categoryName)); + $optionList->getConditionBuilder()->add("acl_option.categoryName = ?", [$categoryName]); } } - $optionList->getConditionBuilder()->add("acl_option.objectTypeID = ?", array($objectTypeID)); + $optionList->getConditionBuilder()->add("acl_option.objectTypeID = ?", [$objectTypeID]); $optionList->readObjects(); return $optionList; @@ -397,11 +397,11 @@ class ACLHandler extends SingletonFactory { $options = $optionList->getObjects(); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionID IN (?)", array(array_keys($options))); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("optionID IN (?)", [array_keys($options)]); + $conditions->add("objectID IN (?)", [$objectIDs]); WCF::getDB()->beginTransaction(); - foreach (array('group', 'user') as $type) { + foreach (['group', 'user'] as $type) { $sql = "DELETE FROM wcf".WCF_N."_acl_option_to_".$type." ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); diff --git a/wcfsetup/install/files/lib/system/ad/AdHandler.class.php b/wcfsetup/install/files/lib/system/ad/AdHandler.class.php index 333950d183..01da2e9634 100644 --- a/wcfsetup/install/files/lib/system/ad/AdHandler.class.php +++ b/wcfsetup/install/files/lib/system/ad/AdHandler.class.php @@ -22,13 +22,13 @@ class AdHandler extends SingletonFactory { * list of ad objects grouped by ad location * @var array */ - protected $ads = array(); + protected $ads = []; /** * list of ad location object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * Returns the ad output for the given ad location. @@ -75,7 +75,7 @@ class AdHandler extends SingletonFactory { return $this->objectTypes; } - $objectTypes = array(); + $objectTypes = []; foreach ($this->objectTypes as $key => $objectType) { if ($objectType->categoryname == $categoryName) { $objectTypes[$key] = $objectType; @@ -100,11 +100,11 @@ class AdHandler extends SingletonFactory { } } - $selection = array(); + $selection = []; foreach ($objectTypes as $objectType) { $categoryName = WCF::getLanguage()->get('wcf.acp.ad.location.category.'.$objectType->categoryname); if (!isset($selection[$categoryName])) { - $selection[$categoryName] = array(); + $selection[$categoryName] = []; } $selection[$categoryName][$objectType->objectTypeID] = WCF::getLanguage()->get('wcf.acp.ad.location.'.$objectType->objectType); @@ -120,9 +120,9 @@ class AdHandler extends SingletonFactory { ksort($selection); - $selection = array_merge(array( + $selection = array_merge([ $globalCategory => $globalLocations - ), $selection); + ], $selection); return $selection; } diff --git a/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php b/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php index 0c77c8e433..4c77c7c17d 100644 --- a/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php +++ b/wcfsetup/install/files/lib/system/application/AbstractApplication.class.php @@ -98,6 +98,6 @@ abstract class AbstractApplication extends SingletonFactory implements IApplicat * @see \wcf\system\application\IApplication::__callStatic() */ public static function __callStatic($method, array $arguments) { - return call_user_func_array(array('wcf\system\WCF', $method), $arguments); + return call_user_func_array(['wcf\system\WCF', $method], $arguments); } } diff --git a/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php b/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php index 4135689735..8e25c41319 100644 --- a/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php +++ b/wcfsetup/install/files/lib/system/attachment/AbstractAttachmentObjectType.class.php @@ -19,7 +19,7 @@ abstract class AbstractAttachmentObjectType implements IAttachmentObjectType { * cached objects * @var DatabaseObject[] */ - protected $cachedObjects = array(); + protected $cachedObjects = []; /** * @see \wcf\system\attachment\IAttachmentObjectType::getMaxSize() @@ -77,10 +77,10 @@ abstract class AbstractAttachmentObjectType implements IAttachmentObjectType { */ public function setPermissions(array $attachments) { foreach ($attachments as $attachment) { - $attachment->setPermissions(array( + $attachment->setPermissions([ 'canDownload' => $this->canDownload($attachment->objectID), 'canViewPreview' => $this->canViewPreview($attachment->objectID) - )); + ]); } } } diff --git a/wcfsetup/install/files/lib/system/attachment/AttachmentHandler.class.php b/wcfsetup/install/files/lib/system/attachment/AttachmentHandler.class.php index 3c38fb7a2b..2b1e92b586 100644 --- a/wcfsetup/install/files/lib/system/attachment/AttachmentHandler.class.php +++ b/wcfsetup/install/files/lib/system/attachment/AttachmentHandler.class.php @@ -83,12 +83,12 @@ class AttachmentHandler implements \Countable { if ($this->attachmentList === null) { $this->attachmentList = new AttachmentList(); $this->attachmentList->sqlOrderBy = 'attachment.showOrder'; - $this->attachmentList->getConditionBuilder()->add('objectTypeID = ?', array($this->objectType->objectTypeID)); + $this->attachmentList->getConditionBuilder()->add('objectTypeID = ?', [$this->objectType->objectTypeID]); if ($this->objectID) { - $this->attachmentList->getConditionBuilder()->add('objectID = ?', array($this->objectID)); + $this->attachmentList->getConditionBuilder()->add('objectID = ?', [$this->objectID]); } else { - $this->attachmentList->getConditionBuilder()->add('tmpHash = ?', array($this->tmpHash)); + $this->attachmentList->getConditionBuilder()->add('tmpHash = ?', [$this->tmpHash]); } $this->attachmentList->readObjects(); } @@ -115,7 +115,7 @@ class AttachmentHandler implements \Countable { WHERE objectTypeID = ? AND tmpHash = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($objectID, $this->objectType->objectTypeID, $this->tmpHash)); + $statement->execute([$objectID, $this->objectType->objectTypeID, $this->tmpHash]); } /** @@ -127,8 +127,8 @@ class AttachmentHandler implements \Countable { */ public static function transferAttachments($objectType, $newObjectID, array $oldObjectIDs) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array(ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', $objectType)->objectTypeID)); - $conditions->add("objectID IN (?)", array($oldObjectIDs)); + $conditions->add("objectTypeID = ?", [ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', $objectType)->objectTypeID]); + $conditions->add("objectID IN (?)", [$oldObjectIDs]); $parameters = $conditions->getParameters(); array_unshift($parameters, $newObjectID); @@ -147,8 +147,8 @@ class AttachmentHandler implements \Countable { */ public static function removeAttachments($objectType, array $objectIDs) { $attachmentList = new AttachmentList(); - $attachmentList->getConditionBuilder()->add("objectTypeID = ?", array(ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', $objectType)->objectTypeID)); - $attachmentList->getConditionBuilder()->add("objectID IN (?)", array($objectIDs)); + $attachmentList->getConditionBuilder()->add("objectTypeID = ?", [ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', $objectType)->objectTypeID]); + $attachmentList->getConditionBuilder()->add("objectID IN (?)", [$objectIDs]); $attachmentList->readObjects(); if (count($attachmentList)) { diff --git a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php index 674ce706c3..ba2d3cd6a5 100644 --- a/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/AttachmentBBCode.class.php @@ -80,15 +80,15 @@ class AttachmentBBCode extends AbstractBBCode { $class = 'messageFloatObject'.ucfirst($alignment); } - $source = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', array('object' => $attachment))); + $source = StringUtil::encodeHTML(LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment])); $title = StringUtil::encodeHTML($attachment->filename); $result = ''; } else { - $linkParameters = array( + $linkParameters = [ 'object' => $attachment - ); + ]; if ($attachment->hasThumbnail()) $linkParameters['thumbnail'] = 1; $class = ''; @@ -107,7 +107,7 @@ class AttachmentBBCode extends AbstractBBCode { $result = ''; if ($attachment->hasThumbnail() && $attachment->canDownload()) { - $result = ''.$result.''; + $result = ''.$result.''; } } @@ -115,16 +115,16 @@ class AttachmentBBCode extends AbstractBBCode { } else { // file - return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', array( + return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', [ 'object' => $attachment - )), ((!empty($content) && $content != $attachmentID) ? $content : $attachment->filename)); + ]), ((!empty($content) && $content != $attachmentID) ? $content : $attachment->filename)); } } // fallback - return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', array( + return StringUtil::getAnchorTag(LinkHandler::getInstance()->getLink('Attachment', [ 'id' => $attachmentID - ))); + ])); } /** diff --git a/wcfsetup/install/files/lib/system/bbcode/BBCodeHandler.class.php b/wcfsetup/install/files/lib/system/bbcode/BBCodeHandler.class.php index 5b5bfb90a6..02a405e09a 100644 --- a/wcfsetup/install/files/lib/system/bbcode/BBCodeHandler.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/BBCodeHandler.class.php @@ -19,13 +19,13 @@ class BBCodeHandler extends SingletonFactory { * list of BBCodes allowed for usage * @var BBCode[] */ - protected $allowedBBCodes = array(); + protected $allowedBBCodes = []; /** * list of BBCodes displayed as buttons * @var BBCode[] */ - protected $buttonBBCodes = array(); + protected $buttonBBCodes = []; /** * list of BBCodes which contain raw code (disabled BBCode parsing) @@ -81,7 +81,7 @@ class BBCodeHandler extends SingletonFactory { * @return BBCode[] */ public function getButtonBBCodes() { - $buttons = array(); + $buttons = []; foreach ($this->buttonBBCodes as $bbcode) { if ($this->isAvailableBBCode($bbcode->bbcodeTag)) { $buttons[] = $bbcode; @@ -107,11 +107,11 @@ class BBCodeHandler extends SingletonFactory { */ public function getSourceBBCodes() { if (empty($this->allowedBBCodes)) { - return array(); + return []; } if ($this->sourceBBCodes === null) { - $this->sourceBBCodes = array(); + $this->sourceBBCodes = []; foreach (BBCodeCache::getInstance()->getBBCodes() as $bbcode) { if (!$bbcode->isSourceCode) { diff --git a/wcfsetup/install/files/lib/system/bbcode/BBCodeParser.class.php b/wcfsetup/install/files/lib/system/bbcode/BBCodeParser.class.php index 3c55b501b5..6e480f01d4 100644 --- a/wcfsetup/install/files/lib/system/bbcode/BBCodeParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/BBCodeParser.class.php @@ -20,7 +20,7 @@ class BBCodeParser extends SingletonFactory { * list of bbcodes * @var BBCode[] */ - protected $bbcodes = array(); + protected $bbcodes = []; /** * output type @@ -44,13 +44,13 @@ class BBCodeParser extends SingletonFactory { * tag array * @var array */ - protected $tagArray = array(); + protected $tagArray = []; /** * text array * @var array */ - protected $textArray = array(); + protected $textArray = []; /** * regular expression for source code tags @@ -66,7 +66,7 @@ class BBCodeParser extends SingletonFactory { $this->bbcodes = BBCodeCache::getInstance()->getBBCodes(); // handle source codes - $sourceCodeTags = array(); + $sourceCodeTags = []; foreach ($this->bbcodes as $bbcode) { if ($bbcode->isSourceCode) $sourceCodeTags[] = $bbcode->bbcodeTag; } @@ -121,9 +121,9 @@ class BBCodeParser extends SingletonFactory { */ public function buildXMLStructure() { // stack for open tags - $openTagStack = $openTagDataStack = array(); - $newTagArray = array(); - $newTextArray = array(); + $openTagStack = $openTagDataStack = []; + $newTagArray = []; + $newTextArray = []; $i = -1; foreach ($this->tagArray as $i => $tag) { @@ -131,7 +131,7 @@ class BBCodeParser extends SingletonFactory { // closing tag if (in_array($tag['name'], $openTagStack) && $this->isAllowed($openTagStack, $tag['name'], true)) { // close unclosed tags - $tmpOpenTags = array(); + $tmpOpenTags = []; while (($previousTag = end($openTagStack)) != $tag['name']) { $nextIndex = count($newTagArray); $newTagArray[$nextIndex] = $this->buildTag('[/'.$previousTag.']'); @@ -218,7 +218,7 @@ class BBCodeParser extends SingletonFactory { } foreach ($this->bbcodes[$tag['name']]->getAttributes() as $attribute) { - if (!$this->isValidTagAttribute((isset($tag['attributes']) ? $tag['attributes'] : array()), $attribute)) { + if (!$this->isValidTagAttribute((isset($tag['attributes']) ? $tag['attributes'] : []), $attribute)) { return false; } } @@ -330,7 +330,7 @@ class BBCodeParser extends SingletonFactory { $arguments = explode('^', $this->bbcodes[$openTag]->allowedChildren); if (!empty($arguments[1])) $tags = explode(',', $arguments[1]); - else $tags = array(); + else $tags = []; if ($arguments[0] == 'none' && !in_array($tag, $tags)) return false; if ($arguments[0] == 'all' && in_array($tag, $tags)) return false; @@ -350,7 +350,7 @@ class BBCodeParser extends SingletonFactory { $buffer =& $this->parsedText; // stack of buffered tags - $bufferedTagStack = array(); + $bufferedTagStack = []; // loop through the tags $i = -1; @@ -474,7 +474,7 @@ class BBCodeParser extends SingletonFactory { * @return array bbcode tag data */ protected function buildTag($string) { - $tag = array('name' => '', 'closing' => false, 'source' => $string); + $tag = ['name' => '', 'closing' => false, 'source' => $string]; if (mb_substr($string, 1, 1) == '/') { // closing tag @@ -529,14 +529,14 @@ class BBCodeParser extends SingletonFactory { public function validateBBCodes($text, array $allowedBBCodes) { // if all BBCodes are allowed, return directly if (in_array('all', $allowedBBCodes)) { - return array(); + return []; } $this->setText($text); $this->buildTagArray(false); $this->buildXMLStructure(); - $usedDisallowedBBCodes = array(); + $usedDisallowedBBCodes = []; foreach ($this->tagArray as $tag) { if (!in_array($tag['name'], $allowedBBCodes) && !isset($usedDisallowedBBCodes[$tag['name']])) { $usedDisallowedBBCodes[$tag['name']] = $tag['name']; diff --git a/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php index e31744b39c..bd2d096c7f 100644 --- a/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php @@ -37,7 +37,7 @@ class CodeBBCode extends AbstractBBCode { * already used ids for line numbers to prevent duplicate ids in the output * @var string[] */ - private static $codeIDs = array(); + private static $codeIDs = []; /** * @see \wcf\system\bbcode\IBBCode::getParsedTag() @@ -131,21 +131,21 @@ class CodeBBCode extends AbstractBBCode { $highlightedContent = self::fixMarkup(explode("\n", $className::getInstance()->highlight($content))); // show template - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'lineNumbers' => self::makeLineNumbers($content, $this->startLineNumber), 'startLineNumber' => $this->startLineNumber, 'content' => $highlightedContent, 'highlighter' => $className::getInstance(), 'filename' => $this->filename, 'lines' => substr_count($content, "\n") + 1 - )); + ]); return WCF::getTPL()->fetch('codeBBCodeTag'); } else if ($parser->getOutputType() == 'text/simplified-html') { - return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.code.text', array( + return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.code.text', [ 'highlighterTitle' => $className::getInstance()->getTitle(), 'lines' => substr_count($content, "\n") + 1 - )); + ]); } } @@ -217,7 +217,7 @@ class CodeBBCode extends AbstractBBCode { protected static function makeLineNumbers($code, $start, $split = "\n") { $lines = explode($split, $code); - $lineNumbers = array(); + $lineNumbers = []; $i = -1; // find an unused codeID do { @@ -260,7 +260,7 @@ class CodeBBCode extends AbstractBBCode { $emptyTagRegex = new Regex(''); } - $openTags = array(); + $openTags = []; foreach ($lines as &$line) { $spanRegex->match($line, true); // open all tags again diff --git a/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php b/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php index d057c11287..cd2744a4ad 100644 --- a/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/HtmlBBCodeParser.class.php @@ -63,7 +63,7 @@ class HtmlBBCodeParser extends BBCodeParser { $buffer =& $this->parsedText; // stack of buffered tags - $bufferedTagStack = array(); + $bufferedTagStack = []; // loop through the tags $i = -1; diff --git a/wcfsetup/install/files/lib/system/bbcode/KeywordHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/KeywordHighlighter.class.php index ce84858ed9..56c54694d6 100644 --- a/wcfsetup/install/files/lib/system/bbcode/KeywordHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/KeywordHighlighter.class.php @@ -19,13 +19,13 @@ class KeywordHighlighter extends SingletonFactory { * search keywords * @var string[] */ - protected $keywords = array(); + protected $keywords = []; /** * search query parameters * @var string[] */ - protected static $searchQueryKeys = array( + protected static $searchQueryKeys = [ 'q', // google, msn, altavista 'p', // yahoo 'query', // lycos, fireball @@ -55,7 +55,7 @@ class KeywordHighlighter extends SingletonFactory { //'k', //'t', 'va' - ); + ]; /** * @see \wcf\system\SingletonFactory::init() @@ -110,12 +110,12 @@ class KeywordHighlighter extends SingletonFactory { $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1)); if (!empty($keywordString)) { - $this->keywords = array_merge($this->keywords, array(StringUtil::encodeHTML($keywordString))); + $this->keywords = array_merge($this->keywords, [StringUtil::encodeHTML($keywordString)]); } } else { // replace word delimiters by space - $keywordString = str_replace(array('.', ','), ' ', $keywordString); + $keywordString = str_replace(['.', ','], ' ', $keywordString); $keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString))); if (!empty($keywords)) { diff --git a/wcfsetup/install/files/lib/system/bbcode/MessageParser.class.php b/wcfsetup/install/files/lib/system/bbcode/MessageParser.class.php index c49affbdd5..9cf84aad1f 100644 --- a/wcfsetup/install/files/lib/system/bbcode/MessageParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/MessageParser.class.php @@ -21,13 +21,13 @@ class MessageParser extends BBCodeParser { * list of smilies * @var Smiley[] */ - protected $smilies = array(); + protected $smilies = []; /** * cached bbcodes * @var array */ - protected $cachedCodes = array(); + protected $cachedCodes = []; /** * currently parsed message @@ -69,7 +69,7 @@ class MessageParser extends BBCodeParser { * @return string parsed message */ public function parse($message, $enableSmilies = true, $enableHtml = false, $enableBBCodes = true, $doKeywordHighlighting = true) { - $this->cachedCodes = array(); + $this->cachedCodes = []; $this->message = $message; // call event @@ -116,8 +116,8 @@ class MessageParser extends BBCodeParser { } // replace bad html tags (script etc.) - $badSearch = array('/(javascript):/i', '/(about):/i', '/(vbscript):/i'); - $badReplace = array('$1:', '$1:', '$1:'); + $badSearch = ['/(javascript):/i', '/(about):/i', '/(vbscript):/i']; + $badReplace = ['$1:', '$1:', '$1:']; $this->message = preg_replace($badSearch, $badReplace, $this->message); // call event @@ -155,7 +155,7 @@ class MessageParser extends BBCodeParser { (?:,(?:\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|[^,\]]*))* )?\]) (.*?) - (?:\[/\\2\])~six", array($this, 'cacheCodesCallback'), $text); + (?:\[/\\2\])~six", [$this, 'cacheCodesCallback'], $text); } return $text; } diff --git a/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php b/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php index 477aba1ee5..ed374548bc 100644 --- a/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php @@ -50,7 +50,7 @@ class PreParser extends SingletonFactory { * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $sourceCodeTags = array(); + $sourceCodeTags = []; foreach (BBCodeCache::getInstance()->getBBCodes() as $bbcode) { if ($bbcode->isSourceCode) $sourceCodeTags[] = $bbcode->bbcodeTag; } @@ -229,7 +229,7 @@ class PreParser extends SingletonFactory { $matches = $userRegex->getMatches(); if (!empty($matches)) { - $usernames = array(); + $usernames = []; foreach ($matches as $match) { // we don't care about the full match array_shift($match); @@ -243,28 +243,28 @@ class PreParser extends SingletonFactory { if (!empty($usernames)) { // fetch users $userList = new UserList(); - $userList->getConditionBuilder()->add('user_table.username IN (?)', array($usernames)); + $userList->getConditionBuilder()->add('user_table.username IN (?)', [$usernames]); $userList->readObjects(); - $users = array(); + $users = []; foreach ($userList as $user) { $users[mb_strtolower($user->username)] = $user; } $text = $userRegex->replace($text, new Callback(function ($matches) use ($users) { // containing the full match - $usernames = array($matches[1]); + $usernames = [$matches[1]]; // containing only the part before the first space if (isset($matches[2])) $usernames[] = $matches[2]; - $usernames = array_map(array(PreParser::class, 'getUsername'), $usernames); + $usernames = array_map([PreParser::class, 'getUsername'], $usernames); foreach ($usernames as $username) { if (!isset($users[$username])) continue; - $link = LinkHandler::getInstance()->getLink('User', array( + $link = LinkHandler::getInstance()->getLink('User', [ 'appendSession' => false, 'object' => $users[$username] - )); + ]); $mention = "[url='".$link."']@".$users[$username]->username.'[/url]'; diff --git a/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php index 6c5ed06608..c22fb5a0c8 100644 --- a/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/QuoteBBCode.class.php @@ -39,17 +39,17 @@ class QuoteBBCode extends AbstractBBCode { } } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'content' => $content, 'quoteLink' => $quoteLink, 'quoteAuthor' => $quoteAuthor, 'quoteAuthorObject' => $quoteAuthorObject, 'isExternalQuoteLink' => $externalQuoteLink - )); + ]); return WCF::getTPL()->fetch('quoteBBCodeTag'); } else if ($parser->getOutputType() == 'text/simplified-html') { - return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.quote.text', array('content' => $content, 'cite' => (!empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '')))."\n"; + return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.quote.text', ['content' => $content, 'cite' => (!empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '')])."\n"; } } } diff --git a/wcfsetup/install/files/lib/system/bbcode/SimpleMessageParser.class.php b/wcfsetup/install/files/lib/system/bbcode/SimpleMessageParser.class.php index 7c793d46c7..8f8c902b93 100644 --- a/wcfsetup/install/files/lib/system/bbcode/SimpleMessageParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/SimpleMessageParser.class.php @@ -27,19 +27,19 @@ class SimpleMessageParser extends SingletonFactory { * list of smilies * @var Smiley[] */ - protected $smilies = array(); + protected $smilies = []; /** * cached URLs * @var string[] */ - protected $cachedURLs = array(); + protected $cachedURLs = []; /** * cached e-mails * @var string[] */ - protected $cachedEmails = array(); + protected $cachedEmails = []; /** * currently parsed message @@ -80,7 +80,7 @@ class SimpleMessageParser extends SingletonFactory { */ public function parse($message, $parseURLs = true, $parseSmilies = true) { $this->message = $message; - $this->cachedURLs = $this->cachedEmails = array(); + $this->cachedURLs = $this->cachedEmails = []; // call event EventHandler::getInstance()->fireAction($this, 'beforeParsing'); @@ -107,8 +107,8 @@ class SimpleMessageParser extends SingletonFactory { } // replace bad html tags (script etc.) - $badSearch = array('/(javascript):/i', '/(about):/i', '/(vbscript):/i'); - $badReplace = array('$1:', '$1:', '$1:'); + $badSearch = ['/(javascript):/i', '/(about):/i', '/(vbscript):/i']; + $badReplace = ['$1:', '$1:', '$1:']; $this->message = preg_replace($badSearch, $badReplace, $this->message); // call event @@ -153,11 +153,11 @@ class SimpleMessageParser extends SingletonFactory { ~ix'; // parse urls - $text = preg_replace_callback($urlPattern, array($this, 'cacheURLsCallback'), $text); + $text = preg_replace_callback($urlPattern, [$this, 'cacheURLsCallback'], $text); // parse emails if (mb_strpos($text, '@') !== false) { - $text = preg_replace_callback($emailPattern, array($this, 'cacheEmailsCallback'), $text); + $text = preg_replace_callback($emailPattern, [$this, 'cacheEmailsCallback'], $text); } return $text; diff --git a/wcfsetup/install/files/lib/system/bbcode/SpoilerBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/SpoilerBBCode.class.php index 4ef4c81905..3592b4d1c4 100644 --- a/wcfsetup/install/files/lib/system/bbcode/SpoilerBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/SpoilerBBCode.class.php @@ -18,10 +18,10 @@ class SpoilerBBCode extends AbstractBBCode { */ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) { if ($parser->getOutputType() == 'text/html') { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'content' => $content, 'buttonTitle' => (!empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '') - )); + ]); return WCF::getTPL()->fetch('spoilerBBCodeTag'); } if ($parser->getOutputType() == 'text/simplified-html') { diff --git a/wcfsetup/install/files/lib/system/bbcode/TableBBCode.class.php b/wcfsetup/install/files/lib/system/bbcode/TableBBCode.class.php index 4156b674b7..4ac67240e4 100644 --- a/wcfsetup/install/files/lib/system/bbcode/TableBBCode.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/TableBBCode.class.php @@ -25,7 +25,7 @@ class TableBBCode extends AbstractBBCode { if ($regex->match($parsedContent, true)) { $matches = $regex->getMatches(); - $openTags = array(); + $openTags = []; $openTDs = 0; $firstRowTDs = 0; diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/BashHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/BashHighlighter.class.php index a49cad2fd2..aef155cb53 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/BashHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/BashHighlighter.class.php @@ -15,47 +15,47 @@ class BashHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array(';', '='); + protected $separators = [';', '=']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$quotes */ - protected $quotes = array('"', "'", '`'); + protected $quotes = ['"', "'", '`']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array('#'); + protected $singleLineComment = ['#']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentStart */ - protected $commentStart = array(); + protected $commentStart = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentEnd */ - protected $commentEnd = array(); + protected $commentEnd = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array('||', '&&', '&', '|', '<<=', '>>=', '<<', '+=', '-=', '*=', '/=', '%=', + protected $operators = ['||', '&&', '&', '|', '<<=', '>>=', '<<', '+=', '-=', '*=', '/=', '%=', '-gt', '-lt', '-n', '-a', '-o', - '+', '-', '*', '/', '%', '<', '?', ':', '==', '!=', '=', '!', '>', '2>', '>>'); + '+', '-', '*', '/', '%', '<', '?', ':', '==', '!=', '=', '!', '>', '2>', '>>']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ 'true', 'false' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'if', 'then', 'else', @@ -68,12 +68,12 @@ class BashHighlighter extends Highlighter { 'case', 'in', 'esac' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords3 */ - protected $keywords3 = array( + protected $keywords3 = [ 'echo', 'exit', 'unset', @@ -83,12 +83,12 @@ class BashHighlighter extends Highlighter { 'sed', 'grep', 'awk' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords4 */ - protected $keywords4 = array( + protected $keywords4 = [ '$?' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/BrainfuckHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/BrainfuckHighlighter.class.php index f3a8d45711..c2ac320a7d 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/BrainfuckHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/BrainfuckHighlighter.class.php @@ -22,7 +22,7 @@ class BrainfuckHighlighter extends Highlighter { $string = preg_replace('/[\\.,]+/', '\\0', $string); $string = preg_replace('/[\\[\\]]+/', '\\0', $string); - $string = str_replace(array('||span class="hlComments"||', '||/span||'), array('', ''), $string); + $string = str_replace(['||span class="hlComments"||', '||/span||'], ['', ''], $string); return $string; } } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/CHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/CHighlighter.class.php index e4a606fb39..cc7b435b1a 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/CHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/CHighlighter.class.php @@ -15,19 +15,19 @@ class CHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array('(', ')', '{', '}', '[', ']', ';', '.', ','); + protected $separators = ['(', ')', '{', '}', '[', ']', ';', '.', ',']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array('=', '>', '<', '!', '~', '?', ':', '==', '<=', '>=', '!=', + protected $operators = ['=', '>', '<', '!', '~', '?', ':', '==', '<=', '>=', '!=', '&&', '||', '++', '--', '+', '-', '*', '/', '&', '|', '^', '%', '<<', '>>', '>>>', '+=', '-=', '*=', - '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>='); + '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>=']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ 'and', 'and_eq', 'asm', @@ -71,12 +71,12 @@ class CHighlighter extends Highlighter { 'while', 'xor', 'xor_eq' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'auto', 'bool', 'char', @@ -107,17 +107,17 @@ class CHighlighter extends Highlighter { 'void', 'volatile', 'wchar_t' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords3 */ - protected $keywords3 = array( + protected $keywords3 = [ '#include', '#define', '#if', '#else', '#ifdef', '#endif' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/CssHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/CssHighlighter.class.php index f26ec9fefc..e3c13d25c9 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/CssHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/CssHighlighter.class.php @@ -16,7 +16,7 @@ class CssHighlighter extends Highlighter { * temporary string replacement map for properties that can also be tags * @var string[] */ - public static $duplicates = array( + public static $duplicates = [ 'table:' => 't@@able:', 'caption:' => 'c@@aption:', 'menu:' => 'm@@enu:', @@ -24,7 +24,7 @@ class CssHighlighter extends Highlighter { 'sub:' => 's@@ub:', 'pre:' => 'p@@re:', 'small:' => 's@@mall:' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::highlightNumbers() @@ -54,13 +54,13 @@ class CssHighlighter extends Highlighter { public function highlight($string) { $string = str_replace('span', '053a0024219422ca9215c0a3ed0578ee76cff477', $string); // fix to not highlight the spans of the highlighter $string = str_replace(':link', ':li@@nk', $string); // fix to highlight pseudo-class different than tag - $string = str_replace(array('right:', 'left:'), array('r@@ight:', 'l@@eft:'), $string); // fix to highlight properties different than values + $string = str_replace(['right:', 'left:'], ['r@@ight:', 'l@@eft:'], $string); // fix to highlight properties different than values $string = strtr($string, self::$duplicates); // fix to highlight properties different than tags $string = parent::highlight($string); $string = strtr($string, array_flip(self::$duplicates)); // fix to highlight properties different than tags - $string = str_replace(array('r@@ight', 'l@@eft'), array('right', 'left'), $string); // fix to highlight properties different than values + $string = str_replace(['r@@ight', 'l@@eft'], ['right', 'left'], $string); // fix to highlight properties different than values $string = str_replace('li@@nk', 'link', $string); // fix to highlight pseudo-class different than tag return str_replace('053a0024219422ca9215c0a3ed0578ee76cff477', 'span', $string); // fix to not highlight the spans of the highlighter } @@ -68,17 +68,17 @@ class CssHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array('//'); + protected $singleLineComment = ['//']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array('(', ')', '{', '}', ';', '[', ']', ':', ',', '.'); + protected $separators = ['(', ')', '{', '}', ';', '[', ']', ':', ',', '.']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ 'azimuth', 'background', 'background-attachment', @@ -224,12 +224,12 @@ class CssHighlighter extends Highlighter { '!important', '@import', '@media' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'left-side', 'far-left', 'left', @@ -469,12 +469,12 @@ class CssHighlighter extends Highlighter { 'hsla', 'rgb', 'rgba' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords3 */ - protected $keywords3 = array( + protected $keywords3 = [ 'active', 'after', 'before', @@ -502,12 +502,12 @@ class CssHighlighter extends Highlighter { 'root', 'target', 'visited' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords4 */ - protected $keywords4 = array( + protected $keywords4 = [ 'abbr', 'acronym', 'address', @@ -621,12 +621,12 @@ class CssHighlighter extends Highlighter { 'var', 'video', 'wbr' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords5 */ - public $keywords5 = array( + public $keywords5 = [ // modifying 'darken', 'lighten', @@ -663,5 +663,5 @@ class CssHighlighter extends Highlighter { 'true', // others '&' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/DiffHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/DiffHighlighter.class.php index 65f160036b..764f814583 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/DiffHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/DiffHighlighter.class.php @@ -18,27 +18,27 @@ class DiffHighlighter extends Highlighter { * normal diffs * @var string[] */ - protected $add = array("+", ">"); + protected $add = ["+", ">"]; /** * keywords for an deleted line, the - is used in unified diff, the < in * normal diffs * @var string[] */ - protected $delete = array("-", "<"); + protected $delete = ["-", "<"]; /** * splitter in changes for normal diff * @var string[] */ - protected $splitter = array("---"); + protected $splitter = ["---"]; /** * keywords for the line info, the @ is used in unified diffs, the numbers * in normal diffs * @var string[] */ - protected $info = array("@", '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); + protected $info = ["@", '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::highlight() diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php index 99ccbb4740..5bbf5c40c5 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/Highlighter.class.php @@ -28,73 +28,73 @@ abstract class Highlighter extends SingletonFactory { * comment end delimiter * @var string[] */ - protected $commentEnd = array("*/"); + protected $commentEnd = ["*/"]; /** * comment start delimiter * @var string[] */ - protected $commentStart = array("/*"); + protected $commentStart = ["/*"]; /** * escape sequence * @var string[] */ - protected $escapeSequence = array("\\"); + protected $escapeSequence = ["\\"]; /** * categorized keywords * @var string[] */ - protected $keywords1 = array(); + protected $keywords1 = []; /** * categorized keywords * @var string[] */ - protected $keywords2 = array(); + protected $keywords2 = []; /** * categorized keywords * @var string[] */ - protected $keywords3 = array(); + protected $keywords3 = []; /** * categorized keywords * @var string[] */ - protected $keywords4 = array(); + protected $keywords4 = []; /** * categorized keywords * @var string[] */ - protected $keywords5 = array(); + protected $keywords5 = []; /** * list of arithmetic operators * @var string[] */ - protected $operators = array(); + protected $operators = []; /** * list of quote marks * @var string[] */ - protected $quotes = array("'", '"'); + protected $quotes = ["'", '"']; /** * list of separator sequences * @var string[] */ - protected $separators = array(); + protected $separators = []; /** * inline comment sequence * @var string[] */ - protected $singleLineComment = array("//"); + protected $singleLineComment = ["//"]; /** * regular expression to extract comments @@ -172,7 +172,7 @@ abstract class Highlighter extends SingletonFactory { $quotesRegEx = ''; foreach ($this->quotes as $quote) { if ($quotesRegEx !== '') $quotesRegEx .= '|'; - if (!is_array($quote)) $quote = array($quote, $quote); + if (!is_array($quote)) $quote = [$quote, $quote]; list($opening, $closing) = $quote; $opening = preg_quote($opening); diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/JavaHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/JavaHighlighter.class.php index 1665752a41..3734b2bc0d 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/JavaHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/JavaHighlighter.class.php @@ -15,12 +15,12 @@ class JavaHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array("(", ")", "{", "}", "[", "]", ";", ".", ",", "<", ">"); + protected $separators = ["(", ")", "{", "}", "[", "]", ";", ".", ",", "<", ">"]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'package', 'abstract', 'break', @@ -72,12 +72,12 @@ class JavaHighlighter extends Highlighter { 'static', 'void', 'import' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords3 */ - protected $keywords3 = array( + protected $keywords3 = [ 'Boolean', 'Float', 'Character', @@ -100,5 +100,5 @@ class JavaHighlighter extends Highlighter { 'HashMap', 'List', 'ArrayList' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/JsHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/JsHighlighter.class.php index dc67649bab..62c49daf02 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/JsHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/JsHighlighter.class.php @@ -15,19 +15,19 @@ class JsHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array("(", ")", "{", "}", "[", "]", ";", ".", ","); + protected $separators = ["(", ")", "{", "}", "[", "]", ";", ".", ","]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array("=", ">", "<", "!", "~", "?", ":", "==", "<=", ">=", "!=", + protected $operators = ["=", ">", "<", "!", "~", "?", ":", "==", "<=", ">=", "!=", "&&", "||", "++", "--", "+", "-", "*", "/", "&", "|", "^", "%", "<<", ">>", ">>>", "+=", "-=", "*=", - "/=", "&=", "|=", "^=", "%=", "<<=", ">>=", ">>>="); + "/=", "&=", "|=", "^=", "%=", "<<=", ">>=", ">>>="]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ "String", "Array", "RegExp", @@ -62,12 +62,12 @@ class JsHighlighter extends Highlighter { "onSelect", "onSubmit", "onUnload" - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ "break", "continue", "do", @@ -128,5 +128,5 @@ class JsHighlighter extends Highlighter { "true", "try", "volatile" - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/PerlHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/PerlHighlighter.class.php index b326b343ce..532bdef023 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/PerlHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/PerlHighlighter.class.php @@ -15,34 +15,34 @@ class PerlHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array('(', ')', '{', '}', '[', ']', ';', '.', ','); + protected $separators = ['(', ')', '{', '}', '[', ']', ';', '.', ',']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array('#'); + protected $singleLineComment = ['#']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentStart */ - protected $commentStart = array(); + protected $commentStart = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentEnd */ - protected $commentEnd = array(); + protected $commentEnd = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array('.=', '=', '>', '<', '!', '~', '?', ':', '==', '<=', '>=', '!=', + protected $operators = ['.=', '=', '>', '<', '!', '~', '?', ':', '==', '<=', '>=', '!=', '&&', '||', '++', '--', '+', '-', '*', '/', '&', '|', '^', '%', '<<', '>>', '>>>', '+=', '-=', '*=', - '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>=', '->', '::'); + '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>=', '->', '::']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ 'print', 'sprintf', 'length', @@ -81,12 +81,12 @@ class PerlHighlighter extends Highlighter { 'crypt', 'pack', 'unpack' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'case', 'do', 'while', @@ -115,15 +115,15 @@ class PerlHighlighter extends Highlighter { 'until', 'break', 'exit' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords3 */ - protected $keywords3 = array( + protected $keywords3 = [ 'use', 'import', 'require', 'sub' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/PhpHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/PhpHighlighter.class.php index 9ccdec5bc1..62d62f633b 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/PhpHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/PhpHighlighter.class.php @@ -13,7 +13,7 @@ use wcf\system\Regex; * @category Community Framework */ class PhpHighlighter extends Highlighter { - public static $colorToClass = array(); + public static $colorToClass = []; /** * @see \wcf\system\SingletonFactory::init() @@ -21,7 +21,7 @@ class PhpHighlighter extends Highlighter { protected function init() { parent::init(); - $types = array('default' => 'hlKeywords1', 'keyword' => 'hlKeywords2', 'comment' => 'hlComments', 'string' => 'hlQuotes'); + $types = ['default' => 'hlKeywords1', 'keyword' => 'hlKeywords2', 'comment' => 'hlComments', 'string' => 'hlQuotes']; self::$colorToClass[''] = ''; foreach ($types as $type => $class) { diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/PythonHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/PythonHighlighter.class.php index 47921a66dc..442b21b57a 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/PythonHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/PythonHighlighter.class.php @@ -15,38 +15,38 @@ class PythonHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array('(', ')',/* from __future__ import braces '{', '}', */'[', ']', ';', '.', ',', ':'); + protected $separators = ['(', ')',/* from __future__ import braces '{', '}', */'[', ']', ';', '.', ',', ':']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array('#'); + protected $singleLineComment = ['#']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentStart */ - protected $commentStart = array(); + protected $commentStart = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentEnd */ - protected $commentEnd = array(); + protected $commentEnd = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array('+=', '-=', '**=', '*=', '//=', '/=', '%=', '~=', '+', '-', '**', '*', '//', '/', '%', - '&=', '<<=', '>>=', '^=', '~', '&', '^', '|', '<<', '>>', '=', '!=', '<', '>', '<=', '>='); + protected $operators = ['+=', '-=', '**=', '*=', '//=', '/=', '%=', '~=', '+', '-', '**', '*', '//', '/', '%', + '&=', '<<=', '>>=', '^=', '~', '&', '^', '|', '<<', '>>', '=', '!=', '<', '>', '<=', '>=']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$quotes */ - protected $quotes = array(array("r'", "'"), array("u'", "'"), array('r"', '"'), array('u"', '"'), "'", '"'); + protected $quotes = [["r'", "'"], ["u'", "'"], ['r"', '"'], ['u"', '"'], "'", '"']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ 'print', 'del', 'str', @@ -59,12 +59,12 @@ class PythonHighlighter extends Highlighter { 'continue', 'break', 'return' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'if', 'elif', 'else', @@ -74,23 +74,23 @@ class PythonHighlighter extends Highlighter { 'for', 'in', 'while' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords3 */ - protected $keywords3 = array( + protected $keywords3 = [ 'from', 'import', 'as', 'class', 'def' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords4 */ - protected $keywords4 = array( + protected $keywords4 = [ '__name__', '__init__', '__str__', @@ -103,5 +103,5 @@ class PythonHighlighter extends Highlighter { 'or', 'not', 'is' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/SqlHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/SqlHighlighter.class.php index 7c1e275d73..cb6932614b 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/SqlHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/SqlHighlighter.class.php @@ -23,22 +23,22 @@ class SqlHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$quotes */ - protected $quotes = array("'", '"'); + protected $quotes = ["'", '"']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array('#', '--'); + protected $singleLineComment = ['#', '--']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array('(', ')', ',', ';'); + protected $separators = ['(', ')', ',', ';']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array('<>', '~=', '!=', '^=', '=', '<', '<=', '>', '>=', '*', '/', '+', '-', '||', '@', '%', '&', '?', '\$'); + protected $operators = ['<>', '~=', '!=', '^=', '=', '<', '<=', '>', '>=', '*', '/', '+', '-', '||', '@', '%', '&', '?', '\$']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::cacheComments() @@ -83,7 +83,7 @@ class SqlHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords1 */ - protected $keywords1 = array( + protected $keywords1 = [ 'action', 'add', 'aggregate', @@ -316,12 +316,12 @@ class SqlHighlighter extends Highlighter { 'year', 'year_month', 'zerofill' - ); + ]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$keywords2 */ - protected $keywords2 = array( + protected $keywords2 = [ 'ABS', 'ACOS', 'ADDDATE', @@ -430,5 +430,5 @@ class SqlHighlighter extends Highlighter { 'WEEK', 'WEEKDAY', 'YEAR' - ); + ]; } diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/TexHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/TexHighlighter.class.php index 9d9ee92e80..92ff4755f0 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/TexHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/TexHighlighter.class.php @@ -16,12 +16,12 @@ class TexHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$quotes */ - protected $quotes = array(); + protected $quotes = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array('%'); + protected $singleLineComment = ['%']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::highlightKeywords() diff --git a/wcfsetup/install/files/lib/system/bbcode/highlighter/XmlHighlighter.class.php b/wcfsetup/install/files/lib/system/bbcode/highlighter/XmlHighlighter.class.php index 4bdcf48106..674c9d8bd4 100644 --- a/wcfsetup/install/files/lib/system/bbcode/highlighter/XmlHighlighter.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/highlighter/XmlHighlighter.class.php @@ -24,32 +24,32 @@ class XmlHighlighter extends Highlighter { /** * @see \wcf\system\bbcode\highlighter\Highlighter::$quotes */ - protected $quotes = array('"'); + protected $quotes = ['"']; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$singleLineComment */ - protected $singleLineComment = array(); + protected $singleLineComment = []; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$commentStart */ - protected $commentStart = array(""); + protected $commentEnd = ["-->"]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$separators */ - protected $separators = array("<", ">"); + protected $separators = ["<", ">"]; /** * @see \wcf\system\bbcode\highlighter\Highlighter::$operators */ - protected $operators = array(); + protected $operators = []; const XML_ATTRIBUTE_NAME = '[a-z0-9](?:(?:(?getConditionBuilder()->add('(box.visibleEverywhere = ? AND boxID NOT IN (SELECT boxID FROM wcf'.WCF_N.'_box_to_page WHERE pageID = ? AND visible = ?)) OR boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_to_page WHERE pageID = ? AND visible = ?)', array(1, $pageID, 0, $pageID, 1)); - else $boxList->getConditionBuilder()->add('box.visibleEverywhere = ?', array(1)); + if ($pageID) $boxList->getConditionBuilder()->add('(box.visibleEverywhere = ? AND boxID NOT IN (SELECT boxID FROM wcf'.WCF_N.'_box_to_page WHERE pageID = ? AND visible = ?)) OR boxID IN (SELECT boxID FROM wcf'.WCF_N.'_box_to_page WHERE pageID = ? AND visible = ?)', [1, $pageID, 0, $pageID, 1]); + else $boxList->getConditionBuilder()->add('box.visibleEverywhere = ?', [1]); $boxList->sqlOrderBy = 'showOrder'; $boxList->readObjects(); foreach ($boxList as $box) { diff --git a/wcfsetup/install/files/lib/system/box/StatisticsBoxController.class.php b/wcfsetup/install/files/lib/system/box/StatisticsBoxController.class.php index d86bf9e0d1..36078a4dd4 100644 --- a/wcfsetup/install/files/lib/system/box/StatisticsBoxController.class.php +++ b/wcfsetup/install/files/lib/system/box/StatisticsBoxController.class.php @@ -24,9 +24,9 @@ class StatisticsBoxController extends AbstractBoxController { * @inheritDoc */ protected function loadContent() { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'statistics' => UserStatsCacheBuilder::getInstance()->getData() - )); + ]); $this->content = WCF::getTPL()->fetch('boxStatistics'); } diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php index 520aa3910a..5dcaf021a8 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/DeleteUserBulkProcessingAction.class.php @@ -38,7 +38,7 @@ class DeleteUserBulkProcessingAction extends AbstractUserBulkProcessingAction { $userList = parent::getObjectList(); // deny self deletion - $userList->getConditionBuilder()->add('user_table.userID <> ?', array(WCF::getUser()->userID)); + $userList->getConditionBuilder()->add('user_table.userID <> ?', [WCF::getUser()->userID]); return $userList; } diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/RemoveFromUserGroupsUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/RemoveFromUserGroupsUserBulkProcessingAction.class.php index a30ca88d31..506414bc13 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/RemoveFromUserGroupsUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/RemoveFromUserGroupsUserBulkProcessingAction.class.php @@ -35,7 +35,7 @@ class RemoveFromUserGroupsUserBulkProcessingAction extends AbstractUserGroupsUse // the active user may not remove themselves from any user group // to avoid potential permission issues - $userList->getConditionBuilder()->add('user_table.userID <> ?', array(WCF::getUser()->userID)); + $userList->getConditionBuilder()->add('user_table.userID <> ?', [WCF::getUser()->userID]); return $userList; } 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 8192cb668f..cb2d5021b5 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 @@ -57,9 +57,9 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction if (count($objectList)) { // save config in session $userMailData = WCF::getSession()->getVar('userMailData'); - if ($userMailData === null) $userMailData = array(); + if ($userMailData === null) $userMailData = []; $this->mailID = count($userMailData); - $userMailData[$this->mailID] = array( + $userMailData[$this->mailID] = [ 'action' => '', 'enableHTML' => $this->enableHTML, 'from' => $this->from, @@ -67,7 +67,7 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction 'subject' => $this->subject, 'text' => $this->text, 'userIDs' => $objectList->getObjectIDs() - ); + ]; WCF::getSession()->register('userMailData', $userMailData); } } diff --git a/wcfsetup/install/files/lib/system/cache/CacheHandler.class.php b/wcfsetup/install/files/lib/system/cache/CacheHandler.class.php index 93c30245e5..6b6f94a861 100644 --- a/wcfsetup/install/files/lib/system/cache/CacheHandler.class.php +++ b/wcfsetup/install/files/lib/system/cache/CacheHandler.class.php @@ -105,7 +105,7 @@ class CacheHandler extends SingletonFactory { * @param array $parameters * @return string */ - protected function getCacheName(ICacheBuilder $cacheBuilder, array $parameters = array()) { + protected function getCacheName(ICacheBuilder $cacheBuilder, array $parameters = []) { $className = explode('\\', get_class($cacheBuilder)); $application = array_shift($className); $cacheName = str_replace('CacheBuilder', '', array_pop($className)); diff --git a/wcfsetup/install/files/lib/system/cache/builder/ACLOptionCategoryCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ACLOptionCategoryCacheBuilder.class.php index 293a108722..37c7d95385 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ACLOptionCategoryCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ACLOptionCategoryCacheBuilder.class.php @@ -20,10 +20,10 @@ class ACLOptionCategoryCacheBuilder extends AbstractCacheBuilder { $list = new ACLOptionCategoryList(); $list->readObjects(); - $data = array(); + $data = []; foreach ($list as $aclOptionCategory) { if (!isset($data[$aclOptionCategory->objectTypeID])) { - $data[$aclOptionCategory->objectTypeID] = array(); + $data[$aclOptionCategory->objectTypeID] = []; } $data[$aclOptionCategory->objectTypeID][$aclOptionCategory->categoryName] = $aclOptionCategory; diff --git a/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php index ec539946b3..9403f8ad7d 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ACPMenuCacheBuilder.class.php @@ -21,19 +21,19 @@ class ACPMenuCacheBuilder extends AbstractCacheBuilder { * list of option categories which directly contain options * @var string[] */ - protected $categoriesWithOptions = array(); + protected $categoriesWithOptions = []; /** * list of option categories grouped by the name of their parent category * @var OptionCategory[] */ - protected $categoryStructure = array(); + protected $categoryStructure = []; /** * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array(); + $data = []; // get "real" menu items $menuItemList = new ACPMenuItemList(); @@ -44,16 +44,16 @@ class ACPMenuCacheBuilder extends AbstractCacheBuilder { } // get menu items for top option categories - $data['wcf.acp.menu.link.option.category'] = array(); + $data['wcf.acp.menu.link.option.category'] = []; foreach ($this->getTopOptionCategories() as $optionCategory) { - $data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array( + $data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, [ 'menuItem' => 'wcf.acp.option.category.'.$optionCategory->categoryName, 'parentMenuItem' => 'wcf.acp.menu.link.option.category', 'menuItemController' => 'wcf\acp\form\OptionForm', 'permissions' => $optionCategory->permissions, 'optionCategoryID' => $optionCategory->categoryID, 'options' => $optionCategory->options - )); + ]); } return $data; @@ -70,10 +70,10 @@ class ACPMenuCacheBuilder extends AbstractCacheBuilder { $optionCategories = $optionCategoryList->getObjects(); // build category structure - $this->categoryStructure = array(); + $this->categoryStructure = []; foreach ($optionCategories as $optionCategory) { if (!isset($this->categoryStructure[$optionCategory->parentCategoryName])) { - $this->categoryStructure[$optionCategory->parentCategoryName] = array(); + $this->categoryStructure[$optionCategory->parentCategoryName] = []; } $this->categoryStructure[$optionCategory->parentCategoryName][] = $optionCategory; @@ -90,7 +90,7 @@ class ACPMenuCacheBuilder extends AbstractCacheBuilder { } // collect top categories which contain options - $topCategories = array(); + $topCategories = []; foreach ($this->categoryStructure[""] as $topCategory) { if ($this->containsOptions($topCategory)) { $topCategories[$topCategory->categoryID] = $topCategory; diff --git a/wcfsetup/install/files/lib/system/cache/builder/AbstractCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/AbstractCacheBuilder.class.php index 9e8499c0cd..366e29bd7b 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/AbstractCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/AbstractCacheBuilder.class.php @@ -19,7 +19,7 @@ abstract class AbstractCacheBuilder extends SingletonFactory implements ICacheBu * list of cache resources by index * @var mixed[][] */ - protected $cache = array(); + protected $cache = []; /** * maximum cache lifetime in seconds, '0' equals infinite @@ -30,7 +30,7 @@ abstract class AbstractCacheBuilder extends SingletonFactory implements ICacheBu /** * @inheritDoc */ - public function getData(array $parameters = array(), $arrayIndex = '') { + public function getData(array $parameters = [], $arrayIndex = '') { $index = CacheHandler::getInstance()->getCacheIndex($parameters); if (!isset($this->cache[$index])) { @@ -65,7 +65,7 @@ abstract class AbstractCacheBuilder extends SingletonFactory implements ICacheBu /** * @inheritDoc */ - public function reset(array $parameters = array()) { + public function reset(array $parameters = []) { CacheHandler::getInstance()->flush($this, $parameters); } diff --git a/wcfsetup/install/files/lib/system/cache/builder/AdCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/AdCacheBuilder.class.php index 1faa4bb2c5..ee3850bc14 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/AdCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/AdCacheBuilder.class.php @@ -18,14 +18,14 @@ class AdCacheBuilder extends AbstractCacheBuilder { */ public function rebuild(array $parameters) { $adList = new AdList(); - $adList->getConditionBuilder()->add('isDisabled = ?', array(0)); + $adList->getConditionBuilder()->add('isDisabled = ?', [0]); $adList->sqlOrderBy = 'showOrder ASC'; $adList->readObjects(); - $data = array(); + $data = []; foreach ($adList as $ad) { if (!isset($data[$ad->objectTypeID])) { - $data[$ad->objectTypeID] = array(); + $data[$ad->objectTypeID] = []; } $data[$ad->objectTypeID][$ad->adID] = $ad; diff --git a/wcfsetup/install/files/lib/system/cache/builder/BBCodeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/BBCodeCacheBuilder.class.php index 8d3c65038c..f5ed0b9feb 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/BBCodeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/BBCodeCacheBuilder.class.php @@ -19,8 +19,8 @@ class BBCodeCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ protected function rebuild(array $parameters) { - $attributes = array(); - $data = array('bbcodes' => array(), 'highlighters' => array()); + $attributes = []; + $data = ['bbcodes' => [], 'highlighters' => []]; // get attributes $sql = "SELECT attribute.*, bbcode.bbcodeTag @@ -32,7 +32,7 @@ class BBCodeCacheBuilder extends AbstractCacheBuilder { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); while ($row = $statement->fetchArray()) { - if (!isset($attributes[$row['bbcodeTag']])) $attributes[$row['bbcodeTag']] = array(); + if (!isset($attributes[$row['bbcodeTag']])) $attributes[$row['bbcodeTag']] = []; $attributes[$row['bbcodeTag']][$row['attributeNo']] = new BBCodeAttribute(null, $row); } @@ -44,7 +44,7 @@ class BBCodeCacheBuilder extends AbstractCacheBuilder { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); while ($row = $statement->fetchArray()) { - $row['attributes'] = (isset($attributes[$row['bbcodeTag']]) ? $attributes[$row['bbcodeTag']] : array()); + $row['attributes'] = (isset($attributes[$row['bbcodeTag']]) ? $attributes[$row['bbcodeTag']] : []); $data['bbcodes'][$row['bbcodeTag']] = new BBCode(null, $row); } diff --git a/wcfsetup/install/files/lib/system/cache/builder/CaptchaQuestionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/CaptchaQuestionCacheBuilder.class.php index 0cb67f9107..be6103540e 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/CaptchaQuestionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/CaptchaQuestionCacheBuilder.class.php @@ -18,7 +18,7 @@ class CaptchaQuestionCacheBuilder extends AbstractCacheBuilder { */ public function rebuild(array $parameters) { $questionList = new CaptchaQuestionList(); - $questionList->getConditionBuilder()->add('isDisabled = ?', array(0)); + $questionList->getConditionBuilder()->add('isDisabled = ?', [0]); $questionList->readObjects(); return $questionList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/CategoryACLOptionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/CategoryACLOptionCacheBuilder.class.php index 3b29276575..b16197ef59 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/CategoryACLOptionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/CategoryACLOptionCacheBuilder.class.php @@ -18,7 +18,7 @@ class CategoryACLOptionCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array(); + $data = []; foreach (CategoryHandler::getInstance()->getCategories() as $objectTypeName => $categories) { $objectType = CategoryHandler::getInstance()->getObjectTypeByName($objectTypeName); $aclObjectType = $objectType->getProcessor()->getObjectTypeName('com.woltlab.wcf.acl'); @@ -29,17 +29,17 @@ class CategoryACLOptionCacheBuilder extends AbstractCacheBuilder { $aclOptions = ACLHandler::getInstance()->getPermissions(ACLHandler::getInstance()->getObjectTypeID($aclObjectType), array_keys($categories)); $options = $aclOptions['options']->getObjects(); - foreach (array('group', 'user') as $type) { + foreach (['group', 'user'] as $type) { foreach ($aclOptions[$type] as $categoryID => $optionData) { if (!isset($data[$categoryID])) { - $data[$categoryID] = array( - 'group' => array(), - 'user' => array() - ); + $data[$categoryID] = [ + 'group' => [], + 'user' => [] + ]; } foreach ($optionData as $typeID => $optionValues) { - $data[$categoryID][$type][$typeID] = array(); + $data[$categoryID][$type][$typeID] = []; foreach ($optionValues as $optionID => $optionValue) { $data[$categoryID][$type][$typeID][$options[$optionID]->optionName] = $optionValue; diff --git a/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php index e1f6718841..d2356bde84 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/CategoryCacheBuilder.class.php @@ -23,13 +23,13 @@ class CategoryCacheBuilder extends AbstractCacheBuilder { $list->sqlOrderBy = "category.showOrder ASC"; $list->readObjects(); - $data = array( + $data = [ 'categories' => $list->getObjects(), - 'objectTypeCategoryIDs' => array() - ); + 'objectTypeCategoryIDs' => [] + ]; foreach ($list as $category) { if (!isset($data['objectTypeCategoryIDs'][$category->objectType])) { - $data['objectTypeCategoryIDs'][$category->objectType] = array(); + $data['objectTypeCategoryIDs'][$category->objectType] = []; } $data['objectTypeCategoryIDs'][$category->objectType][] = $category->categoryID; diff --git a/wcfsetup/install/files/lib/system/cache/builder/ClipboardPageCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ClipboardPageCacheBuilder.class.php index 285c2d84bd..d01854ac62 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ClipboardPageCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ClipboardPageCacheBuilder.class.php @@ -22,10 +22,10 @@ class ClipboardPageCacheBuilder extends AbstractCacheBuilder { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - $data = array(); + $data = []; while ($row = $statement->fetchArray()) { if (!isset($data[$row['pageClassName']])) { - $data[$row['pageClassName']] = array(); + $data[$row['pageClassName']] = []; } $data[$row['pageClassName']][] = $row['actionID']; diff --git a/wcfsetup/install/files/lib/system/cache/builder/ConditionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ConditionCacheBuilder.class.php index 38fbf2834c..bd47c358d8 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ConditionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ConditionCacheBuilder.class.php @@ -30,22 +30,22 @@ class ConditionCacheBuilder extends AbstractCacheBuilder { $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes($definition->definitionName); if (empty($objectTypes)) { - return array(); + return []; } - $objectTypeIDs = array(); + $objectTypeIDs = []; foreach ($objectTypes as $objectType) { $objectTypeIDs[] = $objectType->objectTypeID; } $conditionList = new ConditionList(); - $conditionList->getConditionBuilder()->add('condition_table.objectTypeID IN (?)', array($objectTypeIDs)); + $conditionList->getConditionBuilder()->add('condition_table.objectTypeID IN (?)', [$objectTypeIDs]); $conditionList->readObjects(); - $groupedConditions = array(); + $groupedConditions = []; foreach ($conditionList as $condition) { if (!isset($groupedConditions[$condition->objectID])) { - $groupedConditions[$condition->objectID] = array(); + $groupedConditions[$condition->objectID] = []; } $groupedConditions[$condition->objectID][$condition->conditionID] = $condition; diff --git a/wcfsetup/install/files/lib/system/cache/builder/CoreObjectCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/CoreObjectCacheBuilder.class.php index 0d6c0957d3..225345ca40 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/CoreObjectCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/CoreObjectCacheBuilder.class.php @@ -17,7 +17,7 @@ class CoreObjectCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array(); + $data = []; $coreObjectList = new CoreObjectList(); $coreObjectList->readObjects(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/CronjobCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/CronjobCacheBuilder.class.php index f166496051..6d7785c4e8 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/CronjobCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/CronjobCacheBuilder.class.php @@ -22,12 +22,12 @@ class CronjobCacheBuilder extends AbstractCacheBuilder { FROM wcf".WCF_N."_cronjob WHERE isDisabled = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(0)); + $statement->execute([0]); $row = $statement->fetchArray(); - return array( + return [ 'afterNextExec' => $row['afterNextExec'], 'nextExec' => $row['nextExec'] - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php index 1bc23a7794..291faa2a2b 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/EventListenerCacheBuilder.class.php @@ -21,15 +21,15 @@ class EventListenerCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $actions = array( - 'admin' => array(), - 'user' => array() - ); + $actions = [ + 'admin' => [], + 'user' => [] + ]; - $inheritedActions = array( - 'admin' => array(), - 'user' => array() - ); + $inheritedActions = [ + 'admin' => [], + 'user' => [] + ]; $sql = "SELECT * FROM wcf".WCF_N."_event_listener @@ -41,13 +41,13 @@ class EventListenerCacheBuilder extends AbstractCacheBuilder { if (!$eventListener->inherit) { if (!isset($actions[$eventListener->environment])) { - $actions[$eventListener->environment] = array(); + $actions[$eventListener->environment] = []; } foreach ($eventNames as $eventName) { $key = EventHandler::generateKey($eventListener->eventClassName, $eventName); if (!isset($actions[$eventListener->environment][$key])) { - $actions[$eventListener->environment][$key] = array(); + $actions[$eventListener->environment][$key] = []; } $actions[$eventListener->environment][$key][] = $eventListener; @@ -55,12 +55,12 @@ class EventListenerCacheBuilder extends AbstractCacheBuilder { } else { if (!isset($inheritedActions[$eventListener->environment])) { - $inheritedActions[$eventListener->environment] = array(); + $inheritedActions[$eventListener->environment] = []; } foreach ($eventNames as $eventName) { if (!isset($inheritedActions[$eventListener->environment][$eventListener->eventClassName])) { - $inheritedActions[$eventListener->environment][$eventListener->eventClassName] = array(); + $inheritedActions[$eventListener->environment][$eventListener->eventClassName] = []; } $inheritedActions[$eventListener->environment][$eventListener->eventClassName][$eventName][] = $eventListener; @@ -68,9 +68,9 @@ class EventListenerCacheBuilder extends AbstractCacheBuilder { } } - return array( + return [ 'actions' => $actions, 'inheritedActions' => $inheritedActions - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/cache/builder/ICacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ICacheBuilder.class.php index 1d0ac2843f..b8baeaa008 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ICacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ICacheBuilder.class.php @@ -19,7 +19,7 @@ interface ICacheBuilder { * @param string $arrayIndex * @return mixed */ - public function getData(array $parameters = array(), $arrayIndex = ''); + public function getData(array $parameters = [], $arrayIndex = ''); /** * Returns maximum lifetime for cache resource. @@ -34,5 +34,5 @@ interface ICacheBuilder { * * @param array $parameters */ - public function reset(array $parameters = array()); + public function reset(array $parameters = []); } diff --git a/wcfsetup/install/files/lib/system/cache/builder/LanguageCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/LanguageCacheBuilder.class.php index e4ca970aaf..7aeaffeea3 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/LanguageCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/LanguageCacheBuilder.class.php @@ -19,15 +19,15 @@ class LanguageCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array( - 'codes' => array(), - 'countryCodes' => array(), - 'languages' => array(), + $data = [ + 'codes' => [], + 'countryCodes' => [], + 'languages' => [], 'default' => 0, - 'categories' => array(), - 'categoryIDs' => array(), + 'categories' => [], + 'categoryIDs' => [], 'multilingualismEnabled' => false - ); + ]; // get languages $languageList = new LanguageList(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/NoticeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/NoticeCacheBuilder.class.php index 511e6aba88..dbf2d79d5d 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/NoticeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/NoticeCacheBuilder.class.php @@ -18,7 +18,7 @@ class NoticeCacheBuilder extends AbstractCacheBuilder { */ protected function rebuild(array $parameters) { $noticeList = new NoticeList(); - $noticeList->getConditionBuilder()->add('isDisabled = ?', array(0)); + $noticeList->getConditionBuilder()->add('isDisabled = ?', [0]); $noticeList->sqlOrderBy = 'showOrder ASC'; $noticeList->readObjects(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php index 45e97a3b72..bccb57f87d 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php @@ -19,12 +19,12 @@ class ObjectTypeCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array( - 'categories' => array(), - 'definitions' => array(), - 'objectTypes' => array(), - 'groupedObjectTypes' => array() - ); + $data = [ + 'categories' => [], + 'definitions' => [], + 'objectTypes' => [], + 'groupedObjectTypes' => [] + ]; // get definitions $sql = "SELECT * @@ -36,7 +36,7 @@ class ObjectTypeCacheBuilder extends AbstractCacheBuilder { if ($row['categoryName']) { if (!isset($data['categories'][$row['categoryName']])) { - $data['categories'][$row['categoryName']] = array(); + $data['categories'][$row['categoryName']] = []; } $data['categories'][$row['categoryName']][] = $row['definitionID']; @@ -52,7 +52,7 @@ class ObjectTypeCacheBuilder extends AbstractCacheBuilder { $data['objectTypes'][$row['objectTypeID']] = $objectType = new ObjectType(null, $row); $definition = $data['definitions'][$objectType->definitionID]; - if (!isset($data['groupedObjectTypes'][$definition->definitionName])) $data['groupedObjectTypes'][$definition->definitionName] = array(); + if (!isset($data['groupedObjectTypes'][$definition->definitionName])) $data['groupedObjectTypes'][$definition->definitionName] = []; $data['groupedObjectTypes'][$definition->definitionName][$objectType->objectType] = $objectType; } diff --git a/wcfsetup/install/files/lib/system/cache/builder/PackageCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/PackageCacheBuilder.class.php index d054bf2cff..0230916f0d 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/PackageCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/PackageCacheBuilder.class.php @@ -17,10 +17,10 @@ class PackageCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array( - 'packages' => array(), - 'packageIDs' => array() - ); + $data = [ + 'packages' => [], + 'packageIDs' => [] + ]; $packageList = new PackageList(); $packageList->readObjects(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php index 465d46c010..144e52b007 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/PackageUpdateCacheBuilder.class.php @@ -19,6 +19,6 @@ class PackageUpdateCacheBuilder extends AbstractCacheBuilder { public function rebuild(array $parameters) { $updates = PackageUpdateDispatcher::getInstance()->getAvailableUpdates(); - return array('updates' => count($updates)); + return ['updates' => count($updates)]; } } diff --git a/wcfsetup/install/files/lib/system/cache/builder/PaidSubscriptionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/PaidSubscriptionCacheBuilder.class.php index e883e4f172..ddbd6601e5 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/PaidSubscriptionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/PaidSubscriptionCacheBuilder.class.php @@ -18,7 +18,7 @@ class PaidSubscriptionCacheBuilder extends AbstractCacheBuilder { */ protected function rebuild(array $parameters) { $subscriptionList = new PaidSubscriptionList(); - $subscriptionList->getConditionBuilder()->add('isDisabled = ?', array(0)); + $subscriptionList->getConditionBuilder()->add('isDisabled = ?', [0]); $subscriptionList->sqlOrderBy = 'showOrder'; $subscriptionList->readObjects(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/SmileyCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/SmileyCacheBuilder.class.php index 84df4312e6..763b75daab 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/SmileyCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/SmileyCacheBuilder.class.php @@ -17,7 +17,7 @@ class SmileyCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ protected function rebuild(array $parameters) { - $data = array('smilies' => array()); + $data = ['smilies' => []]; // get smilies $sql = "SELECT * diff --git a/wcfsetup/install/files/lib/system/cache/builder/StyleCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/StyleCacheBuilder.class.php index 8c0a1f9786..200bca4595 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/StyleCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/StyleCacheBuilder.class.php @@ -18,10 +18,10 @@ class StyleCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array( + $data = [ 'default' => 0, - 'styles' => array() - ); + 'styles' => [] + ]; // get all styles $sql = "SELECT * diff --git a/wcfsetup/install/files/lib/system/cache/builder/TagCloudCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/TagCloudCacheBuilder.class.php index 3811b9bbc6..3bee6ec6a4 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/TagCloudCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/TagCloudCacheBuilder.class.php @@ -21,13 +21,13 @@ class TagCloudCacheBuilder extends AbstractCacheBuilder { * list of tags * @var TagCloudTag[] */ - protected $tags = array(); + protected $tags = []; /** * language ids * @var integer */ - protected $languageIDs = array(); + protected $languageIDs = []; /** * @see \wcf\system\cache\builder\AbstractCacheBuilder::$maxLifetime @@ -38,7 +38,7 @@ class TagCloudCacheBuilder extends AbstractCacheBuilder { * object type ids * @var integer */ - protected $objectTypeIDs = array(); + protected $objectTypeIDs = []; /** * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() @@ -68,7 +68,7 @@ class TagCloudCacheBuilder extends AbstractCacheBuilder { // handle special '0' value if (in_array(0, $parameters)) { // discard all language ids - $parameters = array(); + $parameters = []; } return $parameters; @@ -78,14 +78,14 @@ class TagCloudCacheBuilder extends AbstractCacheBuilder { * Reads associated tags. */ protected function getTags() { - $this->tags = array(); + $this->tags = []; if (!empty($this->objectTypeIDs)) { // get tag ids - $tagIDs = array(); + $tagIDs = []; $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('object.objectTypeID IN (?)', array($this->objectTypeIDs)); - $conditionBuilder->add('object.languageID IN (?)', array($this->languageIDs)); + $conditionBuilder->add('object.objectTypeID IN (?)', [$this->objectTypeIDs]); + $conditionBuilder->add('object.languageID IN (?)', [$this->languageIDs]); $sql = "SELECT COUNT(*) AS counter, object.tagID FROM wcf".WCF_N."_tag_to_object object ".$conditionBuilder." @@ -110,7 +110,7 @@ class TagCloudCacheBuilder extends AbstractCacheBuilder { } // sort by counter - uasort($this->tags, array('self', 'compareTags')); + uasort($this->tags, ['self', 'compareTags']); } } } diff --git a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCacheBuilder.class.php index a7c0b65699..a51a958bd5 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCacheBuilder.class.php @@ -20,13 +20,13 @@ class TemplateListenerCacheBuilder extends AbstractCacheBuilder { public function rebuild(array $parameters) { // get templates for current package id $templateListenerList = new TemplateListenerList(); - $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($parameters['environment'])); + $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", [$parameters['environment']]); $templateListenerList->sqlOrderBy = "template_listener.listenerID ASC"; $templateListenerList->readObjects(); - $data = array(); + $data = []; foreach ($templateListenerList->getObjects() as $templateListener) { - $data[$templateListener->templateName] = array(); + $data[$templateListener->templateName] = []; } return $data; diff --git a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php index 1bde544370..8db0e07aec 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php @@ -19,14 +19,14 @@ class TemplateListenerCodeCacheBuilder extends AbstractCacheBuilder { public function rebuild(array $parameters) { // get template codes for specified template $templateListenerList = new TemplateListenerList(); - $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($parameters['environment'])); + $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", [$parameters['environment']]); $templateListenerList->sqlOrderBy = 'template_listener.niceValue ASC, template_listener.listenerID ASC'; $templateListenerList->readObjects(); - $data = array(); + $data = []; foreach ($templateListenerList->getObjects() as $templateListener) { if (!isset($data[$templateListener->templateName])) { - $data[$templateListener->templateName] = array(); + $data[$templateListener->templateName] = []; } $templateCode = $templateListener->templateCode; diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserBirthdayCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserBirthdayCacheBuilder.class.php index 8189e5a524..3fc9dedaee 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserBirthdayCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserBirthdayCacheBuilder.class.php @@ -26,19 +26,19 @@ class UserBirthdayCacheBuilder extends AbstractCacheBuilder { $userOptionID = User::getUserOptionID('birthday'); if ($userOptionID === null) { // birthday profile field missing; skip - return array(); + return []; } - $data = array(); + $data = []; $birthday = 'userOption'.$userOptionID; $sql = "SELECT userID, ".$birthday." FROM wcf".WCF_N."_user_option_value WHERE ".$birthday." LIKE ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array('%-' . ($parameters['month'] < 10 ? '0' : '') . $parameters['month'] . '-%')); + $statement->execute(['%-' . ($parameters['month'] < 10 ? '0' : '') . $parameters['month'] . '-%']); while ($row = $statement->fetchArray()) { list($year, $month, $day) = explode('-', $row[$birthday]); - if (!isset($data[$month . '-' . $day])) $data[$month . '-' . $day] = array(); + if (!isset($data[$month . '-' . $day])) $data[$month . '-' . $day] = []; $data[$month . '-' . $day][] = $row['userID']; } diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserGroupAssignmentCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserGroupAssignmentCacheBuilder.class.php index aaf5cc546d..9dc00e29cb 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserGroupAssignmentCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserGroupAssignmentCacheBuilder.class.php @@ -18,7 +18,7 @@ class UserGroupAssignmentCacheBuilder extends AbstractCacheBuilder { */ protected function rebuild(array $parameters) { $assignmentList = new UserGroupAssignmentList(); - $assignmentList->getConditionBuilder()->add('isDisabled = ?', array(0)); + $assignmentList->getConditionBuilder()->add('isDisabled = ?', [0]); $assignmentList->readObjects(); return $assignmentList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php index 3a64ee4916..7e2c3eb6ba 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php @@ -17,10 +17,10 @@ class UserGroupCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ public function rebuild(array $parameters) { - $data = array( - 'types' => array(), - 'groups' => array() - ); + $data = [ + 'types' => [], + 'groups' => [] + ]; // get all user groups $groupList = new UserGroupList(); @@ -29,7 +29,7 @@ class UserGroupCacheBuilder extends AbstractCacheBuilder { foreach ($groups as $group) { if (!isset($data['types'][$group->groupType])) { - $data['types'][$group->groupType] = array(); + $data['types'][$group->groupType] = []; } $data['types'][$group->groupType][] = $group->groupID; diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserGroupOptionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserGroupOptionCacheBuilder.class.php index 99aa87628d..caec744e2d 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserGroupOptionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserGroupOptionCacheBuilder.class.php @@ -28,7 +28,7 @@ class UserGroupOptionCacheBuilder extends OptionCacheBuilder { public function rebuild(array $parameters) { $data = parent::rebuild($parameters); - $usersOnlyPermissions = array(); + $usersOnlyPermissions = []; foreach ($data['options'] as $option) { if ($option->usersOnly) { $usersOnlyPermissions[] = $option->optionName; diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserMenuCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserMenuCacheBuilder.class.php index 4e0ac3c044..5105847c20 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserMenuCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserMenuCacheBuilder.class.php @@ -18,7 +18,7 @@ class UserMenuCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ protected function rebuild(array $parameters) { - $data = array(); + $data = []; // get all option categories $sql = "SELECT * @@ -26,15 +26,15 @@ class UserMenuCacheBuilder extends AbstractCacheBuilder { WHERE parentCategoryName = ? ORDER BY showOrder ASC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array('settings')); + $statement->execute(['settings']); while ($row = $statement->fetchArray()) { if (!isset($data['wcf.user.menu.settings'])) { - $data['wcf.user.menu.settings'] = array(); + $data['wcf.user.menu.settings'] = []; } $categoryShortName = str_replace('settings.', '', $row['categoryName']); - $data['wcf.user.menu.settings'][] = new UserMenuItem(null, array( + $data['wcf.user.menu.settings'][] = new UserMenuItem(null, [ 'packageID' => $row['packageID'], 'menuItem' => 'wcf.user.option.category.'.$row['categoryName'], 'parentMenuItem' => 'wcf.user.menu.settings', @@ -42,7 +42,7 @@ class UserMenuCacheBuilder extends AbstractCacheBuilder { 'menuItemLink' => ($categoryShortName != 'general' ? 'category='.$categoryShortName : ''), 'permissions' => $row['permissions'], 'options' => $row['options'] - )); + ]); } // get all menu items @@ -53,7 +53,7 @@ class UserMenuCacheBuilder extends AbstractCacheBuilder { $statement->execute(); while ($row = $statement->fetchArray()) { if (!isset($data[$row['parentMenuItem']])) { - $data[$row['parentMenuItem']] = array(); + $data[$row['parentMenuItem']] = []; } $data[$row['parentMenuItem']][] = new UserMenuItem(null, $row); diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserNotificationEventCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserNotificationEventCacheBuilder.class.php index b8757812af..6b8e2f8c65 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserNotificationEventCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserNotificationEventCacheBuilder.class.php @@ -18,7 +18,7 @@ class UserNotificationEventCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ protected function rebuild(array $parameters) { - $data = array(); + $data = []; // get events $sql = "SELECT event.*, object_type.objectType @@ -29,7 +29,7 @@ class UserNotificationEventCacheBuilder extends AbstractCacheBuilder { $statement->execute(); while ($row = $statement->fetchArray()) { if (!isset($data[$row['objectType']])) { - $data[$row['objectType']] = array(); + $data[$row['objectType']] = []; } if (!isset($data[$row['objectType']][$row['eventName']])) { diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserStatsCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserStatsCacheBuilder.class.php index 8f761c0ff9..910d6b9a6d 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserStatsCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserStatsCacheBuilder.class.php @@ -22,7 +22,7 @@ class UserStatsCacheBuilder extends AbstractCacheBuilder { * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild() */ protected function rebuild(array $parameters) { - $data = array(); + $data = []; // number of members $sql = "SELECT COUNT(*) AS amount diff --git a/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php index f119d0b11e..b05c8e1ec7 100644 --- a/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php @@ -58,7 +58,7 @@ class MemcachedCacheSource implements ICacheSource { // add servers $tmp = explode("\n", StringUtil::unifyNewlines(CACHE_SOURCE_MEMCACHED_HOST)); - $servers = array(); + $servers = []; $defaultWeight = floor(100 / count($tmp)); $regex = new Regex('^\[([a-z0-9\:\.]+)\](?::([0-9]{1,5}))?(?::([0-9]{1,3}))?$', Regex::CASE_INSENSITIVE); @@ -93,7 +93,7 @@ class MemcachedCacheSource implements ICacheSource { } } - $servers[] = array($host, $port, $weight); + $servers[] = [$host, $port, $weight]; } } $this->memcached->addServers($servers); diff --git a/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php b/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php index 89b9ea1063..20a9035aeb 100644 --- a/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php +++ b/wcfsetup/install/files/lib/system/captcha/CaptchaHandler.class.php @@ -28,7 +28,7 @@ class CaptchaHandler extends SingletonFactory { * @return string[] */ public function getCaptchaSelection() { - $selection = array(); + $selection = []; foreach ($this->objectTypes as $objectType) { if ($objectType->getProcessor()->isAvailable()) { $selection[$objectType->objectType] = WCF::getLanguage()->get('wcf.captcha.'.$objectType->objectType); diff --git a/wcfsetup/install/files/lib/system/captcha/RecaptchaHandler.class.php b/wcfsetup/install/files/lib/system/captcha/RecaptchaHandler.class.php index 48ce4408c4..3c739c55e9 100644 --- a/wcfsetup/install/files/lib/system/captcha/RecaptchaHandler.class.php +++ b/wcfsetup/install/files/lib/system/captcha/RecaptchaHandler.class.php @@ -39,9 +39,9 @@ class RecaptchaHandler implements ICaptchaHandler { } else { // V2 - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'recaptchaLegacyMode' => true - )); + ]); } return WCF::getTPL()->fetch('recaptcha'); diff --git a/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php b/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php index 79252f952d..77b508cc20 100644 --- a/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php +++ b/wcfsetup/install/files/lib/system/category/AbstractCategoryType.class.php @@ -57,7 +57,7 @@ abstract class AbstractCategoryType extends SingletonFactory implements ICategor * key is the definition name and value the object type name) * @var string[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * @see \wcf\system\category\ICategoryType::afterDeletion() @@ -68,12 +68,12 @@ abstract class AbstractCategoryType extends SingletonFactory implements ICategor if (!empty($categoryIDs)) { // move child categories to parent category $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add("categoryID IN (?)", array($categoryIDs)); + $conditionBuilder->add("categoryID IN (?)", [$categoryIDs]); $sql = "UPDATE wcf".WCF_N."_category SET parentCategoryID = ? ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array($categoryEditor->parentCategoryID), $conditionBuilder->getParameters())); + $statement->execute(array_merge([$categoryEditor->parentCategoryID], $conditionBuilder->getParameters())); } } diff --git a/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php b/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php index b0e3d62795..904c1beb0e 100644 --- a/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php +++ b/wcfsetup/install/files/lib/system/category/CategoryHandler.class.php @@ -22,25 +22,25 @@ class CategoryHandler extends SingletonFactory { * cached categories * @var Category[] */ - protected $categories = array(); + protected $categories = []; /** * category ids grouped by the object type they belong to * @var integer[][] */ - protected $objectTypeCategoryIDs = array(); + protected $objectTypeCategoryIDs = []; /** * mapes the names of the category object types to the object type ids * @var integer[] */ - protected $objectTypeIDs = array(); + protected $objectTypeIDs = []; /** * list of category object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * Returns all category objects with the given object type. If no object @@ -50,7 +50,7 @@ class CategoryHandler extends SingletonFactory { * @return mixed[] */ public function getCategories($objectType = null) { - $categories = array(); + $categories = []; if ($objectType === null) { foreach ($this->objectTypes as $objectType) { $categories[$objectType->objectType] = $this->getCategories($objectType->objectType); @@ -94,7 +94,7 @@ class CategoryHandler extends SingletonFactory { throw new SystemException("Missing object type id"); } - $categories = array(); + $categories = []; foreach ($this->categories as $category) { if ($category->parentCategoryID == $categoryID && ($categoryID || $category->objectTypeID == $objectTypeID)) { $categories[$category->categoryID] = $category; @@ -150,8 +150,8 @@ class CategoryHandler extends SingletonFactory { $this->objectTypeIDs[$objectType->objectTypeID] = $objectType->objectType; } - $this->categories = CategoryCacheBuilder::getInstance()->getData(array(), 'categories'); - $this->objectTypeCategoryIDs = CategoryCacheBuilder::getInstance()->getData(array(), 'objectTypeCategoryIDs'); + $this->categories = CategoryCacheBuilder::getInstance()->getData([], 'categories'); + $this->objectTypeCategoryIDs = CategoryCacheBuilder::getInstance()->getData([], 'objectTypeCategoryIDs'); } /** diff --git a/wcfsetup/install/files/lib/system/cli/DatabaseCLICommandHistory.class.php b/wcfsetup/install/files/lib/system/cli/DatabaseCLICommandHistory.class.php index b61c75f281..34a7279c27 100644 --- a/wcfsetup/install/files/lib/system/cli/DatabaseCLICommandHistory.class.php +++ b/wcfsetup/install/files/lib/system/cli/DatabaseCLICommandHistory.class.php @@ -30,7 +30,7 @@ class DatabaseCLICommandHistory extends MemoryHistory { $sql = "DELETE FROM wcf".WCF_N."_cli_history WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); } $sql = "INSERT INTO wcf".WCF_N."_cli_history (userID, command) @@ -39,7 +39,7 @@ class DatabaseCLICommandHistory extends MemoryHistory { WCF::getDB()->beginTransaction(); foreach ($this as $item) { - $statement->execute(array(WCF::getUser()->userID, $item)); + $statement->execute([WCF::getUser()->userID, $item]); } WCF::getDB()->commitTransaction(); } @@ -52,7 +52,7 @@ class DatabaseCLICommandHistory extends MemoryHistory { FROM wcf".WCF_N."_cli_history WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); while ($row = $statement->fetchArray()) { $this->add($row['command']); diff --git a/wcfsetup/install/files/lib/system/cli/command/CLICommandHandler.class.php b/wcfsetup/install/files/lib/system/cli/command/CLICommandHandler.class.php index 52ca66289d..aba6601566 100644 --- a/wcfsetup/install/files/lib/system/cli/command/CLICommandHandler.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/CLICommandHandler.class.php @@ -21,7 +21,7 @@ class CLICommandHandler { * list of all available commands * @var ICLICommand[] */ - private static $commands = array(); + private static $commands = []; /** * Returns all available commands. @@ -96,7 +96,7 @@ class CLICommandHandler { $tmp = ''; $escaped = false; $quoted = false; - $return = array(); + $return = []; // handle quotes foreach ($chars as $char) { // escaped chars are simply added diff --git a/wcfsetup/install/files/lib/system/cli/command/CLICommandNameCompleter.class.php b/wcfsetup/install/files/lib/system/cli/command/CLICommandNameCompleter.class.php index 0d3c9a536f..3a80b1bdb6 100644 --- a/wcfsetup/install/files/lib/system/cli/command/CLICommandNameCompleter.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/CLICommandNameCompleter.class.php @@ -17,7 +17,7 @@ class CLICommandNameCompleter implements Completer { * names of all available commands * @var string[] */ - private $commands = array(); + private $commands = []; /** * Creates a new instance of CLICommandNameCompleter. diff --git a/wcfsetup/install/files/lib/system/cli/command/CronjobCLICommand.class.php b/wcfsetup/install/files/lib/system/cli/command/CronjobCLICommand.class.php index 5b78d316e4..3890e10cee 100644 --- a/wcfsetup/install/files/lib/system/cli/command/CronjobCLICommand.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/CronjobCLICommand.class.php @@ -25,7 +25,7 @@ class CronjobCLICommand implements IArgumentedCLICommand { * Initializes the argument parser. */ public function __construct() { - $this->argv = new ArgvParser(array()); + $this->argv = new ArgvParser([]); } /** diff --git a/wcfsetup/install/files/lib/system/cli/command/HelpCLICommand.class.php b/wcfsetup/install/files/lib/system/cli/command/HelpCLICommand.class.php index b68959b3c5..309b31954c 100644 --- a/wcfsetup/install/files/lib/system/cli/command/HelpCLICommand.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/HelpCLICommand.class.php @@ -25,12 +25,12 @@ class HelpCLICommand implements IArgumentedCLICommand { * Initializes the argument parser. */ public function __construct() { - $this->argv = new ArgvParser(array()); - $this->argv->setOptions(array( + $this->argv = new ArgvParser([]); + $this->argv->setOptions([ ArgvParser::CONFIG_FREEFORM_FLAGS => true, ArgvParser::CONFIG_PARSEALL => false, ArgvParser::CONFIG_CUMULATIVE_PARAMETERS => true - )); + ]); } /** @@ -48,12 +48,12 @@ class HelpCLICommand implements IArgumentedCLICommand { $commands = CLICommandHandler::getCommands(); if (!isset($commands[$args[0]])) { - throw new ArgvException(CLIWCF::getLanguage()->getDynamicVariable('wcf.cli.error.command.notFound', array('command' => $args[0])), $this->getUsage()); + throw new ArgvException(CLIWCF::getLanguage()->getDynamicVariable('wcf.cli.error.command.notFound', ['command' => $args[0]]), $this->getUsage()); } $command = $commands[$args[0]]; if (!($command instanceof IArgumentedCLICommand)) { - throw new ArgvException(CLIWCF::getLanguage()->getDynamicVariable('wcf.cli.error.help.noArguments', array('command' => $args[0])), $this->getUsage()); + throw new ArgvException(CLIWCF::getLanguage()->getDynamicVariable('wcf.cli.error.help.noArguments', ['command' => $args[0]]), $this->getUsage()); } CLIWCF::getReader()->println($command->getUsage()); diff --git a/wcfsetup/install/files/lib/system/cli/command/ImportCLICommand.class.php b/wcfsetup/install/files/lib/system/cli/command/ImportCLICommand.class.php index ead08affa5..333c27adc1 100644 --- a/wcfsetup/install/files/lib/system/cli/command/ImportCLICommand.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/ImportCLICommand.class.php @@ -66,7 +66,7 @@ class ImportCLICommand implements ICLICommand { * list of available exporters * @var ObjectType[] */ - protected $exporters = array(); + protected $exporters = []; /** * file system path @@ -78,7 +78,7 @@ class ImportCLICommand implements ICLICommand { * list of available importers * @var string[] */ - public $importers = array(); + public $importers = []; /** * indicates if the imported will be quit @@ -90,13 +90,13 @@ class ImportCLICommand implements ICLICommand { * selected data types * @var string[] */ - public $selectedData = array(); + public $selectedData = []; /** * list of supported data types * @var array */ - protected $supportedData = array(); + protected $supportedData = []; /** * user merge mode @@ -173,8 +173,8 @@ class ImportCLICommand implements ICLICommand { // step 7) save import data $queue = $this->exporter->getQueue(); - WCF::getSession()->register('importData', array( - 'additionalData' => array(), + WCF::getSession()->register('importData', [ + 'additionalData' => [], 'dbHost' => $this->dbHost, 'dbName' => $this->dbName, 'dbPassword' => $this->dbPassword, @@ -183,7 +183,7 @@ class ImportCLICommand implements ICLICommand { 'exporterName' => $this->exporterName, 'fileSystemPath' => $this->fileSystemPath, 'userMergeMode' => $this->userMergeMode - )); + ]); // step 8) import data CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.started')); @@ -191,10 +191,10 @@ class ImportCLICommand implements ICLICommand { foreach ($queue as $objectType) { CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.data.'.$objectType)); $workerCommand = CLICommandHandler::getCommand('worker'); - $workerCommand->execute(array( + $workerCommand->execute([ '--objectType='.$objectType, 'ImportWorker' - )); + ]); } CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.completed')); @@ -219,15 +219,15 @@ class ImportCLICommand implements ICLICommand { $this->dbPrefix = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database.prefix').'> '); if ($this->dbPrefix === null) exit; - $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, '', array()); + $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, '', []); try { $this->exporter->validateDatabaseAccess(); } catch (DatabaseException $e) { - $errorMessage = WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.configure.database.error', array( + $errorMessage = WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.configure.database.error', [ 'exception' => $e - )); + ]); $errorMessageLines = explode('
', $errorMessage); foreach ($errorMessageLines as &$line) { $line = StringUtil::stripHTML($line); @@ -249,16 +249,16 @@ class ImportCLICommand implements ICLICommand { */ protected function readExporter() { CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.selectExporter')); - $exporterSelection = array(); + $exporterSelection = []; $exporterIndex = 1; foreach ($this->exporters as $objectType) { CLIWCF::getReader()->println($exporterIndex.') '.WCF::getLanguage()->get('wcf.acp.dataImport.exporter.'.$objectType->objectType)); $exporterSelection[$exporterIndex++] = $objectType->objectType; } - CLIWCF::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', array( + CLIWCF::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', [ 'minSelection' => 1, 'maxSelection' => $exporterIndex - 1 - ))); + ])); while (true) { $exporterIndex = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.exporter').'> '); @@ -298,7 +298,7 @@ class ImportCLICommand implements ICLICommand { while (true) { $this->fileSystemPath = CLIWCF::getReader()->readLine('> '); if ($this->fileSystemPath === null) exit; - $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, $this->fileSystemPath, array()); + $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, $this->fileSystemPath, []); if (!$this->exporter->validateFileAccess()) { CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.configure.fileSystem.path.error')); @@ -314,13 +314,13 @@ class ImportCLICommand implements ICLICommand { */ protected function readSelectedData() { $printPrimaryTypes = true; - $selectedData = array(); - $supportedDataSelection = array( - '' => array() - ); + $selectedData = []; + $supportedDataSelection = [ + '' => [] + ]; $i = 1; - $availablePrimaryDataTypes = array(); + $availablePrimaryDataTypes = []; foreach ($this->supportedData as $objectType => $subData) { $availablePrimaryDataTypes[$i++] = $objectType; } @@ -342,10 +342,10 @@ class ImportCLICommand implements ICLICommand { $supportedDataIndex++; } } - CLIWCF::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', array( + CLIWCF::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', [ 'minSelection' => $minSupportedDataIndex, 'maxSelection' => $supportedDataIndex - 1 - ))); + ])); $printPrimaryTypes = false; } @@ -367,7 +367,7 @@ class ImportCLICommand implements ICLICommand { // validate selected primary import data type if (isset($supportedDataSelection[''][$selectedObjectTypeIndex])) { $selectedObjectType = $supportedDataSelection[''][$selectedObjectTypeIndex]; - $selectedData[$selectedObjectType] = array(); + $selectedData[$selectedObjectType] = []; unset($supportedDataSelection[''][$selectedObjectTypeIndex]); } else if (isset($availablePrimaryDataTypes[$selectedObjectTypeIndex])) { @@ -385,16 +385,16 @@ class ImportCLICommand implements ICLICommand { CLIWCF::getReader()->println(' '.WCF::getLanguage()->get('wcf.acp.dataImport.configure.data.description')); CLIWCF::getReader()->println(' 0) '.WCF::getLanguage()->get('wcf.acp.dataImport.cli.configure.data.selectAll')); - $supportedDataSelection[$selectedObjectType] = array(); + $supportedDataSelection[$selectedObjectType] = []; $supportedDataIndex = 1; foreach ($this->supportedData[$selectedObjectType] as $objectType) { CLIWCF::getReader()->println(' '.$supportedDataIndex.') '.WCF::getLanguage()->get('wcf.acp.dataImport.data.'.$objectType)); $supportedDataSelection[$selectedObjectType][$supportedDataIndex++] = $objectType; } - CLIWCF::getReader()->println(' '.WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', array( + CLIWCF::getReader()->println(' '.WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', [ 'minSelection' => 0, 'maxSelection' => $supportedDataIndex - 1 - ))); + ])); while (true) { // read index of selected secondary import data type @@ -462,10 +462,10 @@ class ImportCLICommand implements ICLICommand { CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.configure.settings.userMergeMode')); CLIWCF::getReader()->println('1) '.WCF::getLanguage()->get('wcf.acp.dataImport.configure.settings.userMergeMode.4').' (*)'); CLIWCF::getReader()->println('2) '.WCF::getLanguage()->get('wcf.acp.dataImport.configure.settings.userMergeMode.5')); - CLIWCF::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', array( + CLIWCF::getReader()->println(WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.cli.selection', [ 'minSelection' => 1, 'maxSelection' => 2 - ))); + ])); while (true) { $this->userMergeMode = CLIWCF::getReader()->readLine('> '); diff --git a/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php b/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php index a4b7cba1f0..ea20d43213 100644 --- a/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php +++ b/wcfsetup/install/files/lib/system/cli/command/WorkerCLICommand.class.php @@ -32,15 +32,15 @@ class WorkerCLICommand implements IArgumentedCLICommand { * Initializes the argument parser. */ public function __construct() { - $this->argv = new ArgvParser(array( + $this->argv = new ArgvParser([ 'l|list' => CLIWCF::getLanguage()->get('wcf.cli.worker.list'), 'setParameter=s' => CLIWCF::getLanguage()->get('wcf.cli.worker.setParameter') - )); - $this->argv->setOptions(array( + ]); + $this->argv->setOptions([ ArgvParser::CONFIG_FREEFORM_FLAGS => true, ArgvParser::CONFIG_PARSEALL => false, ArgvParser::CONFIG_CUMULATIVE_PARAMETERS => true - )); + ]); } /** @@ -87,12 +87,12 @@ class WorkerCLICommand implements IArgumentedCLICommand { // parse parameters $options = $this->argv->getOptions(); - $parameters = array(); + $parameters = []; foreach ($options as $option) { $value = $this->argv->getOption($option); if ($option === 'setParameter') { if (!is_array($value)) { - $value = array($value); + $value = [$value]; } foreach ($value as $parameter) { @@ -110,9 +110,9 @@ class WorkerCLICommand implements IArgumentedCLICommand { $worker->getProgress(); // make sure objects are counted // initialize progressbar - $progressbar = new ProgressBar(new ConsoleProgressBar(array( + $progressbar = new ProgressBar(new ConsoleProgressBar([ 'width' => CLIWCF::getTerminal()->getWidth() - ))); + ])); $progress = 0; for ($i = 0; $progress < 100; $i++) { $worker->setLoopCount($i); @@ -140,12 +140,12 @@ class WorkerCLICommand implements IArgumentedCLICommand { $directory = DirectoryUtil::getInstance(WCF_DIR.'lib/system/worker/'); $workerList = $directory->getFiles(SORT_ASC, new Regex('Worker\.class\.php$')); - $table = array( - array( + $table = [ + [ 'Class', 'Description' - ) - ); + ] + ]; foreach ($workerList as $worker) { $class = 'wcf\system\worker\\'.basename($worker, '.class.php'); if (!class_exists($class) && !interface_exists($class)) { @@ -168,10 +168,10 @@ class WorkerCLICommand implements IArgumentedCLICommand { } } - $table[] = array( + $table[] = [ basename($worker, '.class.php'), $comment - ); + ]; } return $table; diff --git a/wcfsetup/install/files/lib/system/clipboard/ClipboardEditorItem.class.php b/wcfsetup/install/files/lib/system/clipboard/ClipboardEditorItem.class.php index 2418fc2108..31b1cec810 100644 --- a/wcfsetup/install/files/lib/system/clipboard/ClipboardEditorItem.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/ClipboardEditorItem.class.php @@ -17,7 +17,7 @@ final class ClipboardEditorItem { * internal data * @var array */ - protected $internalData = array(); + protected $internalData = []; /** * item name @@ -29,7 +29,7 @@ final class ClipboardEditorItem { * list of parameters passed to ClipboardProxyAction * @var array */ - protected $parameters = array(); + protected $parameters = []; /** * redirect url diff --git a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php index 7de50d708e..d92feefc7c 100644 --- a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php @@ -54,10 +54,10 @@ class ClipboardHandler extends SingletonFactory { * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $this->cache = array( - 'objectTypes' => array(), - 'objectTypeNames' => array() - ); + $this->cache = [ + 'objectTypes' => [], + 'objectTypeNames' => [] + ]; $cache = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.clipboardItem'); foreach ($cache as $objectType) { $this->cache['objectTypes'][$objectType->objectTypeID] = $objectType; @@ -91,11 +91,11 @@ class ClipboardHandler extends SingletonFactory { VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($objectIDs as $objectID) { - $statement->execute(array( + $statement->execute([ $objectTypeID, WCF::getUser()->userID, $objectID - )); + ]); } } @@ -107,9 +107,9 @@ class ClipboardHandler extends SingletonFactory { */ public function unmark(array $objectIDs, $objectTypeID) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectTypeID)); - $conditions->add("objectID IN (?)", array($objectIDs)); - $conditions->add("userID = ?", array(WCF::getUser()->userID)); + $conditions->add("objectTypeID = ?", [$objectTypeID]); + $conditions->add("objectID IN (?)", [$objectIDs]); + $conditions->add("userID = ?", [WCF::getUser()->userID]); $sql = "DELETE FROM wcf".WCF_N."_clipboard_item ".$conditions; @@ -127,10 +127,10 @@ class ClipboardHandler extends SingletonFactory { WHERE objectTypeID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, WCF::getUser()->userID - )); + ]); } /** @@ -185,7 +185,7 @@ class ClipboardHandler extends SingletonFactory { */ protected function loadMarkedItems($objectTypeID = null) { if ($this->markedItems === null) { - $this->markedItems = array(); + $this->markedItems = []; } if ($objectTypeID !== null) { @@ -195,14 +195,14 @@ class ClipboardHandler extends SingletonFactory { } if (!isset($this->markedItems[$objectType->objectType])) { - $this->markedItems[$objectType->objectType] = array(); + $this->markedItems[$objectType->objectType] = []; } } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID = ?", array(WCF::getUser()->userID)); + $conditions->add("userID = ?", [WCF::getUser()->userID]); if ($objectTypeID !== null) { - $conditions->add("objectTypeID = ?", array($objectTypeID)); + $conditions->add("objectTypeID = ?", [$objectTypeID]); } // fetch object ids @@ -213,7 +213,7 @@ class ClipboardHandler extends SingletonFactory { $statement->execute($conditions->getParameters()); // group object ids by type name - $data = array(); + $data = []; while ($row = $statement->fetchArray()) { $objectType = $this->getObjectType($row['objectTypeID']); if ($objectType === null) { @@ -225,10 +225,10 @@ class ClipboardHandler extends SingletonFactory { throw new SystemException("Missing list class for object type '".$objectType->objectType."'"); } - $data[$objectType->objectType] = array( + $data[$objectType->objectType] = [ 'className' => $objectType->listclassname, - 'objectIDs' => array() - ); + 'objectIDs' => [] + ]; } $data[$objectType->objectType]['objectIDs'][] = $row['objectID']; @@ -237,7 +237,7 @@ class ClipboardHandler extends SingletonFactory { // read objects foreach ($data as $objectType => $objectData) { $objectList = new $objectData['className'](); - $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias() . "." . $objectList->getDatabaseTableIndexName() . " IN (?)", array($objectData['objectIDs'])); + $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias() . "." . $objectList->getDatabaseTableIndexName() . " IN (?)", [$objectData['objectIDs']]); $objectList->readObjects(); $this->markedItems[$objectType] = $objectList->getObjects(); @@ -251,9 +251,9 @@ class ClipboardHandler extends SingletonFactory { if (!empty($objectData['objectIDs'])) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($this->getObjectTypeByName($objectType))); - $conditions->add("userID = ?", array(WCF::getUser()->userID)); - $conditions->add("objectID IN (?)", array($objectData['objectIDs'])); + $conditions->add("objectTypeID = ?", [$this->getObjectTypeByName($objectType)]); + $conditions->add("userID = ?", [WCF::getUser()->userID]); + $conditions->add("objectID IN (?)", [$objectData['objectIDs']]); $sql = "DELETE FROM wcf".WCF_N."_clipboard_item ".$conditions; @@ -308,7 +308,7 @@ class ClipboardHandler extends SingletonFactory { // fetch action ids $this->loadActionCache(); - $actionIDs = array(); + $actionIDs = []; foreach ($this->pageCache[$page] as $actionID) { if (isset($this->actionCache[$actionID])) { $actionIDs[] = $actionID; @@ -317,7 +317,7 @@ class ClipboardHandler extends SingletonFactory { $actionIDs = array_unique($actionIDs); // load actions - $actions = array(); + $actions = []; foreach ($actionIDs as $actionID) { $actionObject = $this->actionCache[$actionID]; $actionClassName = $actionObject->actionClassName; @@ -327,27 +327,27 @@ class ClipboardHandler extends SingletonFactory { throw new SystemException("'".$actionClassName."' does not implement 'wcf\system\clipboard\action\IClipboardAction'"); } - $actions[$actionClassName] = array( - 'actions' => array(), + $actions[$actionClassName] = [ + 'actions' => [], 'object' => new $actionClassName() - ); + ]; } $actions[$actionClassName]['actions'][] = $actionObject; } // execute actions - $editorData = array(); + $editorData = []; foreach ($actions as $actionData) { // get accepted objects $typeName = $actionData['object']->getTypeName(); if (!isset($this->markedItems[$typeName]) || empty($this->markedItems[$typeName])) continue; if (!isset($editorData[$typeName])) { - $editorData[$typeName] = array( + $editorData[$typeName] = [ 'label' => $actionData['object']->getEditorLabel($this->markedItems[$typeName]), - 'items' => array() - ); + 'items' => [] + ]; } foreach ($actionData['actions'] as $actionObject) { @@ -370,8 +370,8 @@ class ClipboardHandler extends SingletonFactory { */ public function removeItems($typeID = null) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID = ?", array(WCF::getUser()->userID)); - if ($typeID !== null) $conditions->add("objectTypeID = ?", array($typeID)); + $conditions->add("userID = ?", [WCF::getUser()->userID]); + if ($typeID !== null) $conditions->add("objectTypeID = ?", [$typeID]); $sql = "DELETE FROM wcf".WCF_N."_clipboard_item ".$conditions; @@ -389,9 +389,9 @@ class ClipboardHandler extends SingletonFactory { if (!WCF::getUser()->userID) return 0; $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add("userID = ?", array(WCF::getUser()->userID)); + $conditionBuilder->add("userID = ?", [WCF::getUser()->userID]); if ($objectTypeID !== null) { - $conditionBuilder->add("objectTypeID = ?", array($objectTypeID)); + $conditionBuilder->add("objectTypeID = ?", [$objectTypeID]); } $sql = "SELECT COUNT(*) diff --git a/wcfsetup/install/files/lib/system/clipboard/action/AbstractClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/AbstractClipboardAction.class.php index 38505aa1a5..b974150e64 100644 --- a/wcfsetup/install/files/lib/system/clipboard/action/AbstractClipboardAction.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/action/AbstractClipboardAction.class.php @@ -21,19 +21,19 @@ abstract class AbstractClipboardAction implements IClipboardAction { * list of the clipboard actions which are executed by the action class * @var string[] */ - protected $actionClassActions = array(); + protected $actionClassActions = []; /** * relevant database objects * @var DatabaseObject[] */ - protected $objects = array(); + protected $objects = []; /** * list of the supported clipboard actions * @var string[] */ - protected $supportedActions = array(); + protected $supportedActions = []; /** * @see \wcf\system\clipboard\action\IClipboardAction::execute() @@ -72,8 +72,8 @@ abstract class AbstractClipboardAction implements IClipboardAction { * @see \wcf\system\clipboard\action\IClipboardAction::getEditorLabel() */ public function getEditorLabel(array $objects) { - return WCF::getLanguage()->getDynamicVariable('wcf.clipboard.label.'.$this->getTypeName().'.marked', array( + return WCF::getLanguage()->getDynamicVariable('wcf.clipboard.label.'.$this->getTypeName().'.marked', [ 'count' => count($objects) - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/clipboard/action/TagClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/TagClipboardAction.class.php index 5ad1fa1cc4..27a5f5e0a8 100644 --- a/wcfsetup/install/files/lib/system/clipboard/action/TagClipboardAction.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/action/TagClipboardAction.class.php @@ -18,12 +18,12 @@ class TagClipboardAction extends AbstractClipboardAction { /** * @see \wcf\system\clipboard\action\AbstractClipboardAction::$actionClassActions */ - protected $actionClassActions = array('delete'); + protected $actionClassActions = ['delete']; /** * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions */ - protected $supportedActions = array('delete', 'setAsSynonyms'); + protected $supportedActions = ['delete', 'setAsSynonyms']; /** * @see \wcf\system\clipboard\action\IClipboardAction::execute() diff --git a/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php index 52e791b428..05d25fcc93 100644 --- a/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php @@ -20,12 +20,12 @@ class UserClipboardAction extends AbstractClipboardAction { /** * @see \wcf\system\clipboard\action\AbstractClipboardAction::$actionClassActions */ - protected $actionClassActions = array('delete'); + protected $actionClassActions = ['delete']; /** * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions */ - protected $supportedActions = array('assignToGroup', 'ban', 'delete', 'enable', 'exportMailAddress', 'merge', 'sendMail', 'sendNewPassword'); + protected $supportedActions = ['assignToGroup', 'ban', 'delete', 'enable', 'exportMailAddress', 'merge', 'sendMail', 'sendNewPassword']; /** * @see \wcf\system\clipboard\action\IClipboardAction::execute() @@ -44,9 +44,9 @@ class UserClipboardAction extends AbstractClipboardAction { break; case 'delete': - $item->addInternalData('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.user.delete.confirmMessage', array( + $item->addInternalData('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.user.delete.confirmMessage', [ 'count' => $item->getCount() - ))); + ])); break; case 'exportMailAddress': @@ -62,9 +62,9 @@ class UserClipboardAction extends AbstractClipboardAction { break; case 'sendNewPassword': - $item->addParameter('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.user.sendNewPassword.confirmMessage', array( + $item->addParameter('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.user.sendNewPassword.confirmMessage', [ 'count' => $item->getCount() - ))); + ])); break; } @@ -93,7 +93,7 @@ class UserClipboardAction extends AbstractClipboardAction { protected function validateDelete() { // check permissions if (!WCF::getSession()->getPermission('admin.user.canDeleteUser')) { - return array(); + return []; } return $this->__validateAccessibleGroups(array_keys($this->objects)); @@ -107,7 +107,7 @@ class UserClipboardAction extends AbstractClipboardAction { protected function validateBan() { // check permissions if (!WCF::getSession()->getPermission('admin.user.canBanUser')) { - return array(); + return []; } return $this->__validateAccessibleGroups(array_keys($this->objects)); @@ -128,11 +128,11 @@ class UserClipboardAction extends AbstractClipboardAction { } // no valid users found - if (empty($userIDs)) return array(); + if (empty($userIDs)) return []; // fetch user to group associations $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($userIDs)); + $conditions->add("userID IN (?)", [$userIDs]); $sql = "SELECT userID, groupID FROM wcf".WCF_N."_user_to_group @@ -140,10 +140,10 @@ class UserClipboardAction extends AbstractClipboardAction { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $userToGroup = array(); + $userToGroup = []; while ($row = $statement->fetchArray()) { if (!isset($userToGroup[$row['userID']])) { - $userToGroup[$row['userID']] = array(); + $userToGroup[$row['userID']] = []; } $userToGroup[$row['userID']][] = $row['groupID']; @@ -167,7 +167,7 @@ class UserClipboardAction extends AbstractClipboardAction { public function validateSendNewPassword() { // check permissions if (!WCF::getSession()->getPermission('admin.user.canEditPassword')) { - return array(); + return []; } return $this->__validateAccessibleGroups(array_keys($this->objects)); @@ -182,10 +182,10 @@ class UserClipboardAction extends AbstractClipboardAction { protected function validateEnable() { // check permissions if (!WCF::getSession()->getPermission('admin.user.canEnableUser')) { - return array(); + return []; } - $userIDs = array(); + $userIDs = []; foreach ($this->objects as $user) { if ($user->activationCode) $userIDs[] = $user->userID; } @@ -202,11 +202,11 @@ class UserClipboardAction extends AbstractClipboardAction { protected function validateMerge() { // check permissions if (!WCF::getSession()->getPermission('admin.user.canEditUser')) { - return array(); + return []; } $userIDs = array_keys($this->objects); - if (count($userIDs) < 2) return array(); + if (count($userIDs) < 2) return []; return $userIDs; } diff --git a/wcfsetup/install/files/lib/system/clipboard/action/UserContentClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/UserContentClipboardAction.class.php index 6103e289d5..3a0a11e5ad 100644 --- a/wcfsetup/install/files/lib/system/clipboard/action/UserContentClipboardAction.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/action/UserContentClipboardAction.class.php @@ -18,7 +18,7 @@ class UserContentClipboardAction extends AbstractClipboardAction { /** * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions */ - protected $supportedActions = array('revertContentChanges'); + protected $supportedActions = ['revertContentChanges']; /** * @see \wcf\system\clipboard\action\IClipboardAction::execute() @@ -61,15 +61,15 @@ class UserContentClipboardAction extends AbstractClipboardAction { */ protected function validateRevertContentChanges() { if (!MODULE_EDIT_HISTORY) { - return array(); + return []; } // check permissions if (!WCF::getSession()->getPermission('admin.content.canBulkRevertContentChanges')) { - return array(); + return []; } - $userIDs = array(); + $userIDs = []; foreach ($this->objects as $user) { $userIDs[] = $user->userID; } diff --git a/wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php index 1def9d3986..47e12dfb55 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php @@ -44,12 +44,12 @@ class ModerationQueueCommentManager extends AbstractCommentManager { public function updateCounter($objectID, $value) { $entry = new ModerationQueue($objectID); $editor = new ModerationQueueEditor($entry); - $editor->updateCounters(array( + $editor->updateCounters([ 'comments' => $value - )); - $editor->update(array( + ]); + $editor->update([ 'lastChangeTime' => TIME_NOW - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php index 43e7b1f634..fb07321eb7 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php @@ -84,7 +84,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa * @see \wcf\system\comment\manager\ICommentManager::getLink() */ public function getLink($objectTypeID, $objectID) { - return LinkHandler::getInstance()->getLink('User', array('id' => $objectID)); + return LinkHandler::getInstance()->getLink('User', ['id' => $objectID]); } /** @@ -135,7 +135,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa $commentLikeObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.like.likeableObject', 'com.woltlab.wcf.comment'); - $commentIDs = $responseIDs = array(); + $commentIDs = $responseIDs = []; foreach ($likes as $like) { if ($like->objectTypeID == $commentLikeObjectType->objectTypeID) { $commentIDs[] = $like->objectID; @@ -146,7 +146,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa } // fetch response - $userIDs = $responses = array(); + $userIDs = $responses = []; if (!empty($responseIDs)) { $responseList = new CommentResponseList(); $responseList->setObjectIDs($responseIDs); @@ -168,7 +168,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa $comments = $commentList->getObjects(); // fetch users - $users = array(); + $users = []; foreach ($comments as $comment) { $userIDs[] = $comment->objectID; if ($comment->userID) { @@ -190,11 +190,11 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa $like->setIsAccessible(); // short output - $text = WCF::getLanguage()->getDynamicVariable('wcf.like.title.com.woltlab.wcf.user.profileComment', array( + $text = WCF::getLanguage()->getDynamicVariable('wcf.like.title.com.woltlab.wcf.user.profileComment', [ 'commentAuthor' => $comment->userID ? $users[$comment->userID] : null, 'user' => $users[$comment->objectID], 'like' => $like - )); + ]); $like->setTitle($text); // output @@ -212,12 +212,12 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa $like->setIsAccessible(); // short output - $text = WCF::getLanguage()->getDynamicVariable('wcf.like.title.com.woltlab.wcf.user.profileComment.response', array( + $text = WCF::getLanguage()->getDynamicVariable('wcf.like.title.com.woltlab.wcf.user.profileComment.response', [ 'responseAuthor' => $comment->userID ? $users[$response->userID] : null, 'commentAuthor' => $comment->userID ? $users[$comment->userID] : null, 'user' => $users[$comment->objectID], 'like' => $like - )); + ]); $like->setTitle($text); // output diff --git a/wcfsetup/install/files/lib/system/condition/ConditionHandler.class.php b/wcfsetup/install/files/lib/system/condition/ConditionHandler.class.php index 30c1cf9fb5..4ec2f5fb98 100644 --- a/wcfsetup/install/files/lib/system/condition/ConditionHandler.class.php +++ b/wcfsetup/install/files/lib/system/condition/ConditionHandler.class.php @@ -25,7 +25,7 @@ class ConditionHandler extends SingletonFactory { * object type definition * @var array */ - protected $conditions = array(); + protected $conditions = []; /** * Creates condition objects for the object with the given id and based @@ -38,13 +38,13 @@ class ConditionHandler extends SingletonFactory { foreach ($conditionObjectTypes as $objectType) { $conditionData = $objectType->getProcessor()->getData(); if ($conditionData !== null) { - $conditionAction = new ConditionAction(array(), 'create', array( - 'data' => array( + $conditionAction = new ConditionAction([], 'create', [ + 'data' => [ 'conditionData' => serialize($conditionData), 'objectID' => $objectID, 'objectTypeID' => $objectType->objectTypeID - ) - )); + ] + ]); $conditionAction->executeAction(); } } @@ -66,7 +66,7 @@ class ConditionHandler extends SingletonFactory { } $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes($definitionName); - $objectTypeIDs = array(); + $objectTypeIDs = []; foreach ($objectTypes as $objectType) { $objectTypeIDs[] = $objectType->objectTypeID; } @@ -74,8 +74,8 @@ class ConditionHandler extends SingletonFactory { if (empty($objectTypeIDs)) return; $conditionList = new ConditionList(); - $conditionList->getConditionBuilder()->add('objectTypeID IN (?)', array($objectTypeIDs)); - $conditionList->getConditionBuilder()->add('objectID IN (?)', array($objectIDs)); + $conditionList->getConditionBuilder()->add('objectTypeID IN (?)', [$objectTypeIDs]); + $conditionList->getConditionBuilder()->add('objectID IN (?)', [$objectIDs]); $conditionList->readObjects(); if (count($conditionList)) { @@ -101,16 +101,16 @@ class ConditionHandler extends SingletonFactory { } if (!isset($this->conditions[$definition->definitionID])) { - $this->conditions[$definition->definitionID] = ConditionCacheBuilder::getInstance()->getData(array( + $this->conditions[$definition->definitionID] = ConditionCacheBuilder::getInstance()->getData([ 'definitionID' => $definition->definitionID - )); + ]); } if (isset($this->conditions[$definition->definitionID][$objectID])) { return $this->conditions[$definition->definitionID][$objectID]; } - return array(); + return []; } /** diff --git a/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php index 4fc04164c3..8b68b99cc5 100644 --- a/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/AttachmentCleanUpCronjob.class.php @@ -27,10 +27,10 @@ class AttachmentCleanUpCronjob extends AbstractCronjob { WHERE objectID = ? AND uploadTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 0, (TIME_NOW - 86400) - )); + ]); $attachmentIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($attachmentIDs)) { diff --git a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php index f295fd8784..4862e32e8b 100644 --- a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php @@ -23,13 +23,13 @@ class CronjobScheduler extends SingletonFactory { * cached times of the next and after next cronjob execution * @var integer[] */ - protected $cache = array(); + protected $cache = []; /** * list of editors for outstanding cronjobs * @var CronjobEditor[] */ - protected $cronjobEditors = array(); + protected $cronjobEditors = []; /** * @see \wcf\system\SingletonFactory::init() @@ -55,15 +55,15 @@ class CronjobScheduler extends SingletonFactory { foreach ($this->cronjobEditors as $cronjobEditor) { // mark cronjob as being executed - $cronjobEditor->update(array( + $cronjobEditor->update([ 'state' => Cronjob::EXECUTING - )); + ]); // create log entry - $log = CronjobLogEditor::create(array( + $log = CronjobLogEditor::create([ 'cronjobID' => $cronjobEditor->cronjobID, 'execTime' => TIME_NOW - )); + ]); $logEditor = new CronjobLogEditor($log); // check if all required options are set for cronjob to be executed @@ -87,13 +87,13 @@ class CronjobScheduler extends SingletonFactory { $afterNextExec = $cronjobEditor->getNextExec(($nextExec + 120)); // mark cronjob as done - $cronjobEditor->update(array( + $cronjobEditor->update([ 'lastExec' => TIME_NOW, 'afterNextExec' => $afterNextExec, 'failCount' => 0, 'nextExec' => $nextExec, 'state' => Cronjob::READY - )); + ]); } } @@ -116,20 +116,20 @@ class CronjobScheduler extends SingletonFactory { AND cronjob.isDisabled = ? AND cronjob.failCount < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ TIME_NOW, TIME_NOW, 0, Cronjob::MAX_FAIL_COUNT - )); + ]); while ($row = $statement->fetchArray()) { $cronjob = new Cronjob(null, $row); $cronjobEditor = new CronjobEditor($cronjob); $executeCronjob = true; - $data = array( + $data = [ 'state' => Cronjob::PENDING - ); + ]; // reset cronjob if it got stuck before and afterNextExec is in the past if ($cronjobEditor->afterNextExec <= TIME_NOW) { @@ -192,23 +192,23 @@ class CronjobScheduler extends SingletonFactory { */ protected function logResult(CronjobLogEditor $logEditor, SystemException $exception = null) { if ($exception !== null) { - $errString = implode("\n", array( + $errString = implode("\n", [ $exception->getMessage(), $exception->getCode(), $exception->getFile(), $exception->getLine(), $exception->getTraceAsString() - )); + ]); - $logEditor->update(array( + $logEditor->update([ 'success' => 0, 'error' => $errString - )); + ]); } else { - $logEditor->update(array( + $logEditor->update([ 'success' => 1 - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php index f4bfb8718e..108decb8ff 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php @@ -35,35 +35,35 @@ class DailyCleanUpCronjob extends AbstractCronjob { WHERE searches <= ? AND lastSearchTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ floor($row['searches'] / 4), (TIME_NOW - 86400 * 30) - )); + ]); } // clean up notifications $sql = "DELETE FROM wcf".WCF_N."_user_notification WHERE time < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - 86400 * USER_CLEANUP_NOTIFICATION_LIFETIME) - )); + ]); // clean up user activity events $sql = "DELETE FROM wcf".WCF_N."_user_activity_event WHERE time < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - 86400 * USER_CLEANUP_ACTIVITY_EVENT_LIFETIME) - )); + ]); // clean up profile visitors $sql = "DELETE FROM wcf".WCF_N."_user_profile_visitor WHERE time < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - 86400 * USER_CLEANUP_PROFILE_VISITOR_LIFETIME) - )); + ]); // tracked visits $sql = "DELETE FROM wcf".WCF_N."_tracked_visit @@ -81,14 +81,14 @@ class DailyCleanUpCronjob extends AbstractCronjob { $lifetime = ($objectType->lifetime ?: VisitTracker::DEFAULT_LIFETIME); // delete data - $statement1->execute(array( + $statement1->execute([ $objectType->objectTypeID, $lifetime - )); - $statement2->execute(array( + ]); + $statement2->execute([ $objectType->objectTypeID, $lifetime - )); + ]); } WCF::getDB()->commitTransaction(); @@ -96,9 +96,9 @@ class DailyCleanUpCronjob extends AbstractCronjob { $sql = "DELETE FROM wcf".WCF_N."_cronjob_log WHERE execTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - (86400 * 7)) - )); + ]); // clean up session access log $sql = "DELETE FROM wcf".WCF_N."_acp_session_access_log @@ -108,25 +108,25 @@ class DailyCleanUpCronjob extends AbstractCronjob { WHERE lastActivityTime < ? )"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - (86400 * 30)) - )); + ]); // clean up session log $sql = "DELETE FROM wcf".WCF_N."_acp_session_log WHERE lastActivityTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - (86400 * 30)) - )); + ]); // clean up search data $sql = "DELETE FROM wcf".WCF_N."_search WHERE searchTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - 86400) - )); + ]); // clean up expired edit history entries if (MODULE_EDIT_HISTORY) { @@ -134,9 +134,9 @@ class DailyCleanUpCronjob extends AbstractCronjob { $sql = "DELETE FROM wcf".WCF_N."_edit_history_entry WHERE obsoletedAt < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - 86400 * EDIT_HISTORY_EXPIRATION) - )); + ]); } } else { @@ -151,9 +151,9 @@ class DailyCleanUpCronjob extends AbstractCronjob { $sql = "DELETE FROM wcf".WCF_N."_user_authentication_failure WHERE time < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ (TIME_NOW - 86400 * USER_AUTHENTICATION_FAILURE_EXPIRATION) - )); + ]); } // clean up error logs diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php index 5510a26e4f..9323e651b3 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php @@ -38,11 +38,11 @@ class DailyMailNotificationCronjob extends AbstractCronjob { AND time < ? AND confirmTime = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 0, TIME_NOW - 3600 * 23, 0 - )); + ]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (empty($userIDs)) return; @@ -54,9 +54,9 @@ class DailyMailNotificationCronjob extends AbstractCronjob { // get notifications $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("notification.userID IN (?)", array($userIDs)); - $conditions->add("notification.mailNotified = ?", array(0)); - $conditions->add("notification.confirmTime = ?", array(0)); + $conditions->add("notification.userID IN (?)", [$userIDs]); + $conditions->add("notification.mailNotified = ?", [0]); + $conditions->add("notification.confirmTime = ?", [0]); $sql = "SELECT notification.*, notification_event.eventID, object_type.objectType FROM wcf".WCF_N."_user_notification notification @@ -71,8 +71,8 @@ class DailyMailNotificationCronjob extends AbstractCronjob { // mark notifications as done $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($userIDs)); - $conditions->add("mailNotified = ?", array(0)); + $conditions->add("userID IN (?)", [$userIDs]); + $conditions->add("mailNotified = ?", [0]); $sql = "UPDATE wcf".WCF_N."_user_notification SET mailNotified = 1 ".$conditions; @@ -80,19 +80,19 @@ class DailyMailNotificationCronjob extends AbstractCronjob { $statement2->execute($conditions->getParameters()); // collect data - $eventsToUser = $objectTypes = $eventIDs = $notificationObjects = array(); + $eventsToUser = $objectTypes = $eventIDs = $notificationObjects = []; $availableObjectTypes = UserNotificationHandler::getInstance()->getAvailableObjectTypes(); while ($row = $statement->fetchArray()) { - if (!isset($eventsToUser[$row['userID']])) $eventsToUser[$row['userID']] = array(); + if (!isset($eventsToUser[$row['userID']])) $eventsToUser[$row['userID']] = []; $eventsToUser[$row['userID']][] = $row['notificationID']; // cache object types if (!isset($objectTypes[$row['objectType']])) { - $objectTypes[$row['objectType']] = array( + $objectTypes[$row['objectType']] = [ 'objectType' => $availableObjectTypes[$row['objectType']], - 'objectIDs' => array(), - 'objects' => array() - ); + 'objectIDs' => [], + 'objects' => [] + ]; } $objectTypes[$row['objectType']]['objectIDs'][] = $row['objectID']; @@ -103,21 +103,21 @@ class DailyMailNotificationCronjob extends AbstractCronjob { // load authors $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("notificationID IN (?)", array(array_keys($notificationObjects))); + $conditions->add("notificationID IN (?)", [array_keys($notificationObjects)]); $sql = "SELECT notificationID, authorID FROM wcf".WCF_N."_user_notification_author ".$conditions." ORDER BY time ASC"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $authorIDs = $authorToNotification = array(); + $authorIDs = $authorToNotification = []; while ($row = $statement->fetchArray()) { if ($row['authorID']) { $authorIDs[] = $row['authorID']; } if (!isset($authorToNotification[$row['notificationID']])) { - $authorToNotification[$row['notificationID']] = array(); + $authorToNotification[$row['notificationID']] = []; } $authorToNotification[$row['notificationID']][] = $row['authorID']; @@ -125,7 +125,7 @@ class DailyMailNotificationCronjob extends AbstractCronjob { // load authors $authors = UserProfileRuntimeCache::getInstance()->getObjects($authorIDs); - $unknownAuthor = new UserProfile(new User(null, array('userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')))); + $unknownAuthor = new UserProfile(new User(null, ['userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')])); // load objects associated with each object type foreach ($objectTypes as $objectType => $objectData) { @@ -134,7 +134,7 @@ class DailyMailNotificationCronjob extends AbstractCronjob { // load required events $eventList = new UserNotificationEventList(); - $eventList->getConditionBuilder()->add("user_notification_event.eventID IN (?)", array($eventIDs)); + $eventList->getConditionBuilder()->add("user_notification_event.eventID IN (?)", [$eventIDs]); $eventList->readObjects(); $eventObjects = $eventList->getObjects(); @@ -147,9 +147,9 @@ class DailyMailNotificationCronjob extends AbstractCronjob { if ($user->banned) continue; // add mail header - $message = $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.header', array( + $message = $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.header', [ 'user' => $user - )); + ]); foreach ($events as $notificationID) { $notification = $notificationObjects[$notificationID]; @@ -165,7 +165,7 @@ class DailyMailNotificationCronjob extends AbstractCronjob { $class->setLanguage($user->getLanguage()); if (isset($authorToNotification[$notification->notificationID])) { - $eventAuthors = array(); + $eventAuthors = []; foreach ($authorToNotification[$notification->notificationID] as $userID) { if (!$userID) { $eventAuthors[0] = $unknownAuthor; @@ -187,19 +187,19 @@ class DailyMailNotificationCronjob extends AbstractCronjob { $token = $user->notificationMailToken; if (!$token) { // generate token if not present - $token = mb_substr(StringUtil::getHash(serialize(array($user->userID, StringUtil::getRandomID()))), 0, 20); + $token = mb_substr(StringUtil::getHash(serialize([$user->userID, StringUtil::getRandomID()])), 0, 20); $editor = new UserEditor($user); - $editor->update(array('notificationMailToken' => $token)); + $editor->update(['notificationMailToken' => $token]); } $message .= "\n\n"; - $message .= $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.daily.footer', array( + $message .= $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.daily.footer', [ 'user' => $user, 'token' => $token - )); + ]); // build mail - $mail = new Mail(array($user->username => $user->email), $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.daily.subject', array('count' => count($events))), $message); + $mail = new Mail([$user->username => $user->email], $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.daily.subject', ['count' => count($events)]), $message); $mail->setLanguage($user->getLanguage()); $mail->send(); } diff --git a/wcfsetup/install/files/lib/system/cronjob/HourlyCleanUpCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/HourlyCleanUpCronjob.class.php index d510170199..dfe50d3cd6 100644 --- a/wcfsetup/install/files/lib/system/cronjob/HourlyCleanUpCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/HourlyCleanUpCronjob.class.php @@ -24,8 +24,8 @@ class HourlyCleanUpCronjob extends AbstractCronjob { // disable expired paid subscriptions if (MODULE_PAID_SUBSCRIPTION) { $subscriptionUserList = new PaidSubscriptionUserList(); - $subscriptionUserList->getConditionBuilder()->add('isActive = ?', array(1)); - $subscriptionUserList->getConditionBuilder()->add('endDate > 0 AND endDate < ?', array(TIME_NOW)); + $subscriptionUserList->getConditionBuilder()->add('isActive = ?', [1]); + $subscriptionUserList->getConditionBuilder()->add('endDate > 0 AND endDate < ?', [TIME_NOW]); $subscriptionUserList->readObjects(); if (count($subscriptionUserList->getObjects())) { diff --git a/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php index fbf9dee464..4e85ee8677 100644 --- a/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/ModerationQueueCronjob.class.php @@ -28,15 +28,15 @@ class ModerationQueueCronjob extends AbstractCronjob { WHERE status = ? AND lastChangeTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ ModerationQueue::STATUS_DONE, (TIME_NOW - (86400 * 30)) - )); + ]); $queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($queueIDs)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("queueID IN (?)", array($queueIDs)); + $conditions->add("queueID IN (?)", [$queueIDs]); $sql = "DELETE FROM wcf".WCF_N."_moderation_queue ".$conditions; diff --git a/wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.class.php index 093f1f6472..38dbab0e10 100644 --- a/wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.class.php @@ -32,17 +32,17 @@ class RefreshSearchRobotsCronjob implements ICronjob { if (!empty($spiders)) { $existingSpiders = SpiderCacheBuilder::getInstance()->getData(); - $statementParameters = array(); + $statementParameters = []; foreach ($spiders as $spider) { $identifier = mb_strtolower($spider->getAttribute('ident')); $name = $xpath->query('ns:name', $spider)->item(0); $info = $xpath->query('ns:url', $spider)->item(0); - $statementParameters[$identifier] = array( + $statementParameters[$identifier] = [ 'spiderIdentifier' => $identifier, 'spiderName' => $name->nodeValue, 'spiderURL' => $info ? $info->nodeValue : '' - ); + ]; } if (!empty($statementParameters)) { @@ -55,11 +55,11 @@ class RefreshSearchRobotsCronjob implements ICronjob { WCF::getDB()->beginTransaction(); foreach ($statementParameters as $parameters) { - $statement->execute(array( + $statement->execute([ $parameters['spiderIdentifier'], $parameters['spiderName'], $parameters['spiderURL'] - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -69,7 +69,7 @@ class RefreshSearchRobotsCronjob implements ICronjob { $statement = WCF::getDB()->prepareStatement($sql); foreach ($existingSpiders as $spider) { if (!isset($statementParameters[$spider->spiderIdentifier])) { - $statement->execute(array($spider->spiderIdentifier)); + $statement->execute([$spider->spiderIdentifier]); } } diff --git a/wcfsetup/install/files/lib/system/cronjob/StatDailyBuilderCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/StatDailyBuilderCronjob.class.php index 823d80d33a..cebdd39e98 100644 --- a/wcfsetup/install/files/lib/system/cronjob/StatDailyBuilderCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/StatDailyBuilderCronjob.class.php @@ -39,7 +39,7 @@ class StatDailyBuilderCronjob extends AbstractCronjob { foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.statDailyHandler') as $objectType) { $data = $objectType->getProcessor()->getData($date); - $statement->execute(array($objectType->objectTypeID, $d->format('Y-m-d'), $data['counter'], $data['total'])); + $statement->execute([$objectType->objectTypeID, $d->format('Y-m-d'), $data['counter'], $data['total']]); } } } diff --git a/wcfsetup/install/files/lib/system/cronjob/UserBanCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/UserBanCronjob.class.php index bcebe8b2c1..ae6763fe67 100644 --- a/wcfsetup/install/files/lib/system/cronjob/UserBanCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/UserBanCronjob.class.php @@ -28,13 +28,13 @@ class UserBanCronjob extends AbstractCronjob { AND banExpires <> ? AND banExpires <= ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 0, 0, 1, 0, TIME_NOW - )); + ]); // enable avatars $sql = "UPDATE wcf".WCF_N."_user @@ -44,13 +44,13 @@ class UserBanCronjob extends AbstractCronjob { AND disableAvatarExpires <> ? AND disableAvatarExpires <= ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 0, 0, 1, 0, TIME_NOW - )); + ]); // enable signatures $sql = "UPDATE wcf".WCF_N."_user @@ -60,12 +60,12 @@ class UserBanCronjob extends AbstractCronjob { AND disableSignatureExpires <> ? AND disableSignatureExpires <= ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 0, 0, 1, 0, TIME_NOW - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/cronjob/UserGroupAssignmentCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/UserGroupAssignmentCronjob.class.php index 89b8995900..3125e0b3af 100644 --- a/wcfsetup/install/files/lib/system/cronjob/UserGroupAssignmentCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/UserGroupAssignmentCronjob.class.php @@ -23,21 +23,21 @@ class UserGroupAssignmentCronjob extends AbstractCronjob { parent::execute($cronjob); $assignments = UserGroupAssignmentCacheBuilder::getInstance()->getData(); - $usersToGroup = array(); + $usersToGroup = []; foreach ($assignments as $assignment) { if (!isset($usersToGroup[$assignment->groupID])) { - $usersToGroup[$assignment->groupID] = array(); + $usersToGroup[$assignment->groupID] = []; } $usersToGroup[$assignment->groupID] = array_merge($usersToGroup[$assignment->groupID], UserGroupAssignmentHandler::getInstance()->getUsers($assignment)); } foreach ($usersToGroup as $groupID => $users) { - $userAction = new UserAction(array_unique($users), 'addToGroups', array( + $userAction = new UserAction(array_unique($users), 'addToGroups', [ 'addDefaultGroups' => false, 'deleteOldGroups' => false, - 'groups' => array($groupID) - )); + 'groups' => [$groupID] + ]); $userAction->executeAction(); } } diff --git a/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php index 829fad90e1..e7ef066d02 100644 --- a/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/UserQuitCronjob.class.php @@ -26,10 +26,10 @@ class UserQuitCronjob extends AbstractCronjob { WHERE quitStarted > ? AND quitStarted < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 0, (TIME_NOW - 7 * 24 * 3600) - )); + ]); $userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($userIDs)) { diff --git a/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php b/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php index ea28c2b85a..f2ce048b89 100644 --- a/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php +++ b/wcfsetup/install/files/lib/system/database/MySQLDatabase.class.php @@ -25,13 +25,13 @@ class MySQLDatabase extends Database { if (!$this->port) $this->port = 3306; // mysql default port try { - $driverOptions = array( + $driverOptions = [ \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'" - ); + ]; if (!$this->failsafeTest) { - $driverOptions = array( + $driverOptions = [ \PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8', SESSION sql_mode = 'ANSI,ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES'" - ); + ]; } // disable prepared statement emulation since MySQL 5.1.17 is the minimum required version diff --git a/wcfsetup/install/files/lib/system/database/PostgreSQLDatabase.class.php b/wcfsetup/install/files/lib/system/database/PostgreSQLDatabase.class.php index 6351cce293..e5b12901fd 100644 --- a/wcfsetup/install/files/lib/system/database/PostgreSQLDatabase.class.php +++ b/wcfsetup/install/files/lib/system/database/PostgreSQLDatabase.class.php @@ -86,8 +86,8 @@ class PostgreSQLDatabase extends Database { */ public static function fixQuery($query) { // replace quotes - $query = preg_replace_callback('~\'([^\'\\\\]+|\\\\.)*\'~', array('self', 'replaceQuotesCallback'), $query); - $query = preg_replace_callback('~"([^"\\\\]+|\\\\.)*"~', array('self', 'replaceQuotesCallback'), $query); + $query = preg_replace_callback('~\'([^\'\\\\]+|\\\\.)*\'~', ['self', 'replaceQuotesCallback'], $query); + $query = preg_replace_callback('~"([^"\\\\]+|\\\\.)*"~', ['self', 'replaceQuotesCallback'], $query); // double quote identifiers (column & table names ...) $query = preg_replace('~(?<=^|\s|\.|\(|,)([A-Za-z0-9_-]*[a-z]{1}[A-Za-z0-9_-]*)(?=$|\s|\.|\)|,|=)~', '"\\1"', $query); diff --git a/wcfsetup/install/files/lib/system/database/editor/DatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/DatabaseEditor.class.php index 9e44eda6cb..d8bd356f7b 100644 --- a/wcfsetup/install/files/lib/system/database/editor/DatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/DatabaseEditor.class.php @@ -58,7 +58,7 @@ abstract class DatabaseEditor { * @param array $columns * @param array $indices */ - abstract public function createTable($tableName, $columns, $indices = array()); + abstract public function createTable($tableName, $columns, $indices = []); /** * Drops a database table. diff --git a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php index 99953b4a1a..1414281e07 100644 --- a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php @@ -17,7 +17,7 @@ class MySQLDatabaseEditor extends DatabaseEditor { * @see \wcf\system\database\editor\DatabaseEditor::getTableNames() */ public function getTableNames() { - $existingTables = array(); + $existingTables = []; $sql = "SHOW TABLES FROM `".$this->dbObj->getDatabaseName()."`"; $statement = $this->dbObj->prepareStatement($sql); $statement->execute(); @@ -31,7 +31,7 @@ class MySQLDatabaseEditor extends DatabaseEditor { * @see \wcf\system\database\editor\DatabaseEditor::getColumns() */ public function getColumns($tableName) { - $columns = array(); + $columns = []; $regex = new Regex('([a-z]+)\(([0-9]+)\)', Regex::CASE_INSENSITIVE); $sql = "SHOW COLUMNS FROM `".$tableName."`"; @@ -41,14 +41,14 @@ class MySQLDatabaseEditor extends DatabaseEditor { $regex->match($row['Type']); $typeMatches = $regex->getMatches(); - $columns[] = array('name' => $row['Field'], 'data' => array( + $columns[] = ['name' => $row['Field'], 'data' => [ 'type' => ((empty($typeMatches)) ? $row['Type'] : $typeMatches[1]), 'length' => ((empty($typeMatches)) ? '' : $typeMatches[2]), 'notNull' => (($row['Null'] == 'YES') ? false : true), 'key' => (($row['Key'] == 'PRI') ? 'PRIMARY' : (($row['Key'] == 'UNI') ? 'UNIQUE' : '')), 'default' => $row['Default'], 'autoIncrement' => ($row['Extra'] == 'auto_increment' ? true : false) - )); + ]]; } return $columns; @@ -58,7 +58,7 @@ class MySQLDatabaseEditor extends DatabaseEditor { * @see \wcf\system\database\editor\DatabaseEditor::getIndices() */ public function getIndices($tableName) { - $indices = array(); + $indices = []; $sql = "SHOW INDEX FROM `".$tableName."`"; $statement = $this->dbObj->prepareStatement($sql); $statement->execute(); @@ -72,7 +72,7 @@ class MySQLDatabaseEditor extends DatabaseEditor { /** * @see \wcf\system\database\editor\DatabaseEditor::createTable() */ - public function createTable($tableName, $columns, $indices = array()) { + public function createTable($tableName, $columns, $indices = []) { $columnDefinition = $indexDefinition = ''; // build column definition diff --git a/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php index 16e6124f79..cf18fa888b 100644 --- a/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php @@ -18,7 +18,7 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { * @see \wcf\system\database\editor\DatabaseEditor::getTableNames() */ public function getTableNames() { - $existingTables = array(); + $existingTables = []; $sql = "SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'public' @@ -35,7 +35,7 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { * @see \wcf\system\database\editor\DatabaseEditor::getColumns() */ public function getColumns($tableName) { - $columns = array(); + $columns = []; $sql = "SELECT pg_attribute.*, pg_type.typname, pg_constraint.contype, pg_attribute.adsrc FROM pg_attribute, pg_class, @@ -47,16 +47,16 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { AND pg_attribute.attnum > 0 AND pg_class.relname = ?"; $statement = $this->dbObj->prepareStatement($sql); - $statement->execute(array($tableName)); + $statement->execute([$tableName]); while ($row = $statement->fetchArray()) { - $columns[] = array('name' => $row['attname'], 'data' => array( + $columns[] = ['name' => $row['attname'], 'data' => [ 'type' => $row['typname'], 'length' => $row['attlen'], 'notNull' => $row['attnotnull'], 'key' => (($row['contype'] == 'p') ? 'PRIMARY' : (($row['contype'] == 'u') ? 'UNIQUE' : '')), 'default' => $row['adsrc'], 'autoIncrement' => ($row['contype'] == 'p') - )); + ]]; } return $columns; @@ -66,12 +66,12 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { * @see \wcf\system\database\editor\DatabaseEditor::getIndices() */ public function getIndices($tableName) { - $indices = array(); + $indices = []; $sql = "SELECT indexname FROM pg_indexes WHERE tablename = ?"; $statement = $this->dbObj->prepareStatement($sql); - $statement->execute(array($tableName)); + $statement->execute([$tableName]); while ($row = $statement->fetchArray()) { $indices[] = $row['indexname']; } @@ -117,7 +117,7 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { /** * @see \wcf\system\database\editor\DatabaseEditor::createTable() */ - public function createTable($tableName, $columns, $indices = array()) { + public function createTable($tableName, $columns, $indices = []) { $columnDefinition = $indexDefinition = ''; // build column definition diff --git a/wcfsetup/install/files/lib/system/database/util/ConditionBuilder.class.php b/wcfsetup/install/files/lib/system/database/util/ConditionBuilder.class.php index e4531f4cce..afd91683f0 100644 --- a/wcfsetup/install/files/lib/system/database/util/ConditionBuilder.class.php +++ b/wcfsetup/install/files/lib/system/database/util/ConditionBuilder.class.php @@ -47,7 +47,7 @@ class ConditionBuilder { * @param mixed $conditions */ public function add($conditions) { - if (!is_array($conditions)) $conditions = array($conditions); + if (!is_array($conditions)) $conditions = [$conditions]; foreach ($conditions as $condition) { if (!empty($this->conditions)) $this->conditions .= $this->concat; diff --git a/wcfsetup/install/files/lib/system/database/util/PreparedStatementConditionBuilder.class.php b/wcfsetup/install/files/lib/system/database/util/PreparedStatementConditionBuilder.class.php index 8caabe4820..09242d88ad 100644 --- a/wcfsetup/install/files/lib/system/database/util/PreparedStatementConditionBuilder.class.php +++ b/wcfsetup/install/files/lib/system/database/util/PreparedStatementConditionBuilder.class.php @@ -17,7 +17,7 @@ class PreparedStatementConditionBuilder extends ConditionBuilder { * input parameters * @var array */ - protected $parameters = array(); + protected $parameters = []; /** * Adds a new condition. The parameters array has to be a numbered array. @@ -25,7 +25,7 @@ class PreparedStatementConditionBuilder extends ConditionBuilder { * @param string $condition * @param array $parameters */ - public function add($condition, array $parameters = array()) { + public function add($condition, array $parameters = []) { if (!empty($parameters)) { $count = 0; $callback = function ($matches) use (&$count, $parameters, $condition) { diff --git a/wcfsetup/install/files/lib/system/database/util/SQLParser.class.php b/wcfsetup/install/files/lib/system/database/util/SQLParser.class.php index e2debfe752..c534ba4c27 100644 --- a/wcfsetup/install/files/lib/system/database/util/SQLParser.class.php +++ b/wcfsetup/install/files/lib/system/database/util/SQLParser.class.php @@ -21,7 +21,7 @@ class SQLParser { * list of sql queries * @var string[] */ - protected $queryArray = array(); + protected $queryArray = []; /** * Creates a new SQLParser object. @@ -64,7 +64,7 @@ class SQLParser { // get table name if (preg_match('~^CREATE\s+TABLE\s+(\w+)\s*\(~i', $query, $match)) { $tableName = $match[1]; - $columns = $indices = array(); + $columns = $indices = []; // find columns if (preg_match_all("~(?:\(|,)\s*(\w+)\s+(\w+)(?:\s*\((\s*(?:\d+(?:\s*,\s*\d+)?|'[^']*'(?:\s*,\s*'[^']*')*))\s*\))?(?:\s+UNSIGNED)?(?:\s+(NOT NULL|NULL))?(?:\s+DEFAULT\s+(\d+.\d+|\d+|NULL|'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'))?(?:\s+(AUTO_INCREMENT))?(?:\s+(UNIQUE|PRIMARY)(?: KEY)?)?~i", $query, $matches)) { @@ -72,15 +72,15 @@ class SQLParser { $columName = strtoupper($matches[1][$i]); if ($columName == 'UNIQUE' || $columName == 'KEY' || $columName == 'PRIMARY' || $columName == 'FULLTEXT') continue; - $column = array('name' => $matches[1][$i]); + $column = ['name' => $matches[1][$i]]; $columnType = strtolower($matches[2][$i]); - $column['data'] = array( + $column['data'] = [ 'type' => $columnType, 'notNull' => ((!empty($matches[4][$i]) && strtoupper($matches[4][$i]) == 'NOT NULL') ? true : false), 'default' => $matches[5][$i], 'autoIncrement' => (!empty($matches[6][$i]) ? true : false), 'key' => strtoupper($matches[7][$i]) - ); + ]; if (!empty($matches[3][$i])) { if ($columnType == 'enum') $column['data']['values'] = $matches[3][$i]; else { @@ -104,7 +104,7 @@ class SQLParser { // find indices if (preg_match_all('~(?:\(|,)\s*(?:(?:(?:(UNIQUE|FULLTEXT)(?:\s+(?:INDEX|KEY))?|(?:INDEX|KEY))(?:\s+(\w+))?)|(PRIMARY) KEY)\s+\((\s*\w+\s*(?:,\s*\w+\s*)*)\)~is', $query, $matches)) { for ($i = 0, $j = count($matches[0]); $i < $j; $i++) { - $index = array('name' => $matches[2][$i], 'data' => array()); + $index = ['name' => $matches[2][$i], 'data' => []]; $index['data']['type'] = strtoupper((!empty($matches[1][$i]) ? $matches[1][$i] : $matches[3][$i])); $index['data']['columns'] = $matches[4][$i]; $indices[] = $index; @@ -118,28 +118,28 @@ class SQLParser { case 'ALTER TABLE': // add index if (preg_match('~^ALTER\s+TABLE\s+(\w+)\s+ADD\s+(?:(UNIQUE|FULLTEXT)\s+)?(?:INDEX|KEY)\s+(?:(\w+)\s*)?\((\s*\w+\s*(?:,\s*\w+\s*)*)\)~is', $query, $match)) { - $this->executeAddIndexStatement($match[1], ($match[3] ?: self::getGenericIndexName($match[1], $match[4])), array('type' => strtoupper($match[2]), 'columns' => $match[4])); + $this->executeAddIndexStatement($match[1], ($match[3] ?: self::getGenericIndexName($match[1], $match[4])), ['type' => strtoupper($match[2]), 'columns' => $match[4]]); } // add foreign key else if (preg_match('~^ALTER\s+TABLE\s+(\w+)\s+ADD\s+FOREIGN KEY\s+(?:(\w+)\s*)?\((\s*\w+\s*(?:,\s*\w+\s*)*)\)\s+REFERENCES\s+(\w+)\s+\((\s*\w+\s*(?:,\s*\w+\s*)*)\)(?:\s+ON\s+DELETE\s+(CASCADE|SET NULL|NO ACTION))?(?:\s+ON\s+UPDATE\s+(CASCADE|SET NULL|NO ACTION))?~is', $query, $match)) { - $this->executeAddForeignKeyStatement($match[1], ($match[2] ?: self::getGenericIndexName($match[1], $match[3], 'fk')), array( + $this->executeAddForeignKeyStatement($match[1], ($match[2] ?: self::getGenericIndexName($match[1], $match[3], 'fk')), [ 'columns' => $match[3], 'referencedTable' => $match[4], 'referencedColumns' => $match[5], 'ON DELETE' => isset($match[6]) ? $match[6] : '', 'ON UPDATE' => isset($match[7]) ? $match[7] : '' - )); + ]); } // add/change column else if (preg_match("~^ALTER\s+TABLE\s+(\w+)\s+(?:(ADD)\s+(?:COLUMN\s+)?|(CHANGE)\s+(?:COLUMN\s+)?(\w+)\s+)(\w+)\s+(\w+)(?:\s*\((\s*(?:\d+(?:\s*,\s*\d+)?|'[^']*'(?:\s*,\s*'[^']*')*))\s*\))?(?:\s+UNSIGNED)?(?:\s+(NOT NULL|NULL))?(?:\s+DEFAULT\s+(-?\d+.\d+|-?\d+|NULL|'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'))?(?:\s+(AUTO_INCREMENT))?(?:\s+(UNIQUE|PRIMARY)(?: KEY)?)?~is", $query, $match)) { $columnType = strtolower($match[6]); - $columnData = array( + $columnData = [ 'type' => $columnType, 'notNull' => ((!empty($match[8]) && strtoupper($match[8]) == 'NOT NULL') ? true : false), 'default' => (isset($match[9]) ? $match[9] : ''), 'autoIncrement' => (!empty($match[10]) ? true : false), 'key' => (!empty($match[11]) ? strtoupper($match[11]) : '') - ); + ]; if (!empty($match[7])) { if ($columnType == 'enum') $columnData['values'] = $match[7]; else { @@ -179,7 +179,7 @@ class SQLParser { case 'CREATE INDEX': if (preg_match('~^CREATE\s+(?:(UNIQUE|FULLTEXT)\s+)?INDEX\s+(\w+)\s+ON\s+(\w+)\s+\((\s*\w+\s*(?:,\s*\w+\s*)*)\)~is', $query, $match)) { - $this->executeAddIndexStatement($match[3], ($match[2] ?: self::getGenericIndexName($match[3], $match[4])), array('type' => strtoupper($match[1]), 'columns' => $match[4])); + $this->executeAddIndexStatement($match[3], ($match[2] ?: self::getGenericIndexName($match[3], $match[4])), ['type' => strtoupper($match[1]), 'columns' => $match[4]]); } else { throw new SystemException("Unsupported SQL statement '".$query."'"); @@ -220,7 +220,7 @@ class SQLParser { * @param array $columns * @param array $indices */ - protected function executeCreateTableStatement($tableName, $columns, $indices = array()) { + protected function executeCreateTableStatement($tableName, $columns, $indices = []) { WCF::getDB()->getEditor()->createTable($tableName, $columns, $indices); } diff --git a/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php b/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php index 872c69f384..d23bc018a2 100644 --- a/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php +++ b/wcfsetup/install/files/lib/system/edit/EditHistoryManager.class.php @@ -21,7 +21,7 @@ class EditHistoryManager extends SingletonFactory { * list of available object types * @var array */ - protected $availableObjectTypes = array(); + protected $availableObjectTypes = []; /** * @see \wcf\system\SingletonFactory::init() @@ -67,7 +67,7 @@ class EditHistoryManager extends SingletonFactory { (objectTypeID, objectID, message, time, obsoletedAt, userID, username, editReason, obsoletedByUserID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), $objectID, $message, $time, TIME_NOW, $userID, $username, $editReason, $obsoletedByUserID)); + $statement->execute([$this->getObjectTypeID($objectType), $objectID, $message, $time, TIME_NOW, $userID, $username, $editReason, $obsoletedByUserID]); } /** @@ -85,7 +85,7 @@ class EditHistoryManager extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { - $statement->execute(array($objectTypeID, $objectID)); + $statement->execute([$objectTypeID, $objectID]); } WCF::getDB()->commitTransaction(); } @@ -127,9 +127,9 @@ class EditHistoryManager extends SingletonFactory { GROUP BY revertTo.objectTypeID, revertTo.objectID"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge( - array(TIME_NOW - $timeframe), + [TIME_NOW - $timeframe], $userIDs, - array(TIME_NOW - $timeframe), + [TIME_NOW - $timeframe], $userIDs )); @@ -137,7 +137,7 @@ class EditHistoryManager extends SingletonFactory { if (empty($entryIDs)) return; $list = new EditHistoryEntryList(); - $list->getConditionBuilder()->add('entryID IN(?)', array($entryIDs)); + $list->getConditionBuilder()->add('entryID IN(?)', [$entryIDs]); $list->readObjects(); foreach ($list as $entry) { $entry->getObject()->revertVersion($entry); diff --git a/wcfsetup/install/files/lib/system/event/EventHandler.class.php b/wcfsetup/install/files/lib/system/event/EventHandler.class.php index cf24bce1b5..d1cf312e18 100644 --- a/wcfsetup/install/files/lib/system/event/EventHandler.class.php +++ b/wcfsetup/install/files/lib/system/event/EventHandler.class.php @@ -160,7 +160,7 @@ class EventHandler extends SingletonFactory { * @param array &$parameters * @throws SystemException */ - public function fireAction($eventObj, $eventName, array &$parameters = array()) { + public function fireAction($eventObj, $eventName, array &$parameters = []) { // get class name if (is_object($eventObj)) $className = get_class($eventObj); else $className = $eventObj; diff --git a/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php b/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php index 36713763d4..57e240feac 100644 --- a/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php @@ -28,22 +28,22 @@ class SessionAccessLogListener implements IParameterizedEventListener { WHERE sessionID = ? AND lastActivityTime >= ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ WCF::getSession()->sessionID, (TIME_NOW - SESSION_TIMEOUT) - )); + ]); $row = $statement->fetchArray(); if (!empty($row['sessionLogID'])) { $sessionLogID = $row['sessionLogID']; - $sessionLogEditor = new ACPSessionLogEditor(new ACPSessionLog(null, array('sessionLogID' => $sessionLogID))); - $sessionLogEditor->update(array( + $sessionLogEditor = new ACPSessionLogEditor(new ACPSessionLog(null, ['sessionLogID' => $sessionLogID])); + $sessionLogEditor->update([ 'lastActivityTime' => TIME_NOW - )); + ]); } else { // create new session log - $sessionLog = ACPSessionLogEditor::create(array( + $sessionLog = ACPSessionLogEditor::create([ 'sessionID' => WCF::getSession()->sessionID, 'userID' => WCF::getUser()->userID, 'ipAddress' => UserUtil::getIpAddress(), @@ -51,7 +51,7 @@ class SessionAccessLogListener implements IParameterizedEventListener { 'userAgent' => WCF::getSession()->userAgent, 'time' => TIME_NOW, 'lastActivityTime' => TIME_NOW - )); + ]); $sessionLogID = $sessionLog->sessionLogID; } @@ -64,14 +64,14 @@ class SessionAccessLogListener implements IParameterizedEventListener { $requestURI = preg_replace('/(?:\?|&)s=[a-f0-9]{40}/', '', $requestURI); // save access - ACPSessionAccessLogEditor::create(array( + ACPSessionAccessLogEditor::create([ 'sessionLogID' => $sessionLogID, 'ipAddress' => UserUtil::getIpAddress(), 'time' => TIME_NOW, 'requestURI' => $requestURI, 'requestMethod' => WCF::getSession()->requestMethod, 'className' => get_class($eventObj) - )); + ]); } } } diff --git a/wcfsetup/install/files/lib/system/exception/AJAXException.class.php b/wcfsetup/install/files/lib/system/exception/AJAXException.class.php index 88f5b9c690..fe3fbcf792 100644 --- a/wcfsetup/install/files/lib/system/exception/AJAXException.class.php +++ b/wcfsetup/install/files/lib/system/exception/AJAXException.class.php @@ -59,14 +59,14 @@ class AJAXException extends LoggedException { * @param mixed[] $returnValues * @param string $exceptionID */ - public function __construct($message, $errorType = self::INTERNAL_ERROR, $stacktrace = null, $returnValues = array(), $exceptionID = '') { + public function __construct($message, $errorType = self::INTERNAL_ERROR, $stacktrace = null, $returnValues = [], $exceptionID = '') { if ($stacktrace === null) $stacktrace = $this->getTraceAsString(); - $responseData = array( + $responseData = [ 'code' => $errorType, 'message' => $message, 'returnValues' => $returnValues - ); + ]; // include a stacktrace if: // - debug mode is enabled diff --git a/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php b/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php index 0ae316833e..da3f3f4b14 100644 --- a/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php +++ b/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php @@ -17,7 +17,7 @@ class NamedUserException extends UserException { * Shows a styled page with the given error message. */ public function show() { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'name' => get_class($this), 'file' => $this->getFile(), 'line' => $this->getLine(), @@ -25,7 +25,7 @@ class NamedUserException extends UserException { 'stacktrace' => $this->getTraceAsString(), 'templateName' => 'userException', 'templateNameApplication' => 'wcf' - )); + ]); WCF::getTPL()->display('userException'); } } diff --git a/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php b/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php index 012984c36f..be61596f2d 100644 --- a/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php +++ b/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php @@ -27,14 +27,14 @@ class PermissionDeniedException extends UserException { public function show() { @header('HTTP/1.0 403 Forbidden'); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'name' => get_class($this), 'file' => $this->getFile(), 'line' => $this->getLine(), 'stacktrace' => $this->getTraceAsString(), 'templateName' => 'permissionDenied', 'templateNameApplication' => 'wcf' - )); + ]); WCF::getTPL()->display('permissionDenied'); } } diff --git a/wcfsetup/install/files/lib/system/exception/UserInputException.class.php b/wcfsetup/install/files/lib/system/exception/UserInputException.class.php index 72216eef25..ba1145575b 100644 --- a/wcfsetup/install/files/lib/system/exception/UserInputException.class.php +++ b/wcfsetup/install/files/lib/system/exception/UserInputException.class.php @@ -28,7 +28,7 @@ class UserInputException extends UserException { * variables for AJAX error handling * @var array */ - protected $variables = array(); + protected $variables = []; /** * Creates a new UserInputException. @@ -37,7 +37,7 @@ class UserInputException extends UserException { * @param string $type kind of this error * @param array $variables additional variables for AJAX error handling */ - public function __construct($field = '', $type = 'empty', array $variables = array()) { + public function __construct($field = '', $type = 'empty', array $variables = []) { $this->field = $field; $this->type = $type; $this->variables = $variables; diff --git a/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php b/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php index 9e58f4b2fe..053ea0bf20 100644 --- a/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php +++ b/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php @@ -28,7 +28,7 @@ class ValidateActionException extends \Exception { /** * @see \Exception::__construct() */ - public function __construct($fieldName, $errorMessage = 'empty', array $variables = array()) { + public function __construct($fieldName, $errorMessage = 'empty', array $variables = []) { $this->errorMessage = $errorMessage; if (mb_strpos($this->errorMessage, '.') === false) { $this->errorMessage = WCF::getLanguage()->get('wcf.global.form.error.'.$this->errorMessage); @@ -38,7 +38,7 @@ class ValidateActionException extends \Exception { } $this->fieldName = $fieldName; - $this->message = WCF::getLanguage()->getDynamicVariable('wcf.ajax.error.invalidParameter', array('fieldName' => $this->fieldName)); + $this->message = WCF::getLanguage()->getDynamicVariable('wcf.ajax.error.invalidParameter', ['fieldName' => $this->fieldName]); } /** diff --git a/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php b/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php index 7093d15c4a..71d2983a8c 100644 --- a/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php +++ b/wcfsetup/install/files/lib/system/exporter/AbstractExporter.class.php @@ -19,7 +19,7 @@ abstract class AbstractExporter implements IExporter { * additional data * @var array */ - public $additionalData = array(); + public $additionalData = []; /** * database host name @@ -67,13 +67,13 @@ abstract class AbstractExporter implements IExporter { * object type => method names * @var array */ - protected $methods = array(); + protected $methods = []; /** * limits for items per run * @var integer[] */ - protected $limits = array(); + protected $limits = []; /** * default limit for items per run @@ -85,7 +85,7 @@ abstract class AbstractExporter implements IExporter { * selected import data * @var array */ - protected $selectedData = array(); + protected $selectedData = []; /** * @see \wcf\system\exporter\IExporter::setData() @@ -137,7 +137,7 @@ abstract class AbstractExporter implements IExporter { throw new SystemException("unknown object type '".$objectType."' given"); } - $count = call_user_func(array($this, 'count'.$this->methods[$objectType])); + $count = call_user_func([$this, 'count'.$this->methods[$objectType]]); $limit = (isset($this->limits[$objectType]) ? $this->limits[$objectType] : $this->defaultLimit); return ceil($count / $limit); } @@ -151,7 +151,7 @@ abstract class AbstractExporter implements IExporter { } $limit = (isset($this->limits[$objectType]) ? $this->limits[$objectType] : $this->defaultLimit); - call_user_func(array($this, 'export'.$this->methods[$objectType]), $loopCount * $limit, $limit); + call_user_func([$this, 'export'.$this->methods[$objectType]], $loopCount * $limit, $limit); } /** diff --git a/wcfsetup/install/files/lib/system/form/FormDocument.class.php b/wcfsetup/install/files/lib/system/form/FormDocument.class.php index 4320d1ee53..dd5d3b431e 100644 --- a/wcfsetup/install/files/lib/system/form/FormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/FormDocument.class.php @@ -17,7 +17,7 @@ class FormDocument { * list of FormElementContainer objects * @var IFormElementContainer[] */ - protected $containers = array(); + protected $containers = []; /** * form document name @@ -106,7 +106,7 @@ class FormDocument { * Handles request input variables. */ public function handleRequest() { - $variables = array(); + $variables = []; foreach ($_REQUEST as $key => $value) { if (mb_strpos($key, $this->getName().'_') !== false) { diff --git a/wcfsetup/install/files/lib/system/form/container/AbstractFormElementContainer.class.php b/wcfsetup/install/files/lib/system/form/container/AbstractFormElementContainer.class.php index 00faca3023..2153b0f63e 100644 --- a/wcfsetup/install/files/lib/system/form/container/AbstractFormElementContainer.class.php +++ b/wcfsetup/install/files/lib/system/form/container/AbstractFormElementContainer.class.php @@ -20,7 +20,7 @@ abstract class AbstractFormElementContainer implements IFormElementContainer { * list of IFormElement objects * @var IFormElement[] */ - protected $children = array(); + protected $children = []; /** * element description or help text diff --git a/wcfsetup/install/files/lib/system/form/container/MultipleSelectionFormElementContainer.class.php b/wcfsetup/install/files/lib/system/form/container/MultipleSelectionFormElementContainer.class.php index a235691729..5e9b07ba87 100644 --- a/wcfsetup/install/files/lib/system/form/container/MultipleSelectionFormElementContainer.class.php +++ b/wcfsetup/install/files/lib/system/form/container/MultipleSelectionFormElementContainer.class.php @@ -16,7 +16,7 @@ class MultipleSelectionFormElementContainer extends SelectionFormElementContaine * container value * @var array */ - protected $value = array(); + protected $value = []; /** * Sets container value. diff --git a/wcfsetup/install/files/lib/system/form/element/MultipleSelectionFormElement.class.php b/wcfsetup/install/files/lib/system/form/element/MultipleSelectionFormElement.class.php index 84c0a139c7..d22339eff3 100644 --- a/wcfsetup/install/files/lib/system/form/element/MultipleSelectionFormElement.class.php +++ b/wcfsetup/install/files/lib/system/form/element/MultipleSelectionFormElement.class.php @@ -26,7 +26,7 @@ class MultipleSelectionFormElement extends AbstractNamedFormElement { parent::setValue($value); } else { - $this->value = array_map(array('wcf\util\StringUtil', 'trim'), $value); + $this->value = array_map(['wcf\util\StringUtil', 'trim'], $value); } } diff --git a/wcfsetup/install/files/lib/system/image/ImageHandler.class.php b/wcfsetup/install/files/lib/system/image/ImageHandler.class.php index a9758fb2e1..8d9aadb1c6 100644 --- a/wcfsetup/install/files/lib/system/image/ImageHandler.class.php +++ b/wcfsetup/install/files/lib/system/image/ImageHandler.class.php @@ -19,10 +19,10 @@ class ImageHandler extends SingletonFactory { * list of valid image adapters. * @var string[] */ - protected $imageAdapters = array( + protected $imageAdapters = [ 'gd' => 'wcf\system\image\adapter\GDImageAdapter', 'imagick' => 'wcf\system\image\adapter\ImagickImageAdapter' - ); + ]; /** * image adapter class name @@ -39,7 +39,7 @@ class ImageHandler extends SingletonFactory { } $imageAdapter = $this->imageAdapters[IMAGE_ADAPTER_TYPE]; - $isSupported = call_user_func(array($imageAdapter, 'isSupported')); + $isSupported = call_user_func([$imageAdapter, 'isSupported']); // fallback to GD if image adapter is not available if (!$isSupported) { diff --git a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php index 0dd5006adf..06a224efe2 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php @@ -24,7 +24,7 @@ class GDImageAdapter implements IImageAdapter { * red, green, blue data of the active color * @var array */ - protected $colorData = array(); + protected $colorData = []; /** * image height @@ -280,11 +280,11 @@ class GDImageAdapter implements IImageAdapter { $this->color = imagecolorallocate($this->image, $red, $green, $blue); // save data of the color - $this->colorData = array( + $this->colorData = [ 'red' => $red, 'green' => $green, 'blue' => $blue - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php index 59a7ab5d02..95c420f533 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/ImageAdapter.class.php @@ -23,7 +23,7 @@ class ImageAdapter implements IImageAdapter { * supported relative positions * @var string[] */ - protected $relativePositions = array( + protected $relativePositions = [ 'topLeft', 'topCenter', 'topRight', @@ -33,7 +33,7 @@ class ImageAdapter implements IImageAdapter { 'bottomLeft', 'bottomCenter', 'bottomRight' - ); + ]; /** * Creates a new ImageAdapter instance. diff --git a/wcfsetup/install/files/lib/system/importer/AbstractACLImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractACLImporter.class.php index 5c81f854eb..3b1421303e 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractACLImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractACLImporter.class.php @@ -29,7 +29,7 @@ class AbstractACLImporter extends AbstractImporter { * available options * @var array */ - protected $options = array(); + protected $options = []; /** * Creates an AbstractACLImporter object. @@ -40,7 +40,7 @@ class AbstractACLImporter extends AbstractImporter { FROM wcf".WCF_N."_acl_option WHERE objectTypeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->objectTypeID)); + $statement->execute([$this->objectTypeID]); while ($row = $statement->fetchArray()) { $this->options[$row['optionName']] = $row['optionID']; } @@ -49,7 +49,7 @@ class AbstractACLImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { if (!isset($this->options[$additionalData['optionName']])) return 0; $data['optionID'] = $this->options[$additionalData['optionName']]; @@ -64,7 +64,7 @@ class AbstractACLImporter extends AbstractImporter { (optionID, objectID, groupID, optionValue) VALUES (?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($data['optionID'], $data['objectID'], $data['groupID'], $data['optionValue'])); + $statement->execute([$data['optionID'], $data['objectID'], $data['groupID'], $data['optionValue']]); return 1; } @@ -76,7 +76,7 @@ class AbstractACLImporter extends AbstractImporter { (optionID, objectID, userID, optionValue) VALUES (?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($data['optionID'], $data['objectID'], $data['userID'], $data['optionValue'])); + $statement->execute([$data['optionID'], $data['objectID'], $data['userID'], $data['optionValue']]); return 1; } diff --git a/wcfsetup/install/files/lib/system/importer/AbstractAttachmentImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractAttachmentImporter.class.php index 53735052db..d39fd65cae 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractAttachmentImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractAttachmentImporter.class.php @@ -29,7 +29,7 @@ class AbstractAttachmentImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { // check file location if (!@file_exists($additionalData['fileLocation'])) return 0; @@ -55,7 +55,7 @@ class AbstractAttachmentImporter extends AbstractImporter { } // save attachment - $attachment = AttachmentEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + $attachment = AttachmentEditor::create(array_merge($data, ['objectTypeID' => $this->objectTypeID])); // check attachment directory // and create subdirectory if necessary diff --git a/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php index 76ed8b997f..265854b4d2 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractCategoryImporter.class.php @@ -33,10 +33,10 @@ class AbstractCategoryImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { if (!empty($data['parentCategoryID'])) $data['parentCategoryID'] = ImportHandler::getInstance()->getNewID($this->objectTypeName, $data['parentCategoryID']); - $category = CategoryEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + $category = CategoryEditor::create(array_merge($data, ['objectTypeID' => $this->objectTypeID])); ImportHandler::getInstance()->saveNewID($this->objectTypeName, $oldID, $category->categoryID); diff --git a/wcfsetup/install/files/lib/system/importer/AbstractCommentImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractCommentImporter.class.php index 5df90e5a90..1aba5c62e0 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractCommentImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractCommentImporter.class.php @@ -33,10 +33,10 @@ class AbstractCommentImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); - $comment = CommentEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + $comment = CommentEditor::create(array_merge($data, ['objectTypeID' => $this->objectTypeID])); ImportHandler::getInstance()->saveNewID($this->objectTypeName, $oldID, $comment->commentID); diff --git a/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php index 87a704311c..0ed33eeb25 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractCommentResponseImporter.class.php @@ -28,7 +28,7 @@ class AbstractCommentResponseImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); $data['commentID'] = ImportHandler::getInstance()->getNewID($this->objectTypeName, $data['commentID']); @@ -41,7 +41,7 @@ class AbstractCommentResponseImporter extends AbstractImporter { WHERE commentID = ? ORDER BY time ASC, responseID ASC"; $statement = WCF::getDB()->prepareStatement($sql, 5); - $statement->execute(array($response->commentID)); + $statement->execute([$response->commentID]); $responseIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); // update parent comment @@ -50,10 +50,10 @@ class AbstractCommentResponseImporter extends AbstractImporter { responses = responses + 1 WHERE commentID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ serialize($responseIDs), $response->commentID - )); + ]); return $response->responseID; } diff --git a/wcfsetup/install/files/lib/system/importer/AbstractLikeImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractLikeImporter.class.php index 8bd3d13da9..30e355537c 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractLikeImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractLikeImporter.class.php @@ -27,7 +27,7 @@ class AbstractLikeImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { if ($data['objectUserID']) $data['objectUserID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['objectUserID']); $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); if (!$data['userID']) return 0; @@ -37,14 +37,14 @@ class AbstractLikeImporter extends AbstractImporter { (objectID, objectTypeID, objectUserID, userID, time, likeValue) VALUES (?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $data['objectID'], $this->objectTypeID, $data['objectUserID'], $data['userID'], $data['time'], $data['likeValue'] - )); + ]); return 0; } diff --git a/wcfsetup/install/files/lib/system/importer/AbstractPollImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractPollImporter.class.php index 26d7cdb292..625ce7028f 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractPollImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractPollImporter.class.php @@ -33,8 +33,8 @@ class AbstractPollImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { - $poll = PollEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + public function import($oldID, array $data, array $additionalData = []) { + $poll = PollEditor::create(array_merge($data, ['objectTypeID' => $this->objectTypeID])); ImportHandler::getInstance()->saveNewID($this->objectTypeName, $oldID, $poll->pollID); diff --git a/wcfsetup/install/files/lib/system/importer/AbstractPollOptionImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractPollOptionImporter.class.php index 48c6126a1d..71666c8427 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractPollOptionImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractPollOptionImporter.class.php @@ -33,7 +33,7 @@ class AbstractPollOptionImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['pollID'] = ImportHandler::getInstance()->getNewID($this->pollObjectTypeName, $data['pollID']); if (!$data['pollID']) return 0; diff --git a/wcfsetup/install/files/lib/system/importer/AbstractPollOptionVoteImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractPollOptionVoteImporter.class.php index b5cd8aae46..b43e5369bb 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractPollOptionVoteImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractPollOptionVoteImporter.class.php @@ -28,7 +28,7 @@ class AbstractPollOptionVoteImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); if (!$data['userID']) return 0; @@ -42,7 +42,7 @@ class AbstractPollOptionVoteImporter extends AbstractImporter { (pollID, optionID, userID) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($data['pollID'], $data['optionID'], $data['userID'])); + $statement->execute([$data['pollID'], $data['optionID'], $data['userID']]); return 1; } diff --git a/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php b/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php index da014ca5c2..723ee8d341 100644 --- a/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/AbstractWatchedObjectImporter.class.php @@ -28,12 +28,12 @@ class AbstractWatchedObjectImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); if (!$data['userID']) return 0; try { - $watch = UserObjectWatchEditor::create(array_merge($data, array('objectTypeID' => $this->objectTypeID))); + $watch = UserObjectWatchEditor::create(array_merge($data, ['objectTypeID' => $this->objectTypeID])); return $watch->watchID; } catch (DatabaseException $e) { diff --git a/wcfsetup/install/files/lib/system/importer/IImporter.class.php b/wcfsetup/install/files/lib/system/importer/IImporter.class.php index 077be93a74..1a4d851df3 100644 --- a/wcfsetup/install/files/lib/system/importer/IImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/IImporter.class.php @@ -20,7 +20,7 @@ interface IImporter { * @param array $additionalData * @return mixed new id */ - public function import($oldID, array $data, array $additionalData = array()); + public function import($oldID, array $data, array $additionalData = []); /** * Returns database object class name. diff --git a/wcfsetup/install/files/lib/system/importer/ImportHandler.class.php b/wcfsetup/install/files/lib/system/importer/ImportHandler.class.php index e7864512f7..9631aaac45 100644 --- a/wcfsetup/install/files/lib/system/importer/ImportHandler.class.php +++ b/wcfsetup/install/files/lib/system/importer/ImportHandler.class.php @@ -23,19 +23,19 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { * id map cache * @var array */ - protected $idMappingCache = array(); + protected $idMappingCache = []; /** * list of available importers * @var array */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * list of available importer processors * @var array */ - protected $importers = array(); + protected $importers = []; /** * user merge mode @@ -53,7 +53,7 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { * list of methods allowed for remote invoke * @var string[] */ - public static $allowInvoke = array('resetMapping'); + public static $allowInvoke = ['resetMapping']; /** * @see \wcf\system\SingletonFactory::init() @@ -97,8 +97,8 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { $importer = $this->getImporter($type); $tableName = $indexName = ''; if ($importer->getClassName()) { - $tableName = call_user_func(array($importer->getClassName(), 'getDatabaseTableName')); - $indexName = call_user_func(array($importer->getClassName(), 'getDatabaseTableIndexName')); + $tableName = call_user_func([$importer->getClassName(), 'getDatabaseTableName']); + $indexName = call_user_func([$importer->getClassName(), 'getDatabaseTableIndexName']); } $sql = "SELECT import_mapping.newID @@ -109,7 +109,7 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { AND import_mapping.oldID = ? ".($tableName ? "AND object_table.".$indexName." IS NOT NULL" : ''); $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->importHash, $objectTypeID, $oldID)); + $statement->execute([$this->importHash, $objectTypeID, $oldID]); $row = $statement->fetchArray(); if ($row !== false) $this->idMappingCache[$objectTypeID][$oldID] = $row['newID']; } @@ -131,7 +131,7 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { (importHash, objectTypeID, oldID, newID) VALUES (?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->importHash, $objectTypeID, $oldID, $newID)); + $statement->execute([$this->importHash, $objectTypeID, $oldID, $newID]); unset($this->idMappingCache[$objectTypeID][$oldID]); } @@ -140,7 +140,7 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { * Validates accessibility of resetMapping(). */ public function validateResetMapping() { - WCF::getSession()->checkPermissions(array('admin.management.canImportData')); + WCF::getSession()->checkPermissions(['admin.management.canImportData']); // reset caches CacheHandler::getInstance()->flushAll(); @@ -155,7 +155,7 @@ class ImportHandler extends SingletonFactory implements IAJAXInvokeAction { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); - $this->idMappingCache = array(); + $this->idMappingCache = []; } /** diff --git a/wcfsetup/install/files/lib/system/importer/LabelGroupImporter.class.php b/wcfsetup/install/files/lib/system/importer/LabelGroupImporter.class.php index e0d2bdd359..edc451905f 100644 --- a/wcfsetup/install/files/lib/system/importer/LabelGroupImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/LabelGroupImporter.class.php @@ -22,7 +22,7 @@ class LabelGroupImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { // save label group $labelGroup = LabelGroupEditor::create($data); @@ -35,7 +35,7 @@ class LabelGroupImporter extends AbstractImporter { foreach ($additionalData['objects'] as $objectTypeID => $objectIDs) { foreach ($objectIDs as $objectID) { - $statement->execute(array($labelGroup->groupID, $objectTypeID, $objectID)); + $statement->execute([$labelGroup->groupID, $objectTypeID, $objectID]); } } } diff --git a/wcfsetup/install/files/lib/system/importer/LabelImporter.class.php b/wcfsetup/install/files/lib/system/importer/LabelImporter.class.php index 25ee148993..2cdd1bbbcb 100644 --- a/wcfsetup/install/files/lib/system/importer/LabelImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/LabelImporter.class.php @@ -21,7 +21,7 @@ class LabelImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.label.group', $data['groupID']); if (!$data['groupID']) return 0; diff --git a/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php b/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php index 4587454b15..90ed222aab 100644 --- a/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php @@ -25,7 +25,7 @@ class SmileyImporter extends AbstractImporter { * * @var string[] */ - public $knownCodes = array(); + public $knownCodes = []; /** * Reads out known smiley codes. @@ -37,7 +37,7 @@ class SmileyImporter extends AbstractImporter { $statement->execute(); while ($row = $statement->fetchArray()) { - $known = array(); + $known = []; if (!empty($row['aliases'])) { $known = explode("\n", $row['aliases']); } @@ -52,7 +52,7 @@ class SmileyImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { // copy smiley $data['smileyPath'] = 'images/smilies/'.basename($additionalData['fileLocation']); if (!@copy($additionalData['fileLocation'], WCF_DIR.$data['smileyPath'])) return 0; @@ -64,7 +64,7 @@ class SmileyImporter extends AbstractImporter { if (!isset($data['aliases'])) $data['aliases'] = ''; // check aliases - $aliases = array(); + $aliases = []; if (!empty($data['aliases'])) { $aliases = explode("\n", StringUtil::unifyNewlines($data['aliases'])); foreach ($aliases as $key => $alias) { diff --git a/wcfsetup/install/files/lib/system/importer/UserAvatarImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserAvatarImporter.class.php index 02e25cdbca..c37be1f203 100644 --- a/wcfsetup/install/files/lib/system/importer/UserAvatarImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserAvatarImporter.class.php @@ -25,7 +25,7 @@ class UserAvatarImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { // check file location if (!@file_exists($additionalData['fileLocation'])) return 0; @@ -64,7 +64,7 @@ class UserAvatarImporter extends AbstractImporter { } // create thumbnails - $action = new UserAvatarAction(array($avatar), 'generateThumbnails'); + $action = new UserAvatarAction([$avatar], 'generateThumbnails'); $action->executeAction(); // update owner @@ -72,7 +72,7 @@ class UserAvatarImporter extends AbstractImporter { SET avatarID = ? WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($avatar->avatarID, $data['userID'])); + $statement->execute([$avatar->avatarID, $data['userID']]); return $avatar->avatarID; } diff --git a/wcfsetup/install/files/lib/system/importer/UserCommentImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserCommentImporter.class.php index f1911bcd91..0fe34f2778 100644 --- a/wcfsetup/install/files/lib/system/importer/UserCommentImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserCommentImporter.class.php @@ -29,7 +29,7 @@ class UserCommentImporter extends AbstractCommentImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['objectID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['objectID']); if (!$data['objectID']) return 0; diff --git a/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php index 2064c2b9ff..fed01edb69 100644 --- a/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserFollowerImporter.class.php @@ -21,7 +21,7 @@ class UserFollowerImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']); $data['followUserID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['followUserID']); if (!$data['userID'] || !$data['followUserID']) return 0; @@ -32,11 +32,11 @@ class UserFollowerImporter extends AbstractImporter { (userID, followUserID, time) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $data['userID'], $data['followUserID'], $data['time'] - )); + ]); return WCF::getDB()->getInsertID('wcf'.WCF_N.'_user_follow', 'followID'); } diff --git a/wcfsetup/install/files/lib/system/importer/UserGroupImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserGroupImporter.class.php index c49cd52585..ffebbc1399 100644 --- a/wcfsetup/install/files/lib/system/importer/UserGroupImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserGroupImporter.class.php @@ -22,14 +22,14 @@ class UserGroupImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { if ($data['groupType'] < 4) { $newGroupID = UserGroup::getGroupByType($data['groupType'])->groupID; } else { - $action = new UserGroupAction(array(), 'create', array( + $action = new UserGroupAction([], 'create', [ 'data' => $data - )); + ]); $returnValues = $action->executeAction(); $newGroupID = $returnValues['returnValues']->groupID; } diff --git a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php index 36cc858c9c..244c2aaae6 100644 --- a/wcfsetup/install/files/lib/system/importer/UserImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserImporter.class.php @@ -28,13 +28,13 @@ class UserImporter extends AbstractImporter { * ids of default notification events * @var integer[] */ - protected $eventIDs = array(); + protected $eventIDs = []; /** * list of user options * @var UserOption[] */ - protected $userOptions = array(); + protected $userOptions = []; const MERGE_MODE_EMAIL = 4; const MERGE_MODE_USERNAME_OR_EMAIL = 5; @@ -48,7 +48,7 @@ class UserImporter extends AbstractImporter { FROM wcf".WCF_N."_user_notification_event WHERE preset = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(1)); + $statement->execute([1]); $this->eventIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); $userOptionList = new UserOptionList(); @@ -59,7 +59,7 @@ class UserImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { // whether to perform a merge $performMerge = false; @@ -103,7 +103,7 @@ class UserImporter extends AbstractImporter { } // handle user options - $userOptions = array(); + $userOptions = []; if (isset($additionalData['options'])) { foreach ($additionalData['options'] as $optionName => $optionValue) { if (is_int($optionName)) $optionID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.option', $optionName); @@ -146,7 +146,7 @@ class UserImporter extends AbstractImporter { } } - $languageIDs = array(); + $languageIDs = []; if (isset($additionalData['languages'])) { foreach ($additionalData['languages'] as $languageCode) { $language = LanguageFactory::getInstance()->getLanguageByCode($languageCode); @@ -168,7 +168,7 @@ class UserImporter extends AbstractImporter { $userEditor->updateUserOptions($userOptions); // save user groups - $groupIDs = array(); + $groupIDs = []; if (isset($additionalData['groupIDs'])) { foreach ($additionalData['groupIDs'] as $oldGroupID) { $newGroupID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $oldGroupID); @@ -176,8 +176,8 @@ class UserImporter extends AbstractImporter { } } - if (!$user->activationCode) $defaultGroupIDs = UserGroup::getGroupIDsByType(array(UserGroup::EVERYONE, UserGroup::USERS)); - else $defaultGroupIDs = UserGroup::getGroupIDsByType(array(UserGroup::EVERYONE, UserGroup::GUESTS)); + if (!$user->activationCode) $defaultGroupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::USERS]); + else $defaultGroupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::GUESTS]); $groupIDs = array_merge($groupIDs, $defaultGroupIDs); $sql = "INSERT IGNORE INTO wcf".WCF_N."_user_to_group @@ -185,10 +185,10 @@ class UserImporter extends AbstractImporter { VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($groupIDs as $groupID) { - $statement->execute(array( + $statement->execute([ $user->userID, $groupID - )); + ]); } // save languages @@ -197,10 +197,10 @@ class UserImporter extends AbstractImporter { VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($languageIDs as $languageID) { - $statement->execute(array( + $statement->execute([ $user->userID, $languageID - )); + ]); } // save default user events @@ -209,10 +209,10 @@ class UserImporter extends AbstractImporter { VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($this->eventIDs as $eventID) { - $statement->execute(array( + $statement->execute([ $user->userID, $eventID - )); + ]); } // save mapping @@ -238,7 +238,7 @@ class UserImporter extends AbstractImporter { FROM wcf".WCF_N."_user WHERE username = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($newUsername)); + $statement->execute([$newUsername]); $row = $statement->fetchArray(); if (empty($row['userID'])) break; } diff --git a/wcfsetup/install/files/lib/system/importer/UserOptionImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserOptionImporter.class.php index 0e8fcf42db..8b2f504b33 100644 --- a/wcfsetup/install/files/lib/system/importer/UserOptionImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserOptionImporter.class.php @@ -45,7 +45,7 @@ class UserOptionImporter extends AbstractImporter { FROM wcf".WCF_N."_language_category WHERE languageCategory = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array('wcf.user.option')); + $statement->execute(['wcf.user.option']); $row = $statement->fetchArray(); $this->languageCategoryID = $row['languageCategoryID']; } @@ -53,7 +53,7 @@ class UserOptionImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['packageID'] = 1; // set temporary option name $data['optionName'] = StringUtil::getRandomID(); @@ -68,29 +68,29 @@ class UserOptionImporter extends AbstractImporter { $this->createCategory($data['categoryName']); // save option - $action = new UserOptionAction(array(), 'create', array('data' => $data)); + $action = new UserOptionAction([], 'create', ['data' => $data]); $returnValues = $action->executeAction(); $userOption = $returnValues['returnValues']; // update generic option name $editor = new UserOptionEditor($userOption); - $editor->update(array( + $editor->update([ 'optionName' => 'option'.$userOption->optionID - )); + ]); // save name $sql = "INSERT IGNORE INTO wcf".WCF_N."_language_item (languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID) VALUES (?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ LanguageFactory::getInstance()->getDefaultLanguageID(), 'wcf.user.option.option'.$userOption->optionID, $additionalData['name'], 0, $this->languageCategoryID, 1 - )); + ]); ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.user.option', $oldID, $userOption->optionID); @@ -106,18 +106,18 @@ class UserOptionImporter extends AbstractImporter { if ($this->categoryCache === null) { // get existing categories $list = new UserOptionCategoryList(); - $list->getConditionBuilder()->add('categoryName = ? OR parentCategoryName = ?', array('profile', 'profile')); + $list->getConditionBuilder()->add('categoryName = ? OR parentCategoryName = ?', ['profile', 'profile']); $list->readObjects(); foreach ($list->getObjects() as $category) $this->categoryCache[] = $category->categoryName; } if (!in_array($name, $this->categoryCache)) { // create category - UserOptionCategoryEditor::create(array( + UserOptionCategoryEditor::create([ 'packageID' => 1, 'categoryName' => $name, 'parentCategoryName' => 'profile' - )); + ]); $this->categoryCache[] = $name; } diff --git a/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php b/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php index c42db78419..cd0579a7d0 100644 --- a/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/UserRankImporter.class.php @@ -22,7 +22,7 @@ class UserRankImporter extends AbstractImporter { /** * @see \wcf\system\importer\IImporter::import() */ - public function import($oldID, array $data, array $additionalData = array()) { + public function import($oldID, array $data, array $additionalData = []) { $data['groupID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user.group', $data['groupID']); if (!$data['groupID']) $data['groupID'] = UserGroup::getGroupByType(UserGroup::USERS)->groupID; diff --git a/wcfsetup/install/files/lib/system/io/File.class.php b/wcfsetup/install/files/lib/system/io/File.class.php index 9db9a4e57b..71f89da324 100644 --- a/wcfsetup/install/files/lib/system/io/File.class.php +++ b/wcfsetup/install/files/lib/system/io/File.class.php @@ -44,7 +44,7 @@ class File { * @param array $options * @throws SystemException */ - public function __construct($filename, $mode = 'wb', $options = array()) { + public function __construct($filename, $mode = 'wb', $options = []) { $this->filename = $filename; if (!empty($options)) { $context = stream_context_create($options); diff --git a/wcfsetup/install/files/lib/system/io/RemoteFile.class.php b/wcfsetup/install/files/lib/system/io/RemoteFile.class.php index 92e34c275f..ea6153432a 100644 --- a/wcfsetup/install/files/lib/system/io/RemoteFile.class.php +++ b/wcfsetup/install/files/lib/system/io/RemoteFile.class.php @@ -52,7 +52,7 @@ class RemoteFile extends File { * @param array $options * @throws SystemException */ - public function __construct($host, $port, $timeout = 30, $options = array()) { + public function __construct($host, $port, $timeout = 30, $options = []) { $this->host = $host; $this->port = $port; diff --git a/wcfsetup/install/files/lib/system/io/Tar.class.php b/wcfsetup/install/files/lib/system/io/Tar.class.php index 70c5add8e0..2783831237 100644 --- a/wcfsetup/install/files/lib/system/io/Tar.class.php +++ b/wcfsetup/install/files/lib/system/io/Tar.class.php @@ -32,7 +32,7 @@ class Tar implements IArchive { * content of the tar file * @var array */ - protected $contentList = array(); + protected $contentList = []; /** * indicates if tar file is opened @@ -245,7 +245,7 @@ class Tar implements IArchive { * This does not get the entire to memory but only parts of it. */ protected function readContent() { - $this->contentList = array(); + $this->contentList = []; $this->read = true; $i = 0; @@ -293,7 +293,7 @@ class Tar implements IArchive { return false; } - $header = array(); + $header = []; $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) { diff --git a/wcfsetup/install/files/lib/system/io/TarWriter.class.php b/wcfsetup/install/files/lib/system/io/TarWriter.class.php index ac218a69d6..b8fac1bee7 100644 --- a/wcfsetup/install/files/lib/system/io/TarWriter.class.php +++ b/wcfsetup/install/files/lib/system/io/TarWriter.class.php @@ -88,7 +88,7 @@ class TarWriter extends Tar { * @throws SystemException */ public function add($files, $addDir = '', $removeDir = '') { - if (!is_array($files)) $files = array($files); + if (!is_array($files)) $files = [$files]; if (empty($files)) return false; $result = true; diff --git a/wcfsetup/install/files/lib/system/io/Zip.class.php b/wcfsetup/install/files/lib/system/io/Zip.class.php index 07cbb3f155..5f8118d9ff 100644 --- a/wcfsetup/install/files/lib/system/io/Zip.class.php +++ b/wcfsetup/install/files/lib/system/io/Zip.class.php @@ -172,7 +172,7 @@ class Zip extends File implements IArchive { } $this->seek(-4, SEEK_CUR); - $files = array(); + $files = []; while ($this->read(4) === self::CENTRAL_DIRECTORY_SIGNATURE) { $data = unpack('vversion/vminVersion/vgeneralPurposeBit/vcompression/vmtime/vmdate', $this->read(12)); // calculate timestamp @@ -213,7 +213,7 @@ class Zip extends File implements IArchive { if ($eof['commentLength'] > 0) $eof['comment'] = $this->read($eof['commentLength']); else $eof['comment'] = ''; - return array('files' => $files, 'eof' => $eof); + return ['files' => $files, 'eof' => $eof]; } /** @@ -318,7 +318,7 @@ class Zip extends File implements IArchive { } } - return array('header' => $header, 'content' => $content); + return ['header' => $header, 'content' => $content]; } /** diff --git a/wcfsetup/install/files/lib/system/io/ZipWriter.class.php b/wcfsetup/install/files/lib/system/io/ZipWriter.class.php index a6ff54b719..b298a2cd91 100644 --- a/wcfsetup/install/files/lib/system/io/ZipWriter.class.php +++ b/wcfsetup/install/files/lib/system/io/ZipWriter.class.php @@ -14,8 +14,8 @@ use wcf\util\StringUtil; * @category Community Framework */ class ZipWriter { - protected $headers = array(); - protected $data = array(); + protected $headers = []; + protected $data = []; protected $endOfData = "\x50\x4b\x05\x06\x00\x00\x00\x00"; protected $lastOffset = 0; protected $zipComment = ''; diff --git a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php index dce83e4bf1..a65bfc75f3 100644 --- a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php @@ -35,10 +35,10 @@ class LabelHandler extends SingletonFactory { * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $this->cache = array( - 'objectTypes' => array(), - 'objectTypeNames' => array() - ); + $this->cache = [ + 'objectTypes' => [], + 'objectTypeNames' => [] + ]; $cache = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.label.object'); foreach ($cache as $objectType) { @@ -115,12 +115,12 @@ class LabelHandler extends SingletonFactory { public function getPermissions($optionName, array $labelIDs) { if (empty($labelIDs)) { // nothing to validate anyway - return array(); + return []; } if (empty($this->labelGroups['groups'])) { // pretend given label ids aren't valid - $data = array(); + $data = []; foreach ($labelIDs as $labelID) $data[$labelID] = false; return $data; @@ -132,7 +132,7 @@ class LabelHandler extends SingletonFactory { } // validate each label - $data = array(); + $data = []; foreach ($labelIDs as $labelID) { $isValid = false; @@ -167,9 +167,9 @@ class LabelHandler extends SingletonFactory { // delete previous labels $conditions = new PreparedStatementConditionBuilder(); - if ($validatePermissions) $conditions->add("labelID IN (?)", array($accessibleLabelIDs)); - $conditions->add("objectTypeID = ?", array($objectTypeID)); - $conditions->add("objectID = ?", array($objectID)); + if ($validatePermissions) $conditions->add("labelID IN (?)", [$accessibleLabelIDs]); + $conditions->add("objectTypeID = ?", [$objectTypeID]); + $conditions->add("objectID = ?", [$objectID]); if (!$validatePermissions || ($validatePermissions && !empty($accessibleLabelIDs))) { $sql = "DELETE FROM wcf".WCF_N."_label_object @@ -185,11 +185,11 @@ class LabelHandler extends SingletonFactory { VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($labelIDs as $labelID) { - $statement->execute(array( + $statement->execute([ $labelID, $objectTypeID, $objectID - )); + ]); } } } @@ -204,18 +204,18 @@ class LabelHandler extends SingletonFactory { */ public function getAssignedLabels($objectTypeID, array $objectIDs, $validatePermissions = true) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectTypeID)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("objectTypeID = ?", [$objectTypeID]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "SELECT objectID, labelID FROM wcf".WCF_N."_label_object ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $labels = array(); + $labels = []; while ($row = $statement->fetchArray()) { if (!isset($labels[$row['labelID']])) { - $labels[$row['labelID']] = array(); + $labels[$row['labelID']] = []; } $labels[$row['labelID']][] = $row['objectID']; @@ -234,11 +234,11 @@ class LabelHandler extends SingletonFactory { } // reorder the array by object id - $data = array(); + $data = []; foreach ($labels as $labelID => $objectIDs) { foreach ($objectIDs as $objectID) { if (!isset($data[$objectID])) { - $data[$objectID] = array(); + $data[$objectID] = []; } foreach ($this->labelGroups['groups'] as $group) { @@ -278,8 +278,8 @@ class LabelHandler extends SingletonFactory { * @return ViewableLabelGroup[] * @throws SystemException */ - public function getLabelGroups(array $groupIDs = array(), $validatePermissions = true, $permission = 'canSetLabel') { - $data = array(); + public function getLabelGroups(array $groupIDs = [], $validatePermissions = true, $permission = 'canSetLabel') { + $data = []; if ($validatePermissions) { $optionID = $this->getOptionID($permission); @@ -305,7 +305,7 @@ class LabelHandler extends SingletonFactory { $data[$groupID] = $this->labelGroups['groups'][$groupID]; } - uasort($data, array('\wcf\data\label\group\LabelGroup', 'sortLabelGroups')); + uasort($data, ['\wcf\data\label\group\LabelGroup', 'sortLabelGroups']); return $data; } @@ -316,7 +316,7 @@ class LabelHandler extends SingletonFactory { * @return integer[] */ public function getAccessibleLabelIDs() { - $labelIDs = array(); + $labelIDs = []; $groups = $this->getLabelGroups(); foreach ($groups as $group) { @@ -348,8 +348,8 @@ class LabelHandler extends SingletonFactory { */ public function removeLabels($objectTypeID, array $objectIDs) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectTypeID)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("objectTypeID = ?", [$objectTypeID]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "DELETE FROM wcf".WCF_N."_label_object ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); diff --git a/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php b/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php index 1a30785186..8416ac60b8 100644 --- a/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/object/AbstractLabelObjectHandler.class.php @@ -20,7 +20,7 @@ abstract class AbstractLabelObjectHandler extends SingletonFactory implements IL * list of available label groups * @var ViewableLabelGroup[] */ - protected $labelGroups = array(); + protected $labelGroups = []; /** * object type name @@ -50,22 +50,22 @@ abstract class AbstractLabelObjectHandler extends SingletonFactory implements IL /** * @see \wcf\system\label\manager\ILabelObjectHandler::getLabelGroupIDs() */ - public function getLabelGroupIDs(array $parameters = array()) { + public function getLabelGroupIDs(array $parameters = []) { return array_keys($this->labelGroups); } /** * @see \wcf\system\label\manager\ILabelObjectHandler::getLabelGroups() */ - public function getLabelGroups(array $parameters = array()) { + public function getLabelGroups(array $parameters = []) { $groupIDs = $this->getLabelGroupIDs($parameters); - $data = array(); + $data = []; foreach ($groupIDs as $groupID) { $data[$groupID] = $this->labelGroups[$groupID]; } - uasort($data, array('\wcf\data\label\group\LabelGroup', 'sortLabelGroups')); + uasort($data, ['\wcf\data\label\group\LabelGroup', 'sortLabelGroups']); return $data; } @@ -82,8 +82,8 @@ abstract class AbstractLabelObjectHandler extends SingletonFactory implements IL } } - $validationErrors = array(); - $satisfiedGroups = array(); + $validationErrors = []; + $satisfiedGroups = []; foreach ($labelIDs as $groupID => $labelID) { // only one label per group is allowed if (is_array($labelID)) { diff --git a/wcfsetup/install/files/lib/system/label/object/ILabelObjectHandler.class.php b/wcfsetup/install/files/lib/system/label/object/ILabelObjectHandler.class.php index 834f0e0232..1c407b81f3 100644 --- a/wcfsetup/install/files/lib/system/label/object/ILabelObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/object/ILabelObjectHandler.class.php @@ -20,7 +20,7 @@ interface ILabelObjectHandler { * @param array $parameters * @return integer[] */ - public function getLabelGroupIDs(array $parameters = array()); + public function getLabelGroupIDs(array $parameters = []); /** * Returns a list of label groups. @@ -28,7 +28,7 @@ interface ILabelObjectHandler { * @param array $parameters * @return ViewableLabelGroup[] */ - public function getLabelGroups(array $parameters = array()); + public function getLabelGroups(array $parameters = []); /** * Returns true, if all given label ids are valid and accessible. diff --git a/wcfsetup/install/files/lib/system/label/object/type/LabelObjectTypeContainer.class.php b/wcfsetup/install/files/lib/system/label/object/type/LabelObjectTypeContainer.class.php index 159c5825fd..c2fbef7cf6 100644 --- a/wcfsetup/install/files/lib/system/label/object/type/LabelObjectTypeContainer.class.php +++ b/wcfsetup/install/files/lib/system/label/object/type/LabelObjectTypeContainer.class.php @@ -24,7 +24,7 @@ class LabelObjectTypeContainer implements \Countable, \Iterator { * list of object types * @var ObjectType[] */ - public $objectTypes = array(); + public $objectTypes = []; /** * object type id diff --git a/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php b/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php index a1e0b62093..65ea6552e3 100644 --- a/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php +++ b/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php @@ -29,7 +29,7 @@ class LanguageFactory extends SingletonFactory { * initialized languages * @var Language[] */ - protected $languages = array(); + protected $languages = []; /** * active template scripting compiler @@ -92,7 +92,7 @@ class LanguageFactory extends SingletonFactory { FROM wcf".WCF_N."_language WHERE languageCode = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($languageCode)); + $statement->execute([$languageCode]); $row = $statement->fetchArray(); if (isset($row['languageID'])) return new Language($row['languageID']); } @@ -155,7 +155,7 @@ class LanguageFactory extends SingletonFactory { */ protected function findPreferredLanguage() { // get available language codes - $availableLanguageCodes = array(); + $availableLanguageCodes = []; foreach ($this->getLanguages() as $language) { $availableLanguageCodes[] = $language->languageCode; } @@ -272,7 +272,7 @@ class LanguageFactory extends SingletonFactory { * @return Language[] */ public function getContentLanguages() { - $availableLanguages = array(); + $availableLanguages = []; foreach ($this->getLanguages() as $languageID => $language) { if ($language->hasContent) { $availableLanguages[$languageID] = $language; @@ -300,7 +300,7 @@ class LanguageFactory extends SingletonFactory { SET isDefault = 1 WHERE languageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($languageID)); + $statement->execute([$languageID]); // rebuild language cache $this->clearCache(); diff --git a/wcfsetup/install/files/lib/system/like/LikeHandler.class.php b/wcfsetup/install/files/lib/system/like/LikeHandler.class.php index 5892881af1..3bfd7e74a6 100644 --- a/wcfsetup/install/files/lib/system/like/LikeHandler.class.php +++ b/wcfsetup/install/files/lib/system/like/LikeHandler.class.php @@ -42,7 +42,7 @@ class LikeHandler extends SingletonFactory { * loaded like objects * @var LikeObject[][] */ - protected $likeObjectCache = array(); + protected $likeObjectCache = []; /** * cached object types @@ -97,7 +97,7 @@ class LikeHandler extends SingletonFactory { return $this->likeObjectCache[$objectType->objectTypeID]; } - return array(); + return []; } /** @@ -116,8 +116,8 @@ class LikeHandler extends SingletonFactory { $i = 0; $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("like_object.objectTypeID = ?", array($objectType->objectTypeID)); - $conditions->add("like_object.objectID IN (?)", array($objectIDs)); + $conditions->add("like_object.objectTypeID = ?", [$objectType->objectTypeID]); + $conditions->add("like_object.objectID IN (?)", [$objectIDs]); $parameters = $conditions->getParameters(); if (WCF::getUser()->userID) { @@ -175,7 +175,7 @@ class LikeHandler extends SingletonFactory { // like data $cumulativeLikes = 0; $newValue = $oldValue = null; - $users = array(); + $users = []; // update existing object if ($likeObject->likeObjectID) { @@ -216,16 +216,16 @@ class LikeHandler extends SingletonFactory { } // build update date - $updateData = array( + $updateData = [ 'likes' => $likes, 'dislikes' => $dislikes, 'cumulativeLikes' => $cumulativeLikes - ); + ]; if ($likeValue == 1) { $users = unserialize($likeObject->cachedUsers); if (count($users) < 3) { - $users[$user->userID] = array('userID' => $user->userID, 'username' => $user->username); + $users[$user->userID] = ['userID' => $user->userID, 'username' => $user->username]; $updateData['cachedUsers'] = serialize($users); } } @@ -244,11 +244,11 @@ class LikeHandler extends SingletonFactory { else { $cumulativeLikes = $likeValue; $newValue = $likeValue; - $users = array(); - if ($likeValue == 1) $users = array($user->userID => array('userID' => $user->userID, 'username' => $user->username)); + $users = []; + if ($likeValue == 1) $users = [$user->userID => ['userID' => $user->userID, 'username' => $user->username]]; // create cache - $likeObject = LikeObjectEditor::create(array( + $likeObject = LikeObjectEditor::create([ 'objectTypeID' => $likeable->getObjectType()->objectTypeID, 'objectID' => $likeable->getObjectID(), 'objectUserID' => ($likeable->getUserID() ?: null), @@ -256,35 +256,35 @@ class LikeHandler extends SingletonFactory { 'dislikes' => ($likeValue == Like::DISLIKE) ? 1 : 0, 'cumulativeLikes' => $cumulativeLikes, 'cachedUsers' => serialize($users) - )); + ]); } // update owner's like counter if ($likeable->getUserID()) { if ($like->likeID) { $userEditor = new UserEditor(new User($likeable->getUserID())); - $userEditor->updateCounters(array( + $userEditor->updateCounters([ 'likesReceived' => ($like->likeValue == Like::LIKE ? -1 : 1) - )); + ]); } else if ($likeValue == Like::LIKE) { $userEditor = new UserEditor(new User($likeable->getUserID())); - $userEditor->updateCounters(array( + $userEditor->updateCounters([ 'likesReceived' => 1 - )); + ]); } } if (!$like->likeID) { // save like - $like = LikeEditor::create(array( + $like = LikeEditor::create([ 'objectID' => $likeable->getObjectID(), 'objectTypeID' => $likeable->getObjectType()->objectTypeID, 'objectUserID' => ($likeable->getUserID() ?: null), 'userID' => $user->userID, 'time' => $time, 'likeValue' => $likeValue - )); + ]); if ($likeValue == Like::LIKE && $likeable->getUserID()) { UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID()); @@ -293,14 +293,14 @@ class LikeHandler extends SingletonFactory { } else { $likeEditor = new LikeEditor($like); - $likeEditor->update(array( + $likeEditor->update([ 'time' => $time, 'likeValue' => $likeValue - )); + ]); if ($likeable->getUserID()) { if ($likeValue == Like::DISLIKE) { - UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($likeable->getUserID() => 1)); + UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$likeable->getUserID() => 1]); } else { UserActivityPointHandler::getInstance()->fireEvent('com.woltlab.wcf.like.activityPointEvent.receivedLikes', $like->likeID, $likeable->getUserID()); @@ -318,13 +318,13 @@ class LikeHandler extends SingletonFactory { WCF::getDB()->rollBackTransaction(); } - return array( + return [ 'data' => $this->loadLikeStatus($likeObject, $user), 'like' => $like, 'newValue' => $newValue, 'oldValue' => $oldValue, 'users' => $users - ); + ]; } /** @@ -359,16 +359,16 @@ class LikeHandler extends SingletonFactory { } // build update data - $updateData = array( + $updateData = [ 'likes' => $likes, 'dislikes' => $dislikes, 'cumulativeLikes' => $cumulativeLikes - ); + ]; $users = $likeObject->getUsers(); - $usersArray = array(); + $usersArray = []; foreach ($users as $user2) { - $usersArray[$user2->userID] = array('userID' => $user2->userID, 'username' => $user2->username); + $usersArray[$user2->userID] = ['userID' => $user2->userID, 'username' => $user2->username]; } if (isset($usersArray[$user->userID])) { @@ -390,11 +390,11 @@ class LikeHandler extends SingletonFactory { if ($likeable->getUserID()) { if ($like->likeValue == Like::LIKE) { $userEditor = new UserEditor(new User($likeable->getUserID())); - $userEditor->updateCounters(array( + $userEditor->updateCounters([ 'likesReceived' => -1 - )); + ]); - UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', array($likeable->getUserID() => 1)); + UserActivityPointHandler::getInstance()->removeEvents('com.woltlab.wcf.like.activityPointEvent.receivedLikes', [$likeable->getUserID() => 1]); } } @@ -407,12 +407,12 @@ class LikeHandler extends SingletonFactory { WCF::getDB()->rollBackTransaction(); } - return array( + return [ 'data' => $this->loadLikeStatus($likeObject, $user), 'newValue' => null, 'oldValue' => $like->likeValue, 'users' => $usersArray - ); + ]; } /** @@ -422,19 +422,19 @@ class LikeHandler extends SingletonFactory { * @param integer[] $objectIDs * @param string[] $notificationObjectTypes */ - public function removeLikes($objectType, array $objectIDs, array $notificationObjectTypes = array()) { + public function removeLikes($objectType, array $objectIDs, array $notificationObjectTypes = []) { $objectTypeObj = $this->getObjectType($objectType); // get like objects $likeObjectList = new LikeObjectList(); - $likeObjectList->getConditionBuilder()->add('like_object.objectTypeID = ?', array($objectTypeObj->objectTypeID)); - $likeObjectList->getConditionBuilder()->add('like_object.objectID IN (?)', array($objectIDs)); + $likeObjectList->getConditionBuilder()->add('like_object.objectTypeID = ?', [$objectTypeObj->objectTypeID]); + $likeObjectList->getConditionBuilder()->add('like_object.objectID IN (?)', [$objectIDs]); $likeObjectList->readObjects(); $likeObjects = $likeObjectList->getObjects(); $likeObjectIDs = $likeObjectList->getObjectIDs(); // reduce count of received users - $users = array(); + $users = []; foreach ($likeObjects as $likeObject) { if ($likeObject->likes) { if (!isset($users[$likeObject->objectUserID])) $users[$likeObject->objectUserID] = 0; @@ -442,20 +442,20 @@ class LikeHandler extends SingletonFactory { } } foreach ($users as $userID => $receivedLikes) { - $userEditor = new UserEditor(new User(null, array('userID' => $userID))); - $userEditor->updateCounters(array( + $userEditor = new UserEditor(new User(null, ['userID' => $userID])); + $userEditor->updateCounters([ 'likesReceived' => $receivedLikes * -1 - )); + ]); } // get like ids $likeList = new LikeList(); - $likeList->getConditionBuilder()->add('like_table.objectTypeID = ?', array($objectTypeObj->objectTypeID)); - $likeList->getConditionBuilder()->add('like_table.objectID IN (?)', array($objectIDs)); + $likeList->getConditionBuilder()->add('like_table.objectTypeID = ?', [$objectTypeObj->objectTypeID]); + $likeList->getConditionBuilder()->add('like_table.objectID IN (?)', [$objectIDs]); $likeList->readObjects(); if (count($likeList)) { - $likeData = array(); + $likeData = []; foreach ($likeList as $like) { $likeData[$like->likeID] = $like->userID; } @@ -505,10 +505,10 @@ class LikeHandler extends SingletonFactory { AND like_table.userID = ?) WHERE like_object.likeObjectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $user->userID, $likeObject->likeObjectID - )); + ]); $row = $statement->fetchArray(); return $row; diff --git a/wcfsetup/install/files/lib/system/log/modification/ModificationLogHandler.class.php b/wcfsetup/install/files/lib/system/log/modification/ModificationLogHandler.class.php index 6583ec3b03..3e0d8672a5 100644 --- a/wcfsetup/install/files/lib/system/log/modification/ModificationLogHandler.class.php +++ b/wcfsetup/install/files/lib/system/log/modification/ModificationLogHandler.class.php @@ -25,7 +25,7 @@ class ModificationLogHandler extends SingletonFactory { * list of object types * @var ObjectType[] */ - protected $cache = array(); + protected $cache = []; /** * @see \wcf\system\SingletonFactory::init() @@ -63,7 +63,7 @@ class ModificationLogHandler extends SingletonFactory { * @return ModificationLog * @throws SystemException */ - protected function _add($objectType, $objectID, $action, array $additionalData = array(), $time = TIME_NOW, $userID = null, $username = null) { + protected function _add($objectType, $objectID, $action, array $additionalData = [], $time = TIME_NOW, $userID = null, $username = null) { $objectTypeObj = $this->getObjectType($objectType); if ($objectTypeObj === null) { throw new SystemException("Object type '".$objectType."' not found within definition 'com.woltlab.wcf.modifiableContent'"); @@ -82,7 +82,7 @@ class ModificationLogHandler extends SingletonFactory { else $username = ''; } - return ModificationLogEditor::create(array( + return ModificationLogEditor::create([ 'objectTypeID' => $objectTypeObj->objectTypeID, 'objectID' => $objectID, 'action' => $action, @@ -90,7 +90,7 @@ class ModificationLogHandler extends SingletonFactory { 'username' => $username, 'time' => $time, 'additionalData' => serialize($additionalData) - )); + ]); } /** @@ -107,8 +107,8 @@ class ModificationLogHandler extends SingletonFactory { } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectTypeObj->objectTypeID)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("objectTypeID = ?", [$objectTypeObj->objectTypeID]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "DELETE FROM wcf".WCF_N."_modification_log ".$conditions; diff --git a/wcfsetup/install/files/lib/system/mail/Mail.class.php b/wcfsetup/install/files/lib/system/mail/Mail.class.php index e81109a684..e690ba8e7c 100644 --- a/wcfsetup/install/files/lib/system/mail/Mail.class.php +++ b/wcfsetup/install/files/lib/system/mail/Mail.class.php @@ -45,7 +45,7 @@ class Mail { * mail recipients * @var string[] */ - protected $to = array(); + protected $to = []; /** * mail subject @@ -69,19 +69,19 @@ class Mail { * mail carbon copy * @var string[] */ - protected $cc = array(); + protected $cc = []; /** * mail blind carbon copy * @var string[] */ - protected $bcc = array(); + protected $bcc = []; /** * mail attachments * @var array */ - protected $attachments = array(); + protected $attachments = []; /** * priority of the mail @@ -114,10 +114,10 @@ class Mail { * @param integer $priority * @param string $header */ - public function __construct($to = '', $subject = '', $message = '', $from = '', $cc = '', $bcc = '', $attachments = array(), $priority = '', $header = '') { + public function __construct($to = '', $subject = '', $message = '', $from = '', $cc = '', $bcc = '', $attachments = [], $priority = '', $header = '') { $this->setBoundary(); - if (empty($from)) $from = array(MAIL_FROM_NAME => MAIL_FROM_ADDRESS); + if (empty($from)) $from = [MAIL_FROM_NAME => MAIL_FROM_ADDRESS]; if (empty($priority)) $priority = 3; $this->setFrom($from); @@ -438,7 +438,7 @@ class Mail { * @param string $name filename */ public function addAttachment($path, $name = '') { - $this->attachments[] = array('path' => $path, 'name' => ($name ?: basename($path))); + $this->attachments[] = ['path' => $path, 'name' => ($name ?: basename($path))]; } /** diff --git a/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php b/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php index 8bbce40a06..46b507d14c 100644 --- a/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php +++ b/wcfsetup/install/files/lib/system/mail/SMTPMailSender.class.php @@ -38,7 +38,7 @@ class SMTPMailSender extends MailSender { * mail recipients * @var array */ - protected $recipients = array(); + protected $recipients = []; /** * Creates a new SMTPMailSender object. @@ -160,7 +160,7 @@ class SMTPMailSender extends MailSender { * @see \wcf\system\mail\MailSender::sendMail() */ public function sendMail(Mail $mail) { - $this->recipients = array(); + $this->recipients = []; if (count($mail->getTo()) > 0) $this->recipients = $mail->getTo(); if (count($mail->getCC()) > 0) $this->recipients = array_merge($this->recipients, $mail->getCC()); if (count($mail->getBCC())> 0) $this->recipients = array_merge($this->recipients, $mail->getBCC()); diff --git a/wcfsetup/install/files/lib/system/menu/TreeMenu.class.php b/wcfsetup/install/files/lib/system/menu/TreeMenu.class.php index 8831a90cca..5358f4192d 100644 --- a/wcfsetup/install/files/lib/system/menu/TreeMenu.class.php +++ b/wcfsetup/install/files/lib/system/menu/TreeMenu.class.php @@ -19,13 +19,13 @@ abstract class TreeMenu extends SingletonFactory { * list of visible menu items * @var ITreeMenuItem[] */ - public $menuItemList = array(); + public $menuItemList = []; /** * list of the names of the active menu items * @var string[] */ - public $activeMenuItems = array(); + public $activeMenuItems = []; /** * list of all menu items @@ -60,7 +60,7 @@ abstract class TreeMenu extends SingletonFactory { // call loadCache event EventHandler::getInstance()->fireAction($this, 'loadCache'); - $this->menuItems = array(); + $this->menuItems = []; } /** @@ -161,7 +161,7 @@ abstract class TreeMenu extends SingletonFactory { * @param string $menuItem name of the active menu item */ public function setActiveMenuItem($menuItem) { - $newActiveMenuItems = array(); + $newActiveMenuItems = []; while (isset($this->menuItemList[$menuItem])) { $newActiveMenuItems[] = $menuItem; $menuItem = $this->menuItemList[$menuItem]->parentMenuItem; @@ -203,6 +203,6 @@ abstract class TreeMenu extends SingletonFactory { public function getMenuItems($parentMenuItem = null) { if ($parentMenuItem === null) return $this->menuItems; if (isset($this->menuItems[$parentMenuItem])) return $this->menuItems[$parentMenuItem]; - return array(); + return []; } } diff --git a/wcfsetup/install/files/lib/system/menu/user/profile/content/AboutUserProfileMenuContent.class.php b/wcfsetup/install/files/lib/system/menu/user/profile/content/AboutUserProfileMenuContent.class.php index 891888329c..7d01223e28 100644 --- a/wcfsetup/install/files/lib/system/menu/user/profile/content/AboutUserProfileMenuContent.class.php +++ b/wcfsetup/install/files/lib/system/menu/user/profile/content/AboutUserProfileMenuContent.class.php @@ -35,10 +35,10 @@ class AboutUserProfileMenuContent extends SingletonFactory implements IUserProfi $user = new User($userID); $this->optionHandler->setUser($user); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'options' => $this->optionHandler->getOptionTree(), 'userID' => $user->userID, - )); + ]); return WCF::getTPL()->fetch('userProfileAbout'); } diff --git a/wcfsetup/install/files/lib/system/menu/user/profile/content/CommentUserProfileMenuContent.class.php b/wcfsetup/install/files/lib/system/menu/user/profile/content/CommentUserProfileMenuContent.class.php index b885e60750..e3dc3c1b38 100644 --- a/wcfsetup/install/files/lib/system/menu/user/profile/content/CommentUserProfileMenuContent.class.php +++ b/wcfsetup/install/files/lib/system/menu/user/profile/content/CommentUserProfileMenuContent.class.php @@ -40,14 +40,14 @@ class CommentUserProfileMenuContent extends SingletonFactory implements IUserPro $commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->objectTypeID, $userID); // assign variables - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'commentCanAdd' => $this->commentManager->canAdd($userID), 'commentList' => $commentList, 'commentObjectTypeID' => $this->objectTypeID, 'userID' => $userID, 'lastCommentTime' => $commentList->getMinCommentTime(), - 'likeData' => (MODULE_LIKE ? $commentList->getLikeData() : array()) - )); + 'likeData' => (MODULE_LIKE ? $commentList->getLikeData() : []) + ]); return WCF::getTPL()->fetch('userProfileCommentList'); } diff --git a/wcfsetup/install/files/lib/system/menu/user/profile/content/LikesUserProfileMenuContent.class.php b/wcfsetup/install/files/lib/system/menu/user/profile/content/LikesUserProfileMenuContent.class.php index 4e274cdbda..65cf75f163 100644 --- a/wcfsetup/install/files/lib/system/menu/user/profile/content/LikesUserProfileMenuContent.class.php +++ b/wcfsetup/install/files/lib/system/menu/user/profile/content/LikesUserProfileMenuContent.class.php @@ -21,15 +21,15 @@ class LikesUserProfileMenuContent extends SingletonFactory implements IUserProfi */ public function getContent($userID) { $likeList = new ViewableLikeList(); - $likeList->getConditionBuilder()->add("like_table.objectUserID = ?", array($userID)); - $likeList->getConditionBuilder()->add("like_table.likeValue = ?", array(Like::LIKE)); + $likeList->getConditionBuilder()->add("like_table.objectUserID = ?", [$userID]); + $likeList->getConditionBuilder()->add("like_table.likeValue = ?", [Like::LIKE]); $likeList->readObjects(); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'likeList' => $likeList, 'userID' => $userID, 'lastLikeTime' => $likeList->getLastLikeTime(), - )); + ]); return WCF::getTPL()->fetch('userProfileLikes'); } diff --git a/wcfsetup/install/files/lib/system/menu/user/profile/content/RecentActivityUserProfileMenuContent.class.php b/wcfsetup/install/files/lib/system/menu/user/profile/content/RecentActivityUserProfileMenuContent.class.php index ea22c07321..0c9f23ecc8 100644 --- a/wcfsetup/install/files/lib/system/menu/user/profile/content/RecentActivityUserProfileMenuContent.class.php +++ b/wcfsetup/install/files/lib/system/menu/user/profile/content/RecentActivityUserProfileMenuContent.class.php @@ -21,7 +21,7 @@ class RecentActivityUserProfileMenuContent extends SingletonFactory implements I */ public function getContent($userID) { $eventList = new ViewableUserActivityEventList(); - $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", array($userID)); + $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", [$userID]); $eventList->readObjects(); $lastEventTime = $eventList->getLastEventTime(); @@ -29,12 +29,12 @@ class RecentActivityUserProfileMenuContent extends SingletonFactory implements I UserActivityEventHandler::validateEvents($eventList); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'eventList' => $eventList, 'lastEventTime' => $lastEventTime, 'placeholder' => WCF::getLanguage()->get('wcf.user.profile.content.recentActivity.noEntries'), 'userID' => $userID - )); + ]); return WCF::getTPL()->fetch('recentActivities'); } diff --git a/wcfsetup/install/files/lib/system/message/MessageFormSettingsHandler.class.php b/wcfsetup/install/files/lib/system/message/MessageFormSettingsHandler.class.php index 067af85f1e..7d152c7d5c 100644 --- a/wcfsetup/install/files/lib/system/message/MessageFormSettingsHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/MessageFormSettingsHandler.class.php @@ -63,10 +63,10 @@ class MessageFormSettingsHandler { $enableBBCodes = $preParse = ($object->enableBBCodes) ? 1 : 0; } - return array( + return [ 'enableSmilies' => $enableSmilies, 'enableBBCodes' => $enableBBCodes, 'preParse' => $preParse - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php b/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php index 8b3c01d798..3d338dd965 100644 --- a/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php +++ b/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php @@ -147,7 +147,7 @@ class QuickReplyManager extends SingletonFactory { $object->validateMessage($this->container, $parameters['data']['message']); // check for message quote ids - $parameters['removeQuoteIDs'] = (isset($parameters['removeQuoteIDs']) && is_array($parameters['removeQuoteIDs'])) ? ArrayUtil::trim($parameters['removeQuoteIDs']) : array(); + $parameters['removeQuoteIDs'] = (isset($parameters['removeQuoteIDs']) && is_array($parameters['removeQuoteIDs'])) ? ArrayUtil::trim($parameters['removeQuoteIDs']) : []; // check for tmp hash (attachments) $parameters['tmpHash'] = ''; @@ -177,10 +177,10 @@ class QuickReplyManager extends SingletonFactory { * @return array */ public function createMessage(IMessageQuickReplyAction $object, array &$parameters, $containerActionClassName, $sortOrder, $templateName, $application = 'wcf') { - $additionalFields = array(); + $additionalFields = []; EventHandler::getInstance()->fireAction($this, 'createMessage', $additionalFields); - $tableIndexName = call_user_func(array($this->container, 'getDatabaseTableIndexName')); + $tableIndexName = call_user_func([$this->container, 'getDatabaseTableIndexName']); $parameters['data'][$tableIndexName] = $parameters['objectID']; $parameters['data']['time'] = TIME_NOW; $parameters['data']['userID'] = WCF::getUser()->userID ?: null; @@ -200,13 +200,13 @@ class QuickReplyManager extends SingletonFactory { } $message = $object->create(); - $eventParameters = array('message' => $message); + $eventParameters = ['message' => $message]; EventHandler::getInstance()->fireAction($this, 'createdMessage', $eventParameters); if ($message instanceof IMessage && !$message->isVisible()) { - return array( + return [ 'isVisible' => false - ); + ]; } // resolve the page no @@ -220,13 +220,13 @@ class QuickReplyManager extends SingletonFactory { // calculate start index $startIndex = $count - (count($messageList) - 1); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'attachmentList' => $messageList->getAttachmentList(), 'container' => $this->container, 'objects' => $messageList, 'startIndex' => $startIndex, 'sortOrder' => $sortOrder, - )); + ]); // assign 'to top' link if (isset($parameters['anchor'])) { @@ -235,20 +235,20 @@ class QuickReplyManager extends SingletonFactory { // update visit time (messages shouldn't occur as new upon next visit) if (is_subclass_of($containerActionClassName, 'wcf\data\IVisitableObjectAction')) { - $containerAction = new $containerActionClassName(array(($this->container instanceof DatabaseObjectDecorator ? $this->container->getDecoratedObject() : $this->container)), 'markAsRead'); + $containerAction = new $containerActionClassName([($this->container instanceof DatabaseObjectDecorator ? $this->container->getDecoratedObject() : $this->container)], 'markAsRead'); $containerAction->executeAction(); } - return array( + return [ 'lastPostTime' => $message->time, 'template' => WCF::getTPL()->fetch($templateName, $application) - ); + ]; } else { // redirect - return array( + return [ 'url' => $object->getRedirectUrl($this->container, $message) - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/message/censorship/Censorship.class.php b/wcfsetup/install/files/lib/system/message/censorship/Censorship.class.php index 4b5f7a3f82..09de69f4b8 100644 --- a/wcfsetup/install/files/lib/system/message/censorship/Censorship.class.php +++ b/wcfsetup/install/files/lib/system/message/censorship/Censorship.class.php @@ -18,7 +18,7 @@ class Censorship extends SingletonFactory { * censored words * @var string[] */ - protected $censoredWords = array(); + protected $censoredWords = []; /** * word delimiters @@ -30,13 +30,13 @@ class Censorship extends SingletonFactory { * list of words * @var string[] */ - protected $words = array(); + protected $words = []; /** * list of matches * @var array */ - protected $matches = array(); + protected $matches = []; /** * @see \wcf\system\SingletonFactory::init() @@ -52,7 +52,7 @@ class Censorship extends SingletonFactory { continue; } - $displayedCensoredWord = str_replace(array('~', '*'), '', $censoredWord); + $displayedCensoredWord = str_replace(['~', '*'], '', $censoredWord); // check if censored word contains at least one delimiter if (preg_match('!'.$this->delimiters.'+!', $displayedCensoredWord)) { @@ -75,7 +75,7 @@ class Censorship extends SingletonFactory { */ public function test($text) { // reset values - $this->matches = $this->words = array(); + $this->matches = $this->words = []; // string to lower case $text = mb_strtolower($text); diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/AttachmentMessageEmbeddedObjectHandler.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/AttachmentMessageEmbeddedObjectHandler.class.php index 958d1b4031..5de5fa3268 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/AttachmentMessageEmbeddedObjectHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/AttachmentMessageEmbeddedObjectHandler.class.php @@ -21,14 +21,14 @@ class AttachmentMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObje public function parseMessage($message) { $parsedAttachmentIDs = array_unique(ArrayUtil::toIntegerArray(array_merge(self::getFirstParameters($message, 'attach'), self::getTextParameters($message, 'attach')))); if (!empty($parsedAttachmentIDs)) { - $attachmentIDs = array(); + $attachmentIDs = []; foreach ($parsedAttachmentIDs as $parsedAttachmentID) { if ($parsedAttachmentID) $attachmentIDs[] = $parsedAttachmentID; } if (!empty($attachmentIDs)) { $attachmentList = new AttachmentList(); - $attachmentList->getConditionBuilder()->add("attachment.attachmentID IN (?)", array($attachmentIDs)); + $attachmentList->getConditionBuilder()->add("attachment.attachmentID IN (?)", [$attachmentIDs]); $attachmentList->readObjectIDs(); return $attachmentList->getObjectIDs(); @@ -47,9 +47,9 @@ class AttachmentMessageEmbeddedObjectHandler extends AbstractMessageEmbeddedObje $attachmentList->readObjects(); // group attachments by object type - $groupedAttachments = array(); + $groupedAttachments = []; foreach ($attachmentList->getObjects() as $attachment) { - if (!isset($groupedAttachments[$attachment->objectTypeID])) $groupedAttachments[$attachment->objectTypeID] = array(); + if (!isset($groupedAttachments[$attachment->objectTypeID])) $groupedAttachments[$attachment->objectTypeID] = []; $groupedAttachments[$attachment->objectTypeID][] = $attachment; } diff --git a/wcfsetup/install/files/lib/system/message/embedded/object/MessageEmbeddedObjectManager.class.php b/wcfsetup/install/files/lib/system/message/embedded/object/MessageEmbeddedObjectManager.class.php index fc9796879f..d6eba38698 100644 --- a/wcfsetup/install/files/lib/system/message/embedded/object/MessageEmbeddedObjectManager.class.php +++ b/wcfsetup/install/files/lib/system/message/embedded/object/MessageEmbeddedObjectManager.class.php @@ -21,13 +21,13 @@ class MessageEmbeddedObjectManager extends SingletonFactory { * caches message to embedded object assignments * @var array */ - protected $messageEmbeddedObjects = array(); + protected $messageEmbeddedObjects = []; /** * caches embedded objects * @var array */ - protected $embeddedObjects = array(); + protected $embeddedObjects = []; /** * object type of the active message @@ -60,7 +60,7 @@ class MessageEmbeddedObjectManager extends SingletonFactory { $message = BBCodeParser::getInstance()->removeCodeTags($message); // delete existing assignments - $this->removeObjects($messageObjectType, array($messageID)); + $this->removeObjects($messageObjectType, [$messageID]); // get object type id $messageObjectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $messageObjectType); @@ -79,7 +79,7 @@ class MessageEmbeddedObjectManager extends SingletonFactory { if (!empty($objectIDs)) { $returnValue = true; foreach ($objectIDs as $objectID) { - $statement->execute(array($messageObjectTypeID, $messageID, $handler->objectTypeID, $objectID)); + $statement->execute([$messageObjectTypeID, $messageID, $handler->objectTypeID, $objectID]); } } } @@ -96,8 +96,8 @@ class MessageEmbeddedObjectManager extends SingletonFactory { */ public function removeObjects($messageObjectType, array $messageIDs) { $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('messageObjectTypeID = ?', array(ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $messageObjectType))); - $conditionBuilder->add('messageID IN (?)', array($messageIDs)); + $conditionBuilder->add('messageObjectTypeID = ?', [ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $messageObjectType)]); + $conditionBuilder->add('messageID IN (?)', [$messageIDs]); $sql = "DELETE FROM wcf".WCF_N."_message_embedded_object ".$conditionBuilder; @@ -113,8 +113,8 @@ class MessageEmbeddedObjectManager extends SingletonFactory { */ public function loadObjects($messageObjectType, array $messageIDs) { $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('messageObjectTypeID = ?', array(ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $messageObjectType))); - $conditionBuilder->add('messageID IN (?)', array($messageIDs)); + $conditionBuilder->add('messageObjectTypeID = ?', [ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $messageObjectType)]); + $conditionBuilder->add('messageID IN (?)', [$messageIDs]); // get object ids $sql = "SELECT * @@ -122,7 +122,7 @@ class MessageEmbeddedObjectManager extends SingletonFactory { ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); - $embeddedObjects = array(); + $embeddedObjects = []; while ($row = $statement->fetchArray()) { if (isset($this->embeddedObjects[$row['embeddedObjectTypeID']][$row['embeddedObjectID']])) { // embedded object already loaded @@ -130,19 +130,19 @@ class MessageEmbeddedObjectManager extends SingletonFactory { } // group objects by object type - if (!isset($embeddedObjects[$row['embeddedObjectTypeID']])) $embeddedObjects[$row['embeddedObjectTypeID']] = array(); + if (!isset($embeddedObjects[$row['embeddedObjectTypeID']])) $embeddedObjects[$row['embeddedObjectTypeID']] = []; $embeddedObjects[$row['embeddedObjectTypeID']][] = $row['embeddedObjectID']; // store message to embedded object assignment if (!isset($this->messageEmbeddedObjects[$row['messageObjectTypeID']][$row['messageID']][$row['embeddedObjectTypeID']])) { - $this->messageEmbeddedObjects[$row['messageObjectTypeID']][$row['messageID']][$row['embeddedObjectTypeID']] = array(); + $this->messageEmbeddedObjects[$row['messageObjectTypeID']][$row['messageID']][$row['embeddedObjectTypeID']] = []; } $this->messageEmbeddedObjects[$row['messageObjectTypeID']][$row['messageID']][$row['embeddedObjectTypeID']][] = $row['embeddedObjectID']; } // load objects foreach ($embeddedObjects as $embeddedObjectTypeID => $objectIDs) { - if (!isset($this->embeddedObjects[$embeddedObjectTypeID])) $this->embeddedObjects[$embeddedObjectTypeID] = array(); + if (!isset($this->embeddedObjects[$embeddedObjectTypeID])) $this->embeddedObjects[$embeddedObjectTypeID] = []; foreach ($this->getEmbeddedObjectHandler($embeddedObjectTypeID)->loadObjects(array_unique($objectIDs)) as $objectID => $object) { $this->embeddedObjects[$embeddedObjectTypeID][$objectID] = $object; } @@ -168,7 +168,7 @@ class MessageEmbeddedObjectManager extends SingletonFactory { */ public function getObjects($embeddedObjectType) { $embeddedObjectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message.embeddedObject', $embeddedObjectType); - $returnValue = array(); + $returnValue = []; if (!empty($this->messageEmbeddedObjects[$this->activeMessageObjectTypeID][$this->activeMessageID][$embeddedObjectTypeID])) { foreach ($this->messageEmbeddedObjects[$this->activeMessageObjectTypeID][$this->activeMessageID][$embeddedObjectTypeID] as $embeddedObjectID) { if (isset($this->embeddedObjects[$embeddedObjectTypeID][$embeddedObjectID])) { @@ -235,7 +235,7 @@ class MessageEmbeddedObjectManager extends SingletonFactory { */ protected function getEmbeddedObjectHandlers() { if ($this->embeddedObjectHandlers === null) { - $this->embeddedObjectHandlers = array(); + $this->embeddedObjectHandlers = []; foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.message.embeddedObject') as $objectType) { $this->embeddedObjectHandlers[$objectType->objectTypeID] = $objectType->getProcessor(); } diff --git a/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php b/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php index bdefc4bc03..125b245429 100644 --- a/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php +++ b/wcfsetup/install/files/lib/system/message/quote/AbstractMessageQuoteHandler.class.php @@ -25,14 +25,14 @@ abstract class AbstractMessageQuoteHandler extends SingletonFactory implements I * list of quoted message * @var QuotedMessage[] */ - public $quotedMessages = array(); + public $quotedMessages = []; /** * @see \wcf\system\message\quote\IMessageQuoteHandler::render() */ public function render(array $data, $supportPaste = false) { $messages = $this->getMessages($data); - $userIDs = $userProfiles = array(); + $userIDs = $userProfiles = []; foreach ($messages as $message) { $userID = $message->getUserID(); if ($userID) { @@ -45,11 +45,11 @@ abstract class AbstractMessageQuoteHandler extends SingletonFactory implements I $userProfiles = UserProfileRuntimeCache::getInstance()->getObjects($userIDs); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'messages' => $this->getMessages($data), 'supportPaste' => $supportPaste, 'userProfiles' => $userProfiles - )); + ]); return WCF::getTPL()->fetch($this->templateName); } @@ -60,7 +60,7 @@ abstract class AbstractMessageQuoteHandler extends SingletonFactory implements I public function renderQuotes(array $data, $render = true, $renderAsString = true) { $messages = $this->getMessages($data); - $renderedQuotes = array(); + $renderedQuotes = []; foreach ($messages as $message) { foreach ($message as $quoteID => $quote) { $quotedMessage = $message->getFullQuote($quoteID); diff --git a/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php b/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php index 2b5ded43bb..c46cc1989c 100644 --- a/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php +++ b/wcfsetup/install/files/lib/system/message/quote/QuotedMessage.class.php @@ -17,7 +17,7 @@ class QuotedMessage implements \Countable, \Iterator { * list of full quotes for insertation * @var string[] */ - public $fullQuotes = array(); + public $fullQuotes = []; /** * quotable database object @@ -29,7 +29,7 @@ class QuotedMessage implements \Countable, \Iterator { * list of quotes (shortened) * @var string[] */ - public $quotes = array(); + public $quotes = []; /** * current iterator index diff --git a/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php b/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php index 6353beb685..ebeee96193 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueHandler.class.php @@ -53,11 +53,11 @@ abstract class AbstractModerationQueueHandler implements IModerationQueueHandler throw new SystemException("DatabaseObject class name '" . $this->className . "' is missing or invalid"); } - $indexName = call_user_func(array($this->className, 'getDatabaseTableIndexName')); - $tableName = call_user_func(array($this->className, 'getDatabaseTableName')); + $indexName = call_user_func([$this->className, 'getDatabaseTableIndexName']); + $tableName = call_user_func([$this->className, 'getDatabaseTableName']); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add($indexName . " IN (?)", array(array_keys($queues))); + $conditions->add($indexName . " IN (?)", [array_keys($queues)]); $sql = "SELECT " . $indexName . " FROM " . $tableName . " @@ -81,8 +81,8 @@ abstract class AbstractModerationQueueHandler implements IModerationQueueHandler } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectTypeID)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("objectTypeID = ?", [$objectTypeID]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "SELECT queueID FROM wcf".WCF_N."_moderation_queue diff --git a/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueManager.class.php b/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueManager.class.php index ab4a4de0fa..316a68659d 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueManager.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/AbstractModerationQueueManager.class.php @@ -80,41 +80,41 @@ abstract class AbstractModerationQueueManager extends SingletonFactory implement * @param integer $containerID * @param array $additionalData */ - protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = array()) { + protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = []) { $sql = "SELECT queueID FROM wcf".WCF_N."_moderation_queue WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID - )); + ]); $row = $statement->fetchArray(); if ($row === false) { - $objectAction = new ModerationQueueAction(array(), 'create', array( - 'data' => array( + $objectAction = new ModerationQueueAction([], 'create', [ + 'data' => [ 'objectTypeID' => $objectTypeID, 'objectID' => $objectID, 'containerID' => $containerID, 'userID' => (WCF::getUser()->userID ?: null), 'time' => TIME_NOW, 'additionalData' => serialize($additionalData) - ) - )); + ] + ]); $objectAction->executeAction(); } else { - $objectAction = new ModerationQueueAction(array($row['queueID']), 'update', array( - 'data' => array( + $objectAction = new ModerationQueueAction([$row['queueID']], 'update', [ + 'data' => [ 'status' => ModerationQueue::STATUS_OUTSTANDING, 'containerID' => $containerID, 'userID' => (WCF::getUser()->userID ?: null), 'time' => TIME_NOW, 'additionalData' => serialize($additionalData) - ) - )); + ] + ]); $objectAction->executeAction(); } @@ -129,8 +129,8 @@ abstract class AbstractModerationQueueManager extends SingletonFactory implement */ protected function removeEntries($objectTypeID, array $objectIDs) { $queueList = new ModerationQueueList(); - $queueList->getConditionBuilder()->add("moderation_queue.objectTypeID = ?", array($objectTypeID)); - $queueList->getConditionBuilder()->add("moderation_queue.objectID IN (?)", array($objectIDs)); + $queueList->getConditionBuilder()->add("moderation_queue.objectTypeID = ?", [$objectTypeID]); + $queueList->getConditionBuilder()->add("moderation_queue.objectID IN (?)", [$objectIDs]); $queueList->readObjects(); if (count($queueList)) { diff --git a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueActivationManager.class.php b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueActivationManager.class.php index 5617958d42..72c6adee79 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueActivationManager.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueActivationManager.class.php @@ -44,7 +44,7 @@ class ModerationQueueActivationManager extends AbstractModerationQueueManager { * @see \wcf\system\moderation\queue\IModerationQueueManager::getLink() */ public function getLink($queueID) { - return LinkHandler::getInstance()->getLink('ModerationActivation', array('id' => $queueID)); + return LinkHandler::getInstance()->getLink('ModerationActivation', ['id' => $queueID]); } /** @@ -55,7 +55,7 @@ class ModerationQueueActivationManager extends AbstractModerationQueueManager { * @param array $additionalData * @throws SystemException */ - public function addModeratedContent($objectType, $objectID, array $additionalData = array()) { + public function addModeratedContent($objectType, $objectID, array $additionalData = []) { if (!$this->isValid($objectType)) { throw new SystemException("Object type '".$objectType."' is not valid for definition 'com.woltlab.wcf.moderation.activation'"); } diff --git a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php index ac003f0cbc..5337460806 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php @@ -27,25 +27,25 @@ class ModerationQueueManager extends SingletonFactory { * list of definition names by definition id * @var string[] */ - protected $definitions = array(); + protected $definitions = []; /** * list of moderation types * @var ObjectType[] */ - protected $moderationTypes = array(); + protected $moderationTypes = []; /** * list of object type names categorized by type * @var integer[][] */ - protected $objectTypeNames = array(); + protected $objectTypeNames = []; /** * list of object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * @see \wcf\system\SingletonFactory::init() @@ -65,7 +65,7 @@ class ModerationQueueManager extends SingletonFactory { } $this->definitions[$definition->definitionID] = $definition->definitionName; - $this->objectTypeNames[$definition->definitionName] = array(); + $this->objectTypeNames[$definition->definitionName] = []; $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes($definition->definitionName); foreach ($objectTypes as $objectType) { @@ -170,7 +170,7 @@ class ModerationQueueManager extends SingletonFactory { * @return integer[] */ public function getObjectTypeIDs(array $definitionIDs) { - $objectTypeIDs = array(); + $objectTypeIDs = []; foreach ($definitionIDs as $definitionID) { if (isset($this->definitions[$definitionID])) { foreach ($this->objectTypeNames[$this->definitions[$definitionID]] as $objectTypeID) { @@ -222,9 +222,9 @@ class ModerationQueueManager extends SingletonFactory { // count outstanding and assigned queues $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("moderation_queue_to_user.userID = ?", array(WCF::getUser()->userID)); - $conditions->add("moderation_queue_to_user.isAffected = ?", array(1)); - $conditions->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); + $conditions->add("moderation_queue_to_user.userID = ?", [WCF::getUser()->userID]); + $conditions->add("moderation_queue_to_user.isAffected = ?", [1]); + $conditions->add("moderation_queue.status IN (?)", [[ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING]]); $sql = "SELECT COUNT(*) FROM wcf".WCF_N."_moderation_queue_to_user moderation_queue_to_user @@ -259,10 +259,10 @@ class ModerationQueueManager extends SingletonFactory { // count outstanding and assigned queues $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("moderation_queue_to_user.userID = ?", array(WCF::getUser()->userID)); - $conditions->add("moderation_queue_to_user.isAffected = ?", array(1)); - $conditions->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); - $conditions->add("moderation_queue.time > ?", array(VisitTracker::getInstance()->getVisitTime('com.woltlab.wcf.moderation.queue'))); + $conditions->add("moderation_queue_to_user.userID = ?", [WCF::getUser()->userID]); + $conditions->add("moderation_queue_to_user.isAffected = ?", [1]); + $conditions->add("moderation_queue.status IN (?)", [[ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING]]); + $conditions->add("moderation_queue.time > ?", [VisitTracker::getInstance()->getVisitTime('com.woltlab.wcf.moderation.queue')]); $conditions->add("(moderation_queue.time > tracked_visit.visitTime OR tracked_visit.visitTime IS NULL)"); $sql = "SELECT COUNT(*) @@ -293,10 +293,10 @@ class ModerationQueueManager extends SingletonFactory { $queueList->readObjects(); if (count($queueList)) { - $queues = array(); + $queues = []; foreach ($queueList as $queue) { if (!isset($queues[$queue->objectTypeID])) { - $queues[$queue->objectTypeID] = array(); + $queues[$queue->objectTypeID] = []; } $queues[$queue->objectTypeID][$queue->queueID] = $queue; @@ -325,11 +325,11 @@ class ModerationQueueManager extends SingletonFactory { WCF::getDB()->beginTransaction(); foreach ($assignments as $queueID => $isAffected) { - $statement->execute(array( + $statement->execute([ $queueID, WCF::getUser()->userID, ($isAffected ? 1 : 0) - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -346,24 +346,24 @@ class ModerationQueueManager extends SingletonFactory { AND moderation_queue_to_user.isAffected = ? AND moderation_queue.status <> ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ WCF::getUser()->userID, 1, ModerationQueue::STATUS_DONE - )); + ]); - $queues = array(); + $queues = []; while ($row = $statement->fetchArray()) { $objectTypeID = $row['objectTypeID']; if (!isset($queues[$objectTypeID])) { - $queues[$objectTypeID] = array(); + $queues[$objectTypeID] = []; } $queues[$objectTypeID][$row['objectID']] = $row['queueID']; } if (!empty($queues)) { - $queueIDs = array(); + $queueIDs = []; foreach ($queues as $objectTypeID => $objectQueues) { $queueIDs = array_merge($queueIDs, $this->getProcessor($this->definitions[$this->objectTypes[$objectTypeID]->definitionID], null, $objectTypeID)->identifyOrphans($objectQueues)); } @@ -380,7 +380,7 @@ class ModerationQueueManager extends SingletonFactory { public function removeOrphans(array $queueIDs) { if (!empty($queueIDs)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("queueID IN (?)", array($queueIDs)); + $conditions->add("queueID IN (?)", [$queueIDs]); $sql = "DELETE FROM wcf".WCF_N."_moderation_queue ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); @@ -401,8 +401,8 @@ class ModerationQueueManager extends SingletonFactory { UserStorageHandler::getInstance()->resetAll('unreadModerationCount'); } else { - UserStorageHandler::getInstance()->reset(array($userID), 'outstandingModerationCount'); - UserStorageHandler::getInstance()->reset(array($userID), 'unreadModerationCount'); + UserStorageHandler::getInstance()->reset([$userID], 'outstandingModerationCount'); + UserStorageHandler::getInstance()->reset([$userID], 'unreadModerationCount'); } } @@ -412,7 +412,7 @@ class ModerationQueueManager extends SingletonFactory { * @return string[] */ public function getDefinitionNamesByObjectTypeIDs() { - $definitionNames = array(); + $definitionNames = []; foreach ($this->objectTypeNames as $definitionName => $objectTypes) { foreach ($objectTypes as $objectTypeID) { $definitionNames[$objectTypeID] = $definitionName; @@ -429,7 +429,7 @@ class ModerationQueueManager extends SingletonFactory { * @return string[] */ public function getDefinitionNamesByObjectType($objectType) { - $definitionNames = array(); + $definitionNames = []; foreach ($this->objectTypeNames as $definitionName => $objectTypes) { if (isset($objectTypes[$objectType])) { $definitionNames[] = $definitionName; diff --git a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php index 3e706f8a35..52eb533f20 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php @@ -38,10 +38,10 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager { WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID - )); + ]); return $statement->fetchSingleColumn() > 0; } @@ -63,12 +63,12 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager { AND objectID = ? AND status IN (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING - )); + ]); return $statement->fetchColumn() > 0; } @@ -88,7 +88,7 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager { * @see \wcf\system\moderation\queue\IModerationQueueManager::getLink() */ public function getLink($queueID) { - return LinkHandler::getInstance()->getLink('ModerationReport', array('id' => $queueID)); + return LinkHandler::getInstance()->getLink('ModerationReport', ['id' => $queueID]); } /** @@ -121,7 +121,7 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager { * @param array $additionalData * @throws SystemException */ - public function addReport($objectType, $objectID, $message, array $additionalData = array()) { + public function addReport($objectType, $objectID, $message, array $additionalData = []) { if (!$this->isValid($objectType)) { throw new SystemException("Object type '".$objectType."' is not valid for definition 'com.woltlab.wcf.moderation.report'"); } @@ -138,43 +138,43 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager { /** * @see \wcf\system\moderation\queue\AbstractModerationQueueManager::addEntry() */ - protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = array()) { + protected function addEntry($objectTypeID, $objectID, $containerID = 0, array $additionalData = []) { $sql = "SELECT queueID FROM wcf".WCF_N."_moderation_queue WHERE objectTypeID = ? AND objectID = ? AND status <> ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, ModerationQueue::STATUS_DONE - )); + ]); $row = $statement->fetchArray(); if ($row === false) { - $objectAction = new ModerationQueueAction(array(), 'create', array( - 'data' => array( + $objectAction = new ModerationQueueAction([], 'create', [ + 'data' => [ 'objectTypeID' => $objectTypeID, 'objectID' => $objectID, 'containerID' => $containerID, 'userID' => (WCF::getUser()->userID ?: null), 'time' => TIME_NOW, 'additionalData' => serialize($additionalData) - ) - )); + ] + ]); $objectAction->executeAction(); } else { - $objectAction = new ModerationQueueAction(array($row['queueID']), 'update', array( - 'data' => array( + $objectAction = new ModerationQueueAction([$row['queueID']], 'update', [ + 'data' => [ 'status' => ModerationQueue::STATUS_OUTSTANDING, 'containerID' => $containerID, 'userID' => (WCF::getUser()->userID ?: null), 'time' => TIME_NOW, 'additionalData' => serialize($additionalData) - ) - )); + ] + ]); $objectAction->executeAction(); } diff --git a/wcfsetup/install/files/lib/system/notice/NoticeHandler.class.php b/wcfsetup/install/files/lib/system/notice/NoticeHandler.class.php index 0cdb23acab..263e756f23 100644 --- a/wcfsetup/install/files/lib/system/notice/NoticeHandler.class.php +++ b/wcfsetup/install/files/lib/system/notice/NoticeHandler.class.php @@ -19,7 +19,7 @@ class NoticeHandler extends SingletonFactory { * list with all enabled notices * @var Notice[] */ - protected $notices = array(); + protected $notices = []; /** * @see \wcf\system\SingletonFacetory::init() @@ -34,7 +34,7 @@ class NoticeHandler extends SingletonFactory { * @return Notice[] */ public function getVisibleNotices() { - $notices = array(); + $notices = []; foreach ($this->notices as $notice) { if ($notice->isDismissed()) continue; diff --git a/wcfsetup/install/files/lib/system/option/AbstractCategoryMultiSelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/AbstractCategoryMultiSelectOptionType.class.php index 3ffcb34023..454f1bc989 100644 --- a/wcfsetup/install/files/lib/system/option/AbstractCategoryMultiSelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/AbstractCategoryMultiSelectOptionType.class.php @@ -37,11 +37,11 @@ abstract class AbstractCategoryMultiSelectOptionType extends AbstractOptionType $categoryList = $categoryTree->getIterator(); $categoryList->setMaxDepth(0); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'categoryList' => $categoryList, 'option' => $option, 'value' => (!is_array($value) ? explode("\n", $value) : $value) - )); + ]); return WCF::getTPL()->fetch('categoryMultiSelectOptionType'); } @@ -49,7 +49,7 @@ abstract class AbstractCategoryMultiSelectOptionType extends AbstractOptionType * @see \wcf\system\option\IOptionType::validate() */ public function validate(Option $option, $newValue) { - if (!is_array($newValue)) $newValue = array(); + if (!is_array($newValue)) $newValue = []; $newValue = ArrayUtil::toIntegerArray($newValue); foreach ($newValue as $categoryID) { @@ -63,7 +63,7 @@ abstract class AbstractCategoryMultiSelectOptionType extends AbstractOptionType * @see \wcf\system\option\IOptionType::getData() */ public function getData(Option $option, $newValue) { - if (!is_array($newValue)) $newValue = array(); + if (!is_array($newValue)) $newValue = []; return implode("\n", ArrayUtil::toIntegerArray($newValue)); } } diff --git a/wcfsetup/install/files/lib/system/option/BirthdayOptionType.class.php b/wcfsetup/install/files/lib/system/option/BirthdayOptionType.class.php index 7c7ee1367d..37ae8d5235 100644 --- a/wcfsetup/install/files/lib/system/option/BirthdayOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/BirthdayOptionType.class.php @@ -62,11 +62,11 @@ class BirthdayOptionType extends DateOptionType { if (!empty($value['ageFrom'])) $ageFrom = intval($value['ageFrom']); if (!empty($value['ageTo'])) $ageTo = intval($value['ageTo']); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'valueAgeFrom' => $ageFrom, 'valueAgeTo' => $ageTo - )); + ]); return WCF::getTPL()->fetch('birthdaySearchableOptionType'); } @@ -84,16 +84,16 @@ class BirthdayOptionType extends DateOptionType { $dateFrom = DateUtil::getDateTimeByTimestamp(TIME_NOW)->sub(new \DateInterval('P'.($ageTo + 1).'Y'))->add(new \DateInterval('P1D')); $dateTo = DateUtil::getDateTimeByTimestamp(TIME_NOW)->sub(new \DateInterval('P'.$ageFrom.'Y')); - $conditions->add('option_value.userOption'.User::getUserOptionID('birthdayShowYear').' = ?', array(1)); + $conditions->add('option_value.userOption'.User::getUserOptionID('birthdayShowYear').' = ?', [1]); if ($ageFrom && $ageTo) { - $conditions->add('option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', array($dateFrom->format('Y-m-d'), $dateTo->format('Y-m-d'))); + $conditions->add('option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', [$dateFrom->format('Y-m-d'), $dateTo->format('Y-m-d')]); } else if ($ageFrom) { - $conditions->add('option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', array('1893-01-01', $dateTo->format('Y-m-d'))); + $conditions->add('option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', ['1893-01-01', $dateTo->format('Y-m-d')]); } else { - $conditions->add('option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', array($dateFrom->format('Y-m-d'), DateUtil::getDateTimeByTimestamp(TIME_NOW)->add(new \DateInterval('P1D'))->format('Y-m-d'))); + $conditions->add('option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', [$dateFrom->format('Y-m-d'), DateUtil::getDateTimeByTimestamp(TIME_NOW)->add(new \DateInterval('P1D'))->format('Y-m-d')]); } return true; @@ -111,16 +111,16 @@ class BirthdayOptionType extends DateOptionType { $dateFrom = DateUtil::getDateTimeByTimestamp(TIME_NOW)->sub(new \DateInterval('P'.($ageTo + 1).'Y'))->add(new \DateInterval('P1D')); $dateTo = DateUtil::getDateTimeByTimestamp(TIME_NOW)->sub(new \DateInterval('P'.$ageFrom.'Y')); - $userList->getConditionBuilder()->add('user_option_value.userOption'.User::getUserOptionID('birthdayShowYear').' = ?', array(1)); + $userList->getConditionBuilder()->add('user_option_value.userOption'.User::getUserOptionID('birthdayShowYear').' = ?', [1]); if ($ageFrom && $ageTo) { - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', array($dateFrom->format('Y-m-d'), $dateTo->format('Y-m-d'))); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', [$dateFrom->format('Y-m-d'), $dateTo->format('Y-m-d')]); } else if ($ageFrom) { - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', array('1893-01-01', $dateTo->format('Y-m-d'))); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', ['1893-01-01', $dateTo->format('Y-m-d')]); } else { - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', array($dateFrom->format('Y-m-d'), DateUtil::getDateTimeByTimestamp(TIME_NOW)->add(new \DateInterval('P1D'))->format('Y-m-d'))); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' BETWEEN DATE(?) AND DATE(?)', [$dateFrom->format('Y-m-d'), DateUtil::getDateTimeByTimestamp(TIME_NOW)->add(new \DateInterval('P1D'))->format('Y-m-d')]); } } diff --git a/wcfsetup/install/files/lib/system/option/BooleanOptionType.class.php b/wcfsetup/install/files/lib/system/option/BooleanOptionType.class.php index 923406c004..579a45bd93 100644 --- a/wcfsetup/install/files/lib/system/option/BooleanOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/BooleanOptionType.class.php @@ -23,12 +23,12 @@ class BooleanOptionType extends AbstractOptionType implements ISearchableUserOpt public function getFormElement(Option $option, $value) { $options = Option::parseEnableOptions($option->enableOptions); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('booleanOptionType'); } @@ -54,7 +54,7 @@ class BooleanOptionType extends AbstractOptionType implements ISearchableUserOpt $value = intval($value); if (!$value) return false; - $conditions->add("option_value.userOption".$option->optionID." = ?", array(1)); + $conditions->add("option_value.userOption".$option->optionID." = ?", [1]); return true; } @@ -65,7 +65,7 @@ class BooleanOptionType extends AbstractOptionType implements ISearchableUserOpt $value = intval($value); if (!$value) return; - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' = ?', array(1)); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' = ?', [1]); } /** diff --git a/wcfsetup/install/files/lib/system/option/CaptchaSelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/CaptchaSelectOptionType.class.php index f3d88e55ad..f17308b411 100644 --- a/wcfsetup/install/files/lib/system/option/CaptchaSelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/CaptchaSelectOptionType.class.php @@ -23,18 +23,18 @@ class CaptchaSelectOptionType extends AbstractOptionType { $selectOptions = CaptchaHandler::getInstance()->getCaptchaSelection(); if ($option->allowemptyvalue) { $selectOptions = array_merge( - array( + [ '' => WCF::getLanguage()->get('wcf.captcha.useNoCaptcha') - ), + ], $selectOptions ); } - return WCF::getTPL()->fetch('selectOptionType', 'wcf', array( + return WCF::getTPL()->fetch('selectOptionType', 'wcf', [ 'selectOptions' => $selectOptions, 'option' => $option, 'value' => $value - )); + ]); } /** diff --git a/wcfsetup/install/files/lib/system/option/FileOptionType.class.php b/wcfsetup/install/files/lib/system/option/FileOptionType.class.php index 8eaab3080e..78e5e27db8 100644 --- a/wcfsetup/install/files/lib/system/option/FileOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/FileOptionType.class.php @@ -24,7 +24,7 @@ class FileOptionType extends AbstractOptionType { * upload handler for option files * @var UploadHandler[] */ - protected $uploadHandlers = array(); + protected $uploadHandlers = []; /** * Creates the upload handler for the given option. @@ -81,10 +81,10 @@ class FileOptionType extends AbstractOptionType { * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('fileOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/IntegerOptionType.class.php b/wcfsetup/install/files/lib/system/option/IntegerOptionType.class.php index 51ab66551c..348879f33c 100644 --- a/wcfsetup/install/files/lib/system/option/IntegerOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/IntegerOptionType.class.php @@ -24,11 +24,11 @@ class IntegerOptionType extends TextOptionType { * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'inputClass' => $this->inputClass, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('integerOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/MessageOptionType.class.php b/wcfsetup/install/files/lib/system/option/MessageOptionType.class.php index 2ccbcbbb00..2ff7c0e4e3 100644 --- a/wcfsetup/install/files/lib/system/option/MessageOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/MessageOptionType.class.php @@ -34,7 +34,7 @@ class MessageOptionType extends TextareaOptionType { * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - $allowedBBCodes = array(); + $allowedBBCodes = []; if ($option->allowedbbcodepermission) { $allowedBBCodes = explode(',', WCF::getSession()->getPermission($option->allowedbbcodepermission)); } @@ -43,11 +43,11 @@ class MessageOptionType extends TextareaOptionType { } BBCodeHandler::getInstance()->setAllowedBBCodes($allowedBBCodes); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(), 'option' => $option, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('messageOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php index 61a41a1194..9d3835543b 100644 --- a/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/MultiSelectOptionType.class.php @@ -35,11 +35,11 @@ class MultiSelectOptionType extends SelectOptionType { * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'selectOptions' => $this->getSelectOptions($option), 'value' => (!is_array($value) ? explode("\n", $value) : $value) - )); + ]); return WCF::getTPL()->fetch($this->formElementTemplate); } @@ -47,12 +47,12 @@ class MultiSelectOptionType extends SelectOptionType { * @see \wcf\system\option\ISearchableUserOption::getSearchFormElement() */ public function getSearchFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'searchOption' => $value !== null && ($value !== $option->defaultValue || isset($_POST['searchOptions'][$option->optionName])), 'selectOptions' => $this->getSelectOptions($option), 'value' => (!is_array($value) ? explode("\n", $value) : $value) - )); + ]); return WCF::getTPL()->fetch($this->searchableFormElementTemplate); } @@ -60,7 +60,7 @@ class MultiSelectOptionType extends SelectOptionType { * @see \wcf\system\option\IOptionType::validate() */ public function validate(Option $option, $newValue) { - if (!is_array($newValue)) $newValue = array(); + if (!is_array($newValue)) $newValue = []; $options = $this->getSelectOptions($option); foreach ($newValue as $value) { if (!isset($options[$value])) { @@ -73,7 +73,7 @@ class MultiSelectOptionType extends SelectOptionType { * @see \wcf\system\option\IOptionType::getData() */ public function getData(Option $option, $newValue) { - if (!is_array($newValue)) $newValue = array(); + if (!is_array($newValue)) $newValue = []; return implode("\n", $newValue); } diff --git a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php index 34f50ca548..4e67813ee4 100644 --- a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php @@ -66,13 +66,13 @@ class OptionHandler implements IOptionHandler { * options of the active category * @var Option[] */ - public $options = array(); + public $options = []; /** * type object cache * @var IOptionType[] */ - public $typeObjects = array(); + public $typeObjects = []; /** * language item pattern @@ -84,13 +84,13 @@ class OptionHandler implements IOptionHandler { * option values * @var mixed[] */ - public $optionValues = array(); + public $optionValues = []; /** * raw option values * @var mixed[] */ - public $rawValues = array(); + public $rawValues = []; /** * true, if options support i18n @@ -137,7 +137,7 @@ class OptionHandler implements IOptionHandler { * @see \wcf\system\option\IOptionHandler::validate() */ public function validate() { - $errors = array(); + $errors = []; foreach ($this->options as $option) { try { @@ -155,17 +155,17 @@ class OptionHandler implements IOptionHandler { * @see \wcf\system\option\IOptionHandler::getOptionTree() */ public function getOptionTree($parentCategoryName = '', $level = 0) { - $tree = array(); + $tree = []; if (isset($this->cachedCategoryStructure[$parentCategoryName])) { // get super categories foreach ($this->cachedCategoryStructure[$parentCategoryName] as $superCategoryName) { $superCategoryObject = $this->cachedCategories[$superCategoryName]; - $superCategory = array( + $superCategory = [ 'object' => $superCategoryObject, - 'categories' => array(), - 'options' => array() - ); + 'categories' => [], + 'options' => [] + ]; if ($this->checkCategory($superCategoryObject)) { if ($level <= 1) { @@ -193,7 +193,7 @@ class OptionHandler implements IOptionHandler { * @see \wcf\system\option\IOptionHandler::getCategoryOptions() */ public function getCategoryOptions($categoryName = '', $inherit = true) { - $children = array(); + $children = []; // get sub categories if ($inherit && isset($this->cachedCategoryStructure[$categoryName])) { @@ -236,7 +236,7 @@ class OptionHandler implements IOptionHandler { * @see \wcf\system\option\IOptionHandler::save() */ public function save($categoryName = null, $optionPrefix = null) { - $saveOptions = array(); + $saveOptions = []; if ($this->supportI18n && ($categoryName === null || $optionPrefix === null)) { throw new SystemException("category name or option prefix missing"); @@ -275,12 +275,12 @@ class OptionHandler implements IOptionHandler { // get form element html $html = $this->getFormElement($option->optionType, $option); - return array( + return [ 'object' => $option, 'html' => $html, 'cssClassName' => $this->getTypeObject($option->optionType)->getCSSClassName(), 'hideLabelInSearch' => $this->getTypeObject($option->optionType)->hideLabelInSearch() - ); + ]; } /** @@ -356,7 +356,7 @@ class OptionHandler implements IOptionHandler { } else { if ($this->abbreviations === null) { - $this->abbreviations = array(); + $this->abbreviations = []; $applications = ApplicationHandler::getInstance()->getApplications(); foreach ($applications as $application) { @@ -389,13 +389,13 @@ class OptionHandler implements IOptionHandler { * Gets all options and option categories from cache. */ protected function readCache() { - $cache = call_user_func(array($this->cacheClass, 'getInstance')); + $cache = call_user_func([$this->cacheClass, 'getInstance']); // get cache contents - $this->cachedCategories = $cache->getData(array(), 'categories'); - $this->cachedOptions = $cache->getData(array(), 'options'); - $this->cachedCategoryStructure = $cache->getData(array(), 'categoryStructure'); - $this->cachedOptionToCategories = $cache->getData(array(), 'optionToCategories'); + $this->cachedCategories = $cache->getData([], 'categories'); + $this->cachedOptions = $cache->getData([], 'options'); + $this->cachedCategoryStructure = $cache->getData([], 'categoryStructure'); + $this->cachedOptionToCategories = $cache->getData([], 'optionToCategories'); // allow option manipulation EventHandler::getInstance()->fireAction($this, 'afterReadCache'); diff --git a/wcfsetup/install/files/lib/system/option/PaymentMethodSelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/PaymentMethodSelectOptionType.class.php index 559c48c6fa..97a76f67ba 100644 --- a/wcfsetup/install/files/lib/system/option/PaymentMethodSelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/PaymentMethodSelectOptionType.class.php @@ -22,11 +22,11 @@ class PaymentMethodSelectOptionType extends AbstractOptionType { public function getFormElement(Option $option, $value) { $selectOptions = PaymentMethodHandler::getInstance()->getPaymentMethodSelection(); - return WCF::getTPL()->fetch('paymentMethodSelectOptionType', 'wcf', array( + return WCF::getTPL()->fetch('paymentMethodSelectOptionType', 'wcf', [ 'selectOptions' => $selectOptions, 'option' => $option, 'value' => explode(',', $value) - )); + ]); } /** @@ -34,7 +34,7 @@ class PaymentMethodSelectOptionType extends AbstractOptionType { */ public function validate(Option $option, $newValue) { if (!is_array($newValue)) { - $newValue = array(); + $newValue = []; } $selectOptions = PaymentMethodHandler::getInstance()->getPaymentMethodSelection(); diff --git a/wcfsetup/install/files/lib/system/option/RadioButtonOptionType.class.php b/wcfsetup/install/files/lib/system/option/RadioButtonOptionType.class.php index 1e22d16ed6..8923eedc90 100644 --- a/wcfsetup/install/files/lib/system/option/RadioButtonOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/RadioButtonOptionType.class.php @@ -30,10 +30,10 @@ class RadioButtonOptionType extends AbstractOptionType implements ISearchableCon */ public function getFormElement(Option $option, $value) { $availableOptions = $option->parseMultipleEnableOptions(); - $options = array( - 'disableOptions' => array(), - 'enableOptions' => array() - ); + $options = [ + 'disableOptions' => [], + 'enableOptions' => [] + ]; foreach ($availableOptions as $key => $enableOptions) { $optionData = Option::parseEnableOptions($enableOptions); @@ -42,13 +42,13 @@ class RadioButtonOptionType extends AbstractOptionType implements ISearchableCon $options['enableOptions'][$key] = $optionData['enableOptions']; } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'selectOptions' => $this->getSelectOptions($option), 'value' => $value - )); + ]); return WCF::getTPL()->fetch($this->templateName); } @@ -80,7 +80,7 @@ class RadioButtonOptionType extends AbstractOptionType implements ISearchableCon public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value) { if (!isset($_POST['searchOptions'][$option->optionName])) return false; - $conditions->add("option_value.userOption".$option->optionID." = ?", array(StringUtil::trim($value))); + $conditions->add("option_value.userOption".$option->optionID." = ?", [StringUtil::trim($value)]); return true; } @@ -88,7 +88,7 @@ class RadioButtonOptionType extends AbstractOptionType implements ISearchableCon * @inheritDoc */ public function addCondition(UserList $userList, Option $option, $value) { - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' = ?', array(StringUtil::trim($value))); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' = ?', [StringUtil::trim($value)]); } /** diff --git a/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php index 58c4ec49cc..84ee147be3 100644 --- a/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php @@ -22,14 +22,14 @@ class SelectOptionType extends RadioButtonOptionType { public function getFormElement(Option $option, $value) { $options = $this->parseEnableOptions($option); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'selectOptions' => $this->getSelectOptions($option), 'value' => $value, 'allowEmptyValue' => ($this->allowEmptyValue || $option->allowEmptyValue) - )); + ]); return WCF::getTPL()->fetch('selectOptionType'); } @@ -39,14 +39,14 @@ class SelectOptionType extends RadioButtonOptionType { public function getSearchFormElement(Option $option, $value) { $options = $this->parseEnableOptions($option); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'disableOptions' => $options['disableOptions'], 'enableOptions' => $options['enableOptions'], 'option' => $option, 'searchOption' => ($value !== null && $value !== $option->defaultValue) || isset($_POST['searchOptions'][$option->optionName]), 'selectOptions' => $this->getSelectOptions($option), 'value' => $value - )); + ]); return WCF::getTPL()->fetch('selectSearchableOptionType'); } @@ -78,10 +78,10 @@ class SelectOptionType extends RadioButtonOptionType { } } - return array( + return [ 'disableOptions' => $disableOptions, 'enableOptions' => $enableOptions - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php index 8b90e4e0b0..ad4c5979c9 100644 --- a/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php @@ -27,11 +27,11 @@ class TextI18nOptionType extends TextOptionType { public function getFormElement(Option $option, $value) { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'inputType' => $this->inputType, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textI18nOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/TextOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextOptionType.class.php index 8cb9216a03..34c01fb064 100644 --- a/wcfsetup/install/files/lib/system/option/TextOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextOptionType.class.php @@ -35,12 +35,12 @@ class TextOptionType extends AbstractOptionType implements ISearchableConditionU * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'inputType' => $this->inputType, 'inputClass' => $this->inputClass, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textOptionType'); } @@ -48,13 +48,13 @@ class TextOptionType extends AbstractOptionType implements ISearchableConditionU * @see \wcf\system\option\ISearchableUserOption::getSearchFormElement() */ public function getSearchFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'inputType' => $this->inputType, 'inputClass' => $this->inputClass, 'searchOption' => $value !== null && ($value !== $option->defaultValue || isset($_POST['searchOptions'][$option->optionName])), 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textSearchableOptionType'); } @@ -66,10 +66,10 @@ class TextOptionType extends AbstractOptionType implements ISearchableConditionU $value = StringUtil::trim($value); if ($value == '') { - $conditions->add("option_value.userOption".$option->optionID." = ?", array('')); + $conditions->add("option_value.userOption".$option->optionID." = ?", ['']); } else { - $conditions->add("option_value.userOption".$option->optionID." LIKE ?", array('%'.addcslashes($value, '_%').'%')); + $conditions->add("option_value.userOption".$option->optionID." LIKE ?", ['%'.addcslashes($value, '_%').'%']); } return true; @@ -120,10 +120,10 @@ class TextOptionType extends AbstractOptionType implements ISearchableConditionU public function addCondition(UserList $userList, Option $option, $value) { $value = StringUtil::trim($value); if ($value == '') { - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' = ?', array('')); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' = ?', ['']); } else { - $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' LIKE ?', array('%'.addcslashes($value, '_%').'%')); + $userList->getConditionBuilder()->add('user_option_value.userOption'.$option->optionID.' LIKE ?', ['%'.addcslashes($value, '_%').'%']); } } diff --git a/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php index 058dd5a7d0..0a1b613f0b 100644 --- a/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php @@ -27,10 +27,10 @@ class TextareaI18nOptionType extends TextareaOptionType { public function getFormElement(Option $option, $value) { I18nHandler::getInstance()->assignVariables(!empty($_POST)); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textareaI18nOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/TextareaIpAddressOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextareaIpAddressOptionType.class.php index 66c3fedfee..c9a98e7fc5 100644 --- a/wcfsetup/install/files/lib/system/option/TextareaIpAddressOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextareaIpAddressOptionType.class.php @@ -33,10 +33,10 @@ class TextareaIpAddressOptionType extends TextOptionType { $value = implode("\n", $ips); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textareaOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/TextareaOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextareaOptionType.class.php index 2dc9742820..6d4d2eb14e 100644 --- a/wcfsetup/install/files/lib/system/option/TextareaOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextareaOptionType.class.php @@ -19,10 +19,10 @@ class TextareaOptionType extends TextOptionType { * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textareaOptionType'); } @@ -30,11 +30,11 @@ class TextareaOptionType extends TextOptionType { * @see \wcf\system\option\ISearchableUserOption::getSearchFormElement() */ public function getSearchFormElement(Option $option, $value) { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'searchOption' => $value !== null && ($value !== $option->defaultValue || isset($_POST['searchOptions'][$option->optionName])), 'value' => $value - )); + ]); return WCF::getTPL()->fetch('textareaSearchableOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/TimezoneOptionType.class.php b/wcfsetup/install/files/lib/system/option/TimezoneOptionType.class.php index c0bc67febb..bcace59e82 100644 --- a/wcfsetup/install/files/lib/system/option/TimezoneOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TimezoneOptionType.class.php @@ -20,16 +20,16 @@ class TimezoneOptionType extends AbstractOptionType { * @see \wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - $timezoneOptions = array(); + $timezoneOptions = []; foreach (DateUtil::getAvailableTimezones() as $timezone) { $timezoneOptions[$timezone] = WCF::getLanguage()->get('wcf.date.timezone.'.str_replace('/', '.', strtolower($timezone))); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'selectOptions' => $timezoneOptions, 'value' => ($value ?: TIMEZONE) - )); + ]); return WCF::getTPL()->fetch('selectOptionType'); } diff --git a/wcfsetup/install/files/lib/system/option/user/DateUserOptionOutput.class.php b/wcfsetup/install/files/lib/system/option/user/DateUserOptionOutput.class.php index f9248e00e6..f19c0cc8f7 100644 --- a/wcfsetup/install/files/lib/system/option/user/DateUserOptionOutput.class.php +++ b/wcfsetup/install/files/lib/system/option/user/DateUserOptionOutput.class.php @@ -44,6 +44,6 @@ class DateUserOptionOutput implements IUserOptionOutput { if (isset($optionValue[1])) $month = intval($optionValue[1]); if (isset($optionValue[2])) $day = intval($optionValue[2]); - return array('year' => $year, 'month' => $month, 'day' => $day); + return ['year' => $year, 'month' => $month, 'day' => $day]; } } diff --git a/wcfsetup/install/files/lib/system/option/user/MessageUserOptionOutput.class.php b/wcfsetup/install/files/lib/system/option/user/MessageUserOptionOutput.class.php index 28d98dd722..810ccdbda2 100644 --- a/wcfsetup/install/files/lib/system/option/user/MessageUserOptionOutput.class.php +++ b/wcfsetup/install/files/lib/system/option/user/MessageUserOptionOutput.class.php @@ -28,10 +28,10 @@ class MessageUserOptionOutput implements IUserOptionOutput { MessageParser::getInstance()->setOutputType('text/html'); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'option' => $option, 'value' => MessageParser::getInstance()->parse($value), - )); + ]); return WCF::getTPL()->fetch('messageUserOptionOutput'); } } diff --git a/wcfsetup/install/files/lib/system/option/user/SelectOptionsUserOptionOutput.class.php b/wcfsetup/install/files/lib/system/option/user/SelectOptionsUserOptionOutput.class.php index cbbae396ea..eaae0fbb57 100644 --- a/wcfsetup/install/files/lib/system/option/user/SelectOptionsUserOptionOutput.class.php +++ b/wcfsetup/install/files/lib/system/option/user/SelectOptionsUserOptionOutput.class.php @@ -51,7 +51,7 @@ class SelectOptionsUserOptionOutput implements IUserOptionOutput { // multiselect if (mb_strpos($value, "\n") !== false) { $values = explode("\n", $value); - $result = array(); + $result = []; foreach ($values as $value) { if (isset($options[$value])) { $result[] = $options[$value]; diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index fb7d581223..4976da3b81 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -105,7 +105,7 @@ class UserOptionHandler extends OptionHandler { * @param \wcf\data\user\User $user */ public function setUser(User $user) { - $this->optionValues = array(); + $this->optionValues = []; $this->user = $user; $this->init(); @@ -119,7 +119,7 @@ class UserOptionHandler extends OptionHandler { * Resets the option values. */ public function resetOptionValues() { - $this->optionValues = array(); + $this->optionValues = []; } /** diff --git a/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php index 9b9349cfc8..5f9be16388 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php @@ -29,7 +29,7 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse */ public function getData(Option $option, $newValue) { if (!is_array($newValue)) { - $newValue = array(); + $newValue = []; } return implode(',', $newValue); @@ -43,7 +43,7 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse $this->loadBBCodeSelection(); } - $selectedBBCodes = array(); + $selectedBBCodes = []; if ($value == 'all') { $selectedBBCodes = $this->bbCodes; } @@ -51,11 +51,11 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse $selectedBBCodes = explode(',', $value); } - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'bbCodes' => $this->bbCodes, 'option' => $option, 'selectedBBCodes' => $selectedBBCodes - )); + ]); return WCF::getTPL()->fetch('bbCodeSelectOptionType'); } @@ -82,7 +82,7 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse $defaultValue = $this->bbCodes; } else if (empty($defaultValue) || $defaultValue == 'none') { - $defaultValue = array(); + $defaultValue = []; } else { $defaultValue = explode(',', StringUtil::unifyNewlines($defaultValue)); @@ -91,7 +91,7 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse $groupValue = $this->bbCodes; } else if (empty($groupValue) || $groupValue == 'none') { - $groupValue = array(); + $groupValue = []; } else { $groupValue = explode(',', StringUtil::unifyNewlines($groupValue)); @@ -108,7 +108,7 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse */ public function validate(Option $option, $newValue) { if (!is_array($newValue)) { - $newValue = array(); + $newValue = []; } if ($this->bbCodes === null) { diff --git a/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php index b2db2e2910..43b9cdc857 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php @@ -23,8 +23,8 @@ class TextUserGroupOptionType extends TextOptionType implements IUserGroupOption * @see \wcf\system\option\user\group\IUserGroupOptionType::merge() */ public function merge($defaultValue, $groupValue) { - $defaultValue = empty($defaultValue) ? array() : explode("\n", StringUtil::unifyNewlines($defaultValue)); - $groupValue = empty($groupValue) ? array() : explode("\n", StringUtil::unifyNewlines($groupValue)); + $defaultValue = empty($defaultValue) ? [] : explode("\n", StringUtil::unifyNewlines($defaultValue)); + $groupValue = empty($groupValue) ? [] : explode("\n", StringUtil::unifyNewlines($groupValue)); return implode("\n", array_unique(array_merge($defaultValue, $groupValue))); } diff --git a/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php index 230e3e6c68..90091cc4df 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php @@ -20,8 +20,8 @@ class TextareaUserGroupOptionType extends TextareaOptionType implements IUserGro * @see \wcf\system\option\user\group\IUserGroupOptionType::merge() */ public function merge($defaultValue, $groupValue) { - $defaultValue = empty($defaultValue) ? array() : explode("\n", StringUtil::unifyNewlines($defaultValue)); - $groupValue = empty($groupValue) ? array() : explode("\n", StringUtil::unifyNewlines($groupValue)); + $defaultValue = empty($defaultValue) ? [] : explode("\n", StringUtil::unifyNewlines($defaultValue)); + $groupValue = empty($groupValue) ? [] : explode("\n", StringUtil::unifyNewlines($groupValue)); return implode("\n", array_unique(array_merge($defaultValue, $groupValue))); } diff --git a/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php index 4c5ba1c4ea..223a7b5f1f 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php @@ -45,7 +45,7 @@ class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserG $groups = UserGroup::getGroupsByType(); // get new value - if (!is_array($newValue)) $newValue = array(); + if (!is_array($newValue)) $newValue = []; $selectedGroups = ArrayUtil::toIntegerArray($newValue); // check groups @@ -60,7 +60,7 @@ class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserG * @see \wcf\system\option\IOptionType::getData() */ public function getData(Option $option, $newValue) { - if (!is_array($newValue)) $newValue = array(); + if (!is_array($newValue)) $newValue = []; $newValue = ArrayUtil::toIntegerArray($newValue); sort($newValue, SORT_NUMERIC); return implode(',', $newValue); @@ -70,8 +70,8 @@ class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserG * @see \wcf\system\option\user\group\IUserGroupOptionType::merge() */ public function merge($defaultValue, $groupValue) { - $defaultValue = empty($defaultValue) ? array() : explode(',', StringUtil::unifyNewlines($defaultValue)); - $groupValue = empty($groupValue) ? array() : explode(',', StringUtil::unifyNewlines($groupValue)); + $defaultValue = empty($defaultValue) ? [] : explode(',', StringUtil::unifyNewlines($defaultValue)); + $groupValue = empty($groupValue) ? [] : explode(',', StringUtil::unifyNewlines($groupValue)); return implode(',', array_unique(array_merge($defaultValue, $groupValue))); } @@ -80,8 +80,8 @@ class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserG * @see \wcf\system\option\IOptionType::compare() */ public function compare($value1, $value2) { - $value1 = ($value1) ? explode(',', $value1) : array(); - $value2 = ($value2) ? explode(',', $value2) : array(); + $value1 = ($value1) ? explode(',', $value1) : []; + $value2 = ($value2) ? explode(',', $value2) : []; // check if value1 contains more elements than value2 $diff = array_diff($value1, $value2); diff --git a/wcfsetup/install/files/lib/system/package/ACPTemplatesFileHandler.class.php b/wcfsetup/install/files/lib/system/package/ACPTemplatesFileHandler.class.php index b62d9ae301..635f1e81f2 100644 --- a/wcfsetup/install/files/lib/system/package/ACPTemplatesFileHandler.class.php +++ b/wcfsetup/install/files/lib/system/package/ACPTemplatesFileHandler.class.php @@ -42,9 +42,9 @@ class ACPTemplatesFileHandler extends PackageInstallationFileHandler { // get by other packages registered files $conditions = new PreparedStatementConditionBuilder(); - $conditions->add('packageID <> ?', array($this->packageInstallation->getPackageID())); - $conditions->add('templateName IN (?)', array($files)); - $conditions->add('application = ?', array($this->application)); + $conditions->add('packageID <> ?', [$this->packageInstallation->getPackageID()]); + $conditions->add('templateName IN (?)', [$files]); + $conditions->add('application = ?', [$this->application]); if ($this->supportsTemplateGroups) { $conditions->add("templateGroupID IS NULL"); } @@ -55,7 +55,7 @@ class ACPTemplatesFileHandler extends PackageInstallationFileHandler { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $lockedFiles = array(); + $lockedFiles = []; while ($row = $statement->fetchArray()) { $lockedFiles[$row['templateName']] = $row['packageID']; } @@ -88,9 +88,9 @@ class ACPTemplatesFileHandler extends PackageInstallationFileHandler { // fetch already installed acp templates $conditions = new PreparedStatementConditionBuilder(); - $conditions->add('packageID = ?', array($this->packageInstallation->getPackageID())); - $conditions->add('templateName IN (?)', array($files)); - $conditions->add('application = ?', array($this->application)); + $conditions->add('packageID = ?', [$this->packageInstallation->getPackageID()]); + $conditions->add('templateName IN (?)', [$files]); + $conditions->add('application = ?', [$this->application]); $sql = "SELECT templateName FROM wcf".WCF_N."_".$this->tableName." @@ -113,11 +113,11 @@ class ACPTemplatesFileHandler extends PackageInstallationFileHandler { $statement = WCF::getDB()->prepareStatement($sql); foreach ($files as $file) { - $statement->execute(array( + $statement->execute([ $this->packageInstallation->getPackageID(), $file, $this->application - )); + ]); } } } diff --git a/wcfsetup/install/files/lib/system/package/FilesFileHandler.class.php b/wcfsetup/install/files/lib/system/package/FilesFileHandler.class.php index 8aff4e9d9d..4ae31239ba 100644 --- a/wcfsetup/install/files/lib/system/package/FilesFileHandler.class.php +++ b/wcfsetup/install/files/lib/system/package/FilesFileHandler.class.php @@ -25,16 +25,16 @@ class FilesFileHandler extends PackageInstallationFileHandler { // get registered files of other packages for the // same application $conditions = new PreparedStatementConditionBuilder(); - $conditions->add('packageID <> ?', array($this->packageInstallation->getPackageID())); - $conditions->add('filename IN (?)', array($files)); - $conditions->add('application = ?', array($this->application)); + $conditions->add('packageID <> ?', [$this->packageInstallation->getPackageID()]); + $conditions->add('filename IN (?)', [$files]); + $conditions->add('application = ?', [$this->application]); $sql = "SELECT filename, packageID FROM wcf".WCF_N."_package_installation_file_log ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $lockedFiles = array(); + $lockedFiles = []; while ($row = $statement->fetchArray()) { $lockedFiles[$row['filename']] = $row['packageID']; } @@ -68,11 +68,11 @@ class FilesFileHandler extends PackageInstallationFileHandler { WCF::getDB()->beginTransaction(); foreach ($files as $file) { - $statement->execute(array( + $statement->execute([ $this->packageInstallation->getPackageID(), $file, $this->application - )); + ]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index d04325dd61..5b8784140b 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -42,46 +42,46 @@ class PackageArchive { * general package information * @var array */ - protected $packageInfo = array(); + protected $packageInfo = []; /** * author information * @var array */ - protected $authorInfo = array(); + protected $authorInfo = []; /** * list of requirements * @var array */ - protected $requirements = array(); + protected $requirements = []; /** * list of optional packages * @var array */ - protected $optionals = array(); + protected $optionals = []; /** * list of excluded packages * @var array */ - protected $excludedPackages = array(); + protected $excludedPackages = []; /** * list of instructions * @var mixed[][] */ - protected $instructions = array( - 'install' => array(), - 'update' => array() - ); + protected $instructions = [ + 'install' => [], + 'update' => [] + ]; /** * list of php requirements * @var mixed[][] */ - protected $phpRequirements = array(); + protected $phpRequirements = []; /** * default name of the package.xml file @@ -134,7 +134,7 @@ class PackageArchive { public function openArchive() { // check whether archive exists and is a TAR archive if (!file_exists($this->archive)) { - throw new PackageValidationException(PackageValidationException::FILE_NOT_FOUND, array('archive' => $this->archive)); + throw new PackageValidationException(PackageValidationException::FILE_NOT_FOUND, ['archive' => $this->archive]); } // open archive and read package information @@ -149,7 +149,7 @@ class PackageArchive { // search package.xml in package archive // throw error message if not found if ($this->tar->getIndexByFilename(self::INFO_FILE) === false) { - throw new PackageValidationException(PackageValidationException::MISSING_PACKAGE_XML, array('archive' => $this->archive)); + throw new PackageValidationException(PackageValidationException::MISSING_PACKAGE_XML, ['archive' => $this->archive]); } // extract package.xml, parse XML @@ -171,7 +171,7 @@ class PackageArchive { $packageName = $package->getAttribute('name'); if (!Package::isValidPackageName($packageName)) { // package name is not a valid package identifier - throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, array('packageName' => $packageName)); + throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, ['packageName' => $packageName]); } $this->packageInfo['name'] = $packageName; @@ -186,7 +186,7 @@ class PackageArchive { case 'packagedescription': case 'readme': case 'license': - if (!isset($this->packageInfo[$element->tagName])) $this->packageInfo[$element->tagName] = array(); + if (!isset($this->packageInfo[$element->tagName])) $this->packageInfo[$element->tagName] = []; $languageCode = 'default'; if ($element->hasAttribute('language')) { @@ -217,7 +217,7 @@ class PackageArchive { case 'version': if (!Package::isValidVersion($element->nodeValue)) { - throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_VERSION, array('packageVersion' => $element->nodeValue)); + throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_VERSION, ['packageVersion' => $element->nodeValue]); } $this->packageInfo['version'] = $element->nodeValue; @@ -243,11 +243,11 @@ class PackageArchive { $elements = $xpath->query('child::ns:requiredpackages/ns:requiredpackage', $package); foreach ($elements as $element) { if (!Package::isValidPackageName($element->nodeValue)) { - throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, array('packageName' => $element->nodeValue)); + throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, ['packageName' => $element->nodeValue]); } // read attributes - $data = array('name' => $element->nodeValue); + $data = ['name' => $element->nodeValue]; $attributes = $xpath->query('attribute::*', $element); foreach ($attributes as $attribute) { $data[$attribute->name] = $attribute->value; @@ -260,11 +260,11 @@ class PackageArchive { $elements = $xpath->query('child::ns:optionalpackages/ns:optionalpackage', $package); foreach ($elements as $element) { if (!Package::isValidPackageName($element->nodeValue)) { - throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, array('packageName' => $element->nodeValue)); + throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, ['packageName' => $element->nodeValue]); } // read attributes - $data = array('name' => $element->nodeValue); + $data = ['name' => $element->nodeValue]; $attributes = $xpath->query('attribute::*', $element); foreach ($attributes as $attribute) { $data[$attribute->name] = $attribute->value; @@ -277,11 +277,11 @@ class PackageArchive { $elements = $xpath->query('child::ns:excludedpackages/ns:excludedpackage', $package); foreach ($elements as $element) { if (!Package::isValidPackageName($element->nodeValue)) { - throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, array('packageName' => $element->nodeValue)); + throw new PackageValidationException(PackageValidationException::INVALID_PACKAGE_NAME, ['packageName' => $element->nodeValue]); } // read attributes - $data = array('name' => $element->nodeValue); + $data = ['name' => $element->nodeValue]; $attributes = $xpath->query('attribute::*', $element); foreach ($attributes as $attribute) { $data[$attribute->name] = $attribute->value; @@ -293,21 +293,21 @@ class PackageArchive { // get instructions $elements = $xpath->query('./ns:instructions', $package); foreach ($elements as $element) { - $instructionData = array(); + $instructionData = []; $instructions = $xpath->query('./ns:instruction', $element); /** @var \DOMElement $instruction */ foreach ($instructions as $instruction) { - $data = array(); + $data = []; $attributes = $xpath->query('attribute::*', $instruction); foreach ($attributes as $attribute) { $data[$attribute->name] = $attribute->value; } - $instructionData[] = array( + $instructionData[] = [ 'attributes' => $data, 'pip' => $instruction->getAttribute('type'), 'value' => $instruction->nodeValue - ); + ]; } $fromVersion = $element->getAttribute('fromversion'); @@ -352,7 +352,7 @@ class PackageArchive { // add com.woltlab.wcf to package requirements if (!isset($this->requirements['com.woltlab.wcf']) && $this->packageInfo['name'] != 'com.woltlab.wcf') { - $this->requirements['com.woltlab.wcf'] = array('name' => 'com.woltlab.wcf'); + $this->requirements['com.woltlab.wcf'] = ['name' => 'com.woltlab.wcf']; } if ($this->package != null) { @@ -377,7 +377,7 @@ class PackageArchive { } if ($validFromVersion === null) { - $this->instructions['update'] = array(); + $this->instructions['update'] = []; } else { $this->instructions['update'] = $this->instructions['update'][$validFromVersion]; @@ -467,7 +467,7 @@ class PackageArchive { FROM wcf".WCF_N."_package WHERE package = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->packageInfo['name'])); + $statement->execute([$this->packageInfo['name']]); return $statement->fetchSingleColumn() > 0; } @@ -487,10 +487,10 @@ class PackageArchive { WHERE isApplication = ? AND package LIKE ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 1, '%.'.Package::getAbbreviation($this->packageInfo['name']) - )); + ]); return $statement->fetchSingleColumn() > 0; } @@ -590,8 +590,8 @@ class PackageArchive { * @return array */ public function getAllExistingRequirements() { - $existingRequirements = array(); - $existingPackages = array(); + $existingRequirements = []; + $existingPackages = []; if ($this->package !== null) { $sql = "SELECT package.* FROM wcf".WCF_N."_package_requirement requirement @@ -599,18 +599,18 @@ class PackageArchive { ON (package.packageID = requirement.requirement) WHERE requirement.packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->package->packageID)); + $statement->execute([$this->package->packageID]); while ($row = $statement->fetchArray()) { $existingRequirements[$row['package']] = $row; } } // build sql - $packageNames = array(); + $packageNames = []; $requirements = $this->getRequirements(); foreach ($requirements as $requirement) { if (isset($existingRequirements[$requirement['name']])) { - $existingPackages[$requirement['name']] = array(); + $existingPackages[$requirement['name']] = []; $existingPackages[$requirement['name']][$existingRequirements[$requirement['name']]['packageID']] = $existingRequirements[$requirement['name']]; } else { @@ -621,7 +621,7 @@ class PackageArchive { // check whether the required packages do already exist if (!empty($packageNames)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package.package IN (?)", array($packageNames)); + $conditions->add("package.package IN (?)", [$packageNames]); $sql = "SELECT package.* FROM wcf".WCF_N."_package package @@ -635,7 +635,7 @@ class PackageArchive { } if (!isset($existingPackages[$row['package']])) { - $existingPackages[$row['package']] = array(); + $existingPackages[$row['package']] = []; } $existingPackages[$row['package']][$row['packageID']] = $row; @@ -653,16 +653,16 @@ class PackageArchive { */ public function getExistingRequirements() { // build sql - $packageNames = array(); + $packageNames = []; foreach ($this->requirements as $requirement) { $packageNames[] = $requirement['name']; } // check whether the required packages do already exist - $existingPackages = array(); + $existingPackages = []; if (!empty($packageNames)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package IN (?)", array($packageNames)); + $conditions->add("package IN (?)", [$packageNames]); $sql = "SELECT * FROM wcf".WCF_N."_package @@ -671,7 +671,7 @@ class PackageArchive { $statement->execute($conditions->getParameters()); while ($row = $statement->fetchArray()) { if (!isset($existingPackages[$row['package']])) { - $existingPackages[$row['package']] = array(); + $existingPackages[$row['package']] = []; } $existingPackages[$row['package']][$row['packageVersion']] = $row; @@ -679,7 +679,7 @@ class PackageArchive { // sort multiple packages by version number foreach ($existingPackages as $packageName => $instances) { - uksort($instances, array('wcf\data\package\Package', 'compareVersion')); + uksort($instances, ['wcf\data\package\Package', 'compareVersion']); // get package with highest version number (get last package) $existingPackages[$packageName] = array_pop($instances); @@ -699,7 +699,7 @@ class PackageArchive { $existingPackages = $this->getExistingRequirements(); // check for open requirements - $openRequirements = array(); + $openRequirements = []; foreach ($this->requirements as $requirement) { if (isset($existingPackages[$requirement['name']])) { // package does already exist @@ -747,10 +747,10 @@ class PackageArchive { // search the requested tar archive in our package archive. // throw error message if not found. if (($fileIndex = $this->tar->getIndexByFilename($filename)) === false) { - throw new PackageValidationException(PackageValidationException::FILE_NOT_FOUND, array( + throw new PackageValidationException(PackageValidationException::FILE_NOT_FOUND, [ 'archive' => $this->archive, 'targetArchive' => $filename - )); + ]); } // requested tar archive was found @@ -788,14 +788,14 @@ class PackageArchive { * @return Package[] */ public function getConflictedExcludingPackages() { - $conflictedPackages = array(); + $conflictedPackages = []; $sql = "SELECT package.*, package_exclusion.* FROM wcf".WCF_N."_package_exclusion package_exclusion LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_exclusion.packageID) WHERE excludedPackage = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->packageInfo['name'])); + $statement->execute([$this->packageInfo['name']]); while ($row = $statement->fetchArray()) { if (!empty($row['excludedPackageVersion'])) { if (Package::compareVersion($this->packageInfo['version'], $row['excludedPackageVersion'], '<')) { @@ -815,15 +815,15 @@ class PackageArchive { * @return Package[] */ public function getConflictedExcludedPackages() { - $conflictedPackages = array(); + $conflictedPackages = []; if (!empty($this->excludedPackages)) { - $excludedPackages = array(); + $excludedPackages = []; foreach ($this->excludedPackages as $excludedPackageData) { $excludedPackages[$excludedPackageData['name']] = $excludedPackageData['version']; } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package IN (?)", array(array_keys($excludedPackages))); + $conditions->add("package IN (?)", [array_keys($excludedPackages)]); $sql = "SELECT * FROM wcf".WCF_N."_package diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 191b7e8362..5f931b565c 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -462,7 +462,7 @@ class PackageInstallationDispatcher { FROM wcf".WCF_N."_language_category WHERE languageCategory = ?"; $statement2 = WCF::getDB()->prepareStatement($sql); - $statement2->execute(array('wcf.acp.package')); + $statement2->execute(['wcf.acp.package']); $languageCategory = $statement2->fetchObject('wcf\data\language\category\LanguageCategory'); } else { @@ -477,10 +477,10 @@ class PackageInstallationDispatcher { // update description and name $packageEditor = new PackageEditor($package); - $packageEditor->update(array( + $packageEditor->update([ 'packageDescription' => 'wcf.acp.package.packageDescription.package'.$this->queue->packageID, 'packageName' => 'wcf.acp.package.packageName.package'.$this->queue->packageID - )); + ]); } /** @@ -519,13 +519,13 @@ class PackageInstallationDispatcher { $value = $infoValues[$language->languageCode]; } - $statement->execute(array( + $statement->execute([ $language->languageID, 'wcf.acp.package.'.$infoName.'.package'.$package->packageID, $value, $languageCategory->languageCategoryID, 1 - )); + ]); } } @@ -624,7 +624,7 @@ class PackageInstallationDispatcher { $shiftNodes = true; } - $queue = PackageInstallationQueueEditor::create(array( + $queue = PackageInstallationQueueEditor::create([ 'parentQueueID' => $queue->queueID, 'processNo' => $this->queue->processNo, 'userID' => WCF::getUser()->userID, @@ -632,7 +632,7 @@ class PackageInstallationDispatcher { 'packageName' => $package['packageName'], 'archive' => $package['archive'], 'action' => $queue->action - )); + ]); $installation = new PackageInstallationDispatcher($queue); $installation->nodeBuilder->setParentNode($node); @@ -704,7 +704,7 @@ class PackageInstallationDispatcher { FROM wcf".WCF_N."_package WHERE packageDir = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array('../')); + $statement->execute(['../']); if ($statement->fetchSingleColumn()) { // use abbreviation $defaultPath .= strtolower(Package::getAbbreviation($this->getPackage()->package)) . '/'; @@ -740,9 +740,9 @@ class PackageInstallationDispatcher { // set package dir $packageEditor = new PackageEditor($this->getPackage()); - $packageEditor->update(array( + $packageEditor->update([ 'packageDir' => FileUtil::getRelativePath(WCF_DIR, $packageDir) - )); + ]); // determine domain path, in some environments (e.g. ISPConfig) the $_SERVER paths are // faked and differ from the real filesystem path @@ -754,7 +754,7 @@ class PackageInstallationDispatcher { FROM wcf".WCF_N."_application WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(1)); + $statement->execute([1]); $row = $statement->fetchArray(); $wcfDomainPath = $row['domainPath']; @@ -766,10 +766,10 @@ class PackageInstallationDispatcher { // update application path $application = new Application($this->getPackage()->packageID); $applicationEditor = new ApplicationEditor($application); - $applicationEditor->update(array( + $applicationEditor->update([ 'domainPath' => $domainPath, 'cookiePath' => $domainPath - )); + ]); // create directory and set permissions @mkdir($packageDir, 0777, true); @@ -856,10 +856,10 @@ class PackageInstallationDispatcher { */ public static function openQueue($parentQueueID = 0, $processNo = 0) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID = ?", array(WCF::getUser()->userID)); - $conditions->add("parentQueueID = ?", array($parentQueueID)); - if ($processNo != 0) $conditions->add("processNo = ?", array($processNo)); - $conditions->add("done = ?", array(0)); + $conditions->add("userID = ?", [WCF::getUser()->userID]); + $conditions->add("parentQueueID = ?", [$parentQueueID]); + if ($processNo != 0) $conditions->add("processNo = ?", [$processNo]); + $conditions->add("done = ?", [0]); $sql = "SELECT * FROM wcf".WCF_N."_package_installation_queue @@ -875,7 +875,7 @@ class PackageInstallationDispatcher { exit; } else { - $url = LinkHandler::getInstance()->getLink('PackageInstallationConfirm', array(), 'queueID='.$packageInstallation['queueID']); + $url = LinkHandler::getInstance()->getLink('PackageInstallationConfirm', [], 'queueID='.$packageInstallation['queueID']); HeaderUtil::redirect($url); exit; } @@ -894,7 +894,7 @@ class PackageInstallationDispatcher { AND done = 0 ORDER BY queueID ASC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); $row = $statement->fetchArray(); if (!$row) { @@ -913,7 +913,7 @@ class PackageInstallationDispatcher { FROM wcf".WCF_N."_package_installation_queue WHERE processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->queue->processNo)); + $statement->execute([$this->queue->processNo]); while ($row = $statement->fetchArray()) { @unlink($row['archive']); } @@ -922,7 +922,7 @@ class PackageInstallationDispatcher { $sql = "DELETE FROM wcf".WCF_N."_package_installation_queue WHERE processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->queue->processNo)); + $statement->execute([$this->queue->processNo]); // clear language files once whole installation is completed LanguageEditor::deleteLanguageFiles(); @@ -937,9 +937,9 @@ class PackageInstallationDispatcher { public function updatePackage() { if (empty($this->queue->packageName)) { $queueEditor = new PackageInstallationQueueEditor($this->queue); - $queueEditor->update(array( + $queueEditor->update([ 'packageName' => $this->getArchive()->getLocalizedPackageInfo('packageName') - )); + ]); // reload queue $this->queue = new PackageInstallationQueue($this->queue->queueID); @@ -953,7 +953,7 @@ class PackageInstallationDispatcher { * @return mixed[][] */ public static function validatePHPRequirements(array $requirements) { - $errors = array(); + $errors = []; // validate php version if (isset($requirements['version'])) { @@ -963,10 +963,10 @@ class PackageInstallationDispatcher { } if (!$passed) { - $errors['version'] = array( + $errors['version'] = [ 'required' => $requirements['version'], 'installed' => PHP_VERSION - ); + ]; } } @@ -976,9 +976,9 @@ class PackageInstallationDispatcher { $passed = (extension_loaded($extension)) ? true : false; if (!$passed) { - $errors['extension'][] = array( + $errors['extension'][] = [ 'extension' => $extension - ); + ]; } } } @@ -990,11 +990,11 @@ class PackageInstallationDispatcher { $passed = self::compareSetting($setting, $value, $iniValue); if (!$passed) { - $errors['setting'][] = array( + $errors['setting'][] = [ 'setting' => $setting, 'required' => $value, 'installed' => ($iniValue === false) ? '(unknown)' : $iniValue - ); + ]; } } } @@ -1006,9 +1006,9 @@ class PackageInstallationDispatcher { $passed = self::functionExists($function); if (!$passed) { - $errors['function'][] = array( + $errors['function'][] = [ 'function' => $function - ); + ]; } } } @@ -1028,9 +1028,9 @@ class PackageInstallationDispatcher { } if (!$passed) { - $errors['class'][] = array( + $errors['class'][] = [ 'class' => $class - ); + ]; } } @@ -1076,8 +1076,8 @@ class PackageInstallationDispatcher { if ($compareValue === false) return false; $value = mb_strtolower($value); - $trueValues = array('1', 'on', 'true'); - $falseValues = array('0', 'off', 'false'); + $trueValues = ['1', 'on', 'true']; + $falseValues = ['0', 'off', 'false']; // handle values considered as 'true' if (in_array($value, $trueValues)) { diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationFormManager.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationFormManager.class.php index d3e10c658e..ca4a512232 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationFormManager.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationFormManager.class.php @@ -62,10 +62,10 @@ abstract class PackageInstallationFormManager { WHERE queueID = ? AND formName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $queue->queueID, $formName - )); + ]); return $statement->fetchSingleColumn() > 0; } @@ -81,11 +81,11 @@ abstract class PackageInstallationFormManager { (queueID, formName, document) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $queue->queueID, $document->getName(), base64_encode(serialize($document)) - )); + ]); } /** @@ -100,11 +100,11 @@ abstract class PackageInstallationFormManager { WHERE queueID = ? AND formName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ base64_encode(serialize($document)), $queue->queueID, $document->formName // TODO: FormDocument::$formName does not exist, FormDocument::getName()? - )); + ]); } /** @@ -116,7 +116,7 @@ abstract class PackageInstallationFormManager { $sql = "DELETE FROM wcf".WCF_N."_package_installation_form WHERE queueID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($queue->queueID)); + $statement->execute([$queue->queueID]); } /** @@ -132,10 +132,10 @@ abstract class PackageInstallationFormManager { WHERE queueID = ? AND formName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $queue->queueID, $formName - )); + ]); $row = $statement->fetchArray(); if ($row) { diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php index c04a0c51ff..9dbea51362 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php @@ -48,7 +48,7 @@ class PackageInstallationNodeBuilder { * list of requirements to be checked before package installation * @var mixed[][] */ - public $requirements = array(); + public $requirements = []; /** * current sequence number within one node @@ -60,7 +60,7 @@ class PackageInstallationNodeBuilder { * list of packages about to be installed * @var string[] */ - protected static $pendingPackages = array(); + protected static $pendingPackages = []; /** * Creates a new instance of PackageInstallationNodeBuilder @@ -123,10 +123,10 @@ class PackageInstallationNodeBuilder { WHERE processNo = ? AND parentNode = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->processNo, $parentNode - )); + ]); $row = $statement->fetchArray(); if (!$row) { @@ -147,7 +147,7 @@ class PackageInstallationNodeBuilder { FROM wcf".WCF_N."_package_installation_queue WHERE queueID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($queueID)); + $statement->execute([$queueID]); $row = $statement->fetchArray(); if (!$row) { @@ -168,7 +168,7 @@ class PackageInstallationNodeBuilder { FROM wcf".WCF_N."_package_installation_queue WHERE queueID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($queueID)); + $statement->execute([$queueID]); $row = $statement->fetchArray(); return $row['action']; @@ -187,11 +187,11 @@ class PackageInstallationNodeBuilder { AND node = ? ORDER BY sequenceNo ASC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->processNo, $node - )); - $data = array(); + ]); + $data = []; while ($row = $statement->fetchArray()) { $data[] = $row; } @@ -210,10 +210,10 @@ class PackageInstallationNodeBuilder { WHERE processNo = ? AND node = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->processNo, $node - )); + ]); } /** @@ -225,16 +225,16 @@ class PackageInstallationNodeBuilder { $sql = "DELETE FROM wcf".WCF_N."_package_installation_node WHERE processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->processNo - )); + ]); $sql = "DELETE FROM wcf".WCF_N."_package_installation_form WHERE queueID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID - )); + ]); } /** @@ -244,18 +244,18 @@ class PackageInstallationNodeBuilder { * @return integer */ public function calculateProgress($node) { - $progress = array( + $progress = [ 'done' => 0, 'outstanding' => 0 - ); + ]; $sql = "SELECT done FROM wcf".WCF_N."_package_installation_node WHERE processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->processNo - )); + ]); while ($row = $statement->fetchArray()) { if ($row['done']) { $progress['done']++; @@ -292,11 +292,11 @@ class PackageInstallationNodeBuilder { WHERE parentNode = ? AND processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $newNode, $node, $this->installation->queue->processNo - )); + ]); // create a copy of current node (prevents empty nodes) $sql = "SELECT nodeType, nodeData, done @@ -305,18 +305,18 @@ class PackageInstallationNodeBuilder { AND processNo = ? AND sequenceNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $node, $this->installation->queue->processNo, $sequenceNo - )); + ]); $row = $statement->fetchArray(); $sql = "INSERT INTO wcf".WCF_N."_package_installation_node (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData, done) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID, $this->installation->queue->processNo, 0, @@ -325,7 +325,7 @@ class PackageInstallationNodeBuilder { $row['nodeType'], $row['nodeData'], $row['done'] - )); + ]); // move other child-nodes greater than $sequenceNo into new node $sql = "UPDATE wcf".WCF_N."_package_installation_node @@ -336,14 +336,14 @@ class PackageInstallationNodeBuilder { AND processNo = ? AND sequenceNo > ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $node, $newNode, $sequenceNo, $node, $this->installation->queue->processNo, $sequenceNo - )); + ]); } /** @@ -363,11 +363,11 @@ class PackageInstallationNodeBuilder { WHERE parentNode = ? AND processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $newNode, $beforeNode, $this->installation->queue->processNo - )); + ]); // execute callback $callback($beforeNode, $newNode); @@ -385,11 +385,11 @@ class PackageInstallationNodeBuilder { WHERE parentNode = ? AND processNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $newParentNode, $oldParentNode, $this->installation->queue->processNo - )); + ]); } /** @@ -408,14 +408,14 @@ class PackageInstallationNodeBuilder { (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData) VALUES (?, ?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID, $this->installation->queue->processNo, $this->sequenceNo, $this->node, $this->parentNode, 'package', - serialize(array( + serialize([ 'package' => $this->installation->getArchive()->getPackageInfo('name'), 'packageName' => $this->installation->getArchive()->getLocalizedPackageInfo('packageName'), 'packageDescription' => $this->installation->getArchive()->getLocalizedPackageInfo('packageDescription'), @@ -428,8 +428,8 @@ class PackageInstallationNodeBuilder { 'installDate' => TIME_NOW, 'updateDate' => TIME_NOW, 'requirements' => $this->requirements - )) - )); + ]) + ]); } /** @@ -454,10 +454,10 @@ class PackageInstallationNodeBuilder { } // requirements will be checked once package is about to be installed - $this->requirements[$packageName] = array( + $this->requirements[$packageName] = [ 'minVersion' => (isset($package['minversion'])) ? $package['minversion'] : '', 'packageID' => $package['packageID'] - ); + ]; continue; } @@ -499,7 +499,7 @@ class PackageInstallationNodeBuilder { FROM wcf".WCF_N."_package WHERE package = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($archive->getPackageInfo('name'))); + $statement->execute([$archive->getPackageInfo('name')]); $row = $statement->fetchArray(); $packageID = ($row === false) ? null : $row['packageID']; @@ -519,7 +519,7 @@ class PackageInstallationNodeBuilder { } // create new queue - $queue = PackageInstallationQueueEditor::create(array( + $queue = PackageInstallationQueueEditor::create([ 'parentQueueID' => $queue->queueID, 'processNo' => $queue->processNo, 'userID' => WCF::getUser()->userID, @@ -528,7 +528,7 @@ class PackageInstallationNodeBuilder { 'packageName' => $archive->getLocalizedPackageInfo('packageName'), 'archive' => $fileName, 'action' => ($packageID ? 'update' : 'install') - )); + ]); self::$pendingPackages[$archive->getPackageInfo('name')] = $archive->getPackageInfo('version'); @@ -563,7 +563,7 @@ class PackageInstallationNodeBuilder { $this->node = $this->getToken(); - $pluginNodes = array(); + $pluginNodes = []; $this->emptyNode = true; $instructions = ($this->installation->getAction() == 'install') ? $this->installation->getArchive()->getInstallInstructions() : $this->installation->getArchive()->getUpdateInstructions(); @@ -579,12 +579,12 @@ class PackageInstallationNodeBuilder { $this->node = $this->getToken(); $this->sequenceNo = 0; } - $pluginNodes[] = array( + $pluginNodes[] = [ 'data' => $pip, 'node' => $this->node, 'parentNode' => $this->parentNode, 'sequenceNo' => $this->sequenceNo - ); + ]; // create a new node for following PIPs, unless it is the last one if ($i < $count) { @@ -598,12 +598,12 @@ class PackageInstallationNodeBuilder { else { $this->sequenceNo++; - $pluginNodes[] = array( + $pluginNodes[] = [ 'data' => $pip, 'node' => $this->node, 'parentNode' => $this->parentNode, 'sequenceNo' => $this->sequenceNo - ); + ]; $this->emptyNode = false; } @@ -617,7 +617,7 @@ class PackageInstallationNodeBuilder { $statement = WCF::getDB()->prepareStatement($sql); foreach ($pluginNodes as $index => $nodeData) { - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID, $this->installation->queue->processNo, $nodeData['sequenceNo'], @@ -625,7 +625,7 @@ class PackageInstallationNodeBuilder { $nodeData['parentNode'], 'pip', serialize($nodeData['data']) - )); + ]); } } } @@ -636,7 +636,7 @@ class PackageInstallationNodeBuilder { * not really matter at this point). */ protected function buildOptionalNodes() { - $packages = array(); + $packages = []; $optionalPackages = $this->installation->getArchive()->getOptionals(); foreach ($optionalPackages as $package) { @@ -681,14 +681,14 @@ class PackageInstallationNodeBuilder { $isInstallable = false; } - $packages[] = array( + $packages[] = [ 'archive' => $fileName, 'isInstallable' => $isInstallable, 'package' => $archive->getPackageInfo('name'), 'packageName' => $archive->getLocalizedPackageInfo('packageName'), 'packageDescription' => $archive->getLocalizedPackageInfo('packageDescription'), 'selected' => 0 - ); + ]; self::$pendingPackages[$archive->getPackageInfo('name')] = $archive->getPackageInfo('version'); } @@ -702,7 +702,7 @@ class PackageInstallationNodeBuilder { (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData) VALUES (?, ?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID, $this->installation->queue->processNo, $this->sequenceNo, @@ -710,7 +710,7 @@ class PackageInstallationNodeBuilder { $this->parentNode, 'optionalPackages', serialize($packages) - )); + ]); } } @@ -719,7 +719,7 @@ class PackageInstallationNodeBuilder { */ protected function buildChildQueues() { $queueList = new PackageInstallationQueueList(); - $queueList->getConditionBuilder()->add("package_installation_queue.parentQueueID = ?", array($this->installation->queue->queueID)); + $queueList->getConditionBuilder()->add("package_installation_queue.parentQueueID = ?", [$this->installation->queue->queueID]); $queueList->getConditionBuilder()->add("package_installation_queue.queueID NOT IN (SELECT queueID FROM wcf".WCF_N."_package_installation_node)"); $queueList->readObjects(); @@ -728,10 +728,10 @@ class PackageInstallationNodeBuilder { // work-around for iterative package updates if ($this->installation->queue->action == 'update' && $queue->package == $this->installation->queue->package) { - $installation->setPreviousPackage(array( + $installation->setPreviousPackage([ 'package' => $this->installation->getArchive()->getPackageInfo('name'), 'packageVersion' => $this->installation->getArchive()->getPackageInfo('version') - )); + ]); } $installation->nodeBuilder->setParentNode($this->node); @@ -762,10 +762,10 @@ class PackageInstallationNodeBuilder { WHERE processNo = ? AND node = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $processNo, $node - )); + ]); $row = $statement->fetchArray(); return $row['queueID']; diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php index 268c7e5347..ea0244cf1d 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php @@ -38,37 +38,37 @@ class PackageInstallationSQLParser extends SQLParser { * list of existing database tables * @var array */ - protected $existingTables = array(); + protected $existingTables = []; /** * list of logged tables * @var array */ - protected $knownTables = array(); + protected $knownTables = []; /** * list of conflicted database tables * @var array */ - protected $conflicts = array(); + protected $conflicts = []; /** * list of created/deleted tables * @var array */ - protected $tableLog = array(); + protected $tableLog = []; /** * list of created/deleted columns * @var array */ - protected $columnLog = array(); + protected $columnLog = []; /** * list of created/deleted indices * @var array */ - protected $indexLog = array(); + protected $indexLog = []; /** * Creates a new PackageInstallationSQLParser object. @@ -90,7 +90,7 @@ class PackageInstallationSQLParser extends SQLParser { * @return array conflicts */ public function test() { - $this->conflicts = array(); + $this->conflicts = []; // get all existing tables from database $this->existingTables = WCF::getDB()->getEditor()->getTableNames(); @@ -120,17 +120,17 @@ class PackageInstallationSQLParser extends SQLParser { $sql = "DELETE FROM wcf".WCF_N."_package_installation_sql_log WHERE sqlTable = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($logEntry['tableName'])); + $statement->execute([$logEntry['tableName']]); if ($logEntry['action'] == 'insert') { $sql = "INSERT INTO wcf".WCF_N."_package_installation_sql_log (packageID, sqlTable) VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $logEntry['packageID'], $logEntry['tableName'] - )); + ]); } } @@ -147,17 +147,17 @@ class PackageInstallationSQLParser extends SQLParser { $insertStatement = WCF::getDB()->prepareStatement($sql); foreach ($this->columnLog as $logEntry) { - $deleteStatement->execute(array( + $deleteStatement->execute([ $logEntry['tableName'], $logEntry['columnName'] - )); + ]); if ($logEntry['action'] == 'insert') { - $insertStatement->execute(array( + $insertStatement->execute([ $logEntry['packageID'], $logEntry['tableName'], $logEntry['columnName'] - )); + ]); } } } @@ -175,17 +175,17 @@ class PackageInstallationSQLParser extends SQLParser { $insertStatement = WCF::getDB()->prepareStatement($sql); foreach ($this->indexLog as $logEntry) { - $deleteStatement->execute(array( + $deleteStatement->execute([ $logEntry['tableName'], $logEntry['indexName'] - )); + ]); if ($logEntry['action'] == 'insert') { - $insertStatement->execute(array( + $insertStatement->execute([ $logEntry['packageID'], $logEntry['tableName'], $logEntry['indexName'] - )); + ]); } } } @@ -219,10 +219,10 @@ class PackageInstallationSQLParser extends SQLParser { WHERE sqlTable = ? AND sqlColumn = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $tableName, $columnName - )); + ]); $row = $statement->fetchArray(); if (!empty($row['packageID'])) return $row['packageID']; else if (isset($this->knownTables[$tableName])) return $this->knownTables[$tableName]; @@ -242,10 +242,10 @@ class PackageInstallationSQLParser extends SQLParser { WHERE sqlTable = ? AND sqlIndex = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $tableName, $indexName - )); + ]); $row = $statement->fetchArray(); if (!empty($row['packageID'])) return $row['packageID']; else if (isset($this->knownTables[$tableName])) return $this->knownTables[$tableName]; @@ -255,21 +255,21 @@ class PackageInstallationSQLParser extends SQLParser { /** * @see \wcf\system\database\util\SQLParser::executeCreateTableStatement() */ - protected function executeCreateTableStatement($tableName, $columns, $indices = array()) { + protected function executeCreateTableStatement($tableName, $columns, $indices = []) { if ($this->test) { if (in_array($tableName, $this->existingTables)) { if (isset($this->knownTables[$tableName]) && $this->knownTables[$tableName] != $this->package->packageID) { throw new SystemException("Cannot recreate table '".$tableName."'. A package can only overwrite own tables."); } else { - if (!isset($this->conflicts['CREATE TABLE'])) $this->conflicts['CREATE TABLE'] = array(); + if (!isset($this->conflicts['CREATE TABLE'])) $this->conflicts['CREATE TABLE'] = []; $this->conflicts['CREATE TABLE'][] = $tableName; } } } else { // log - $this->tableLog[] = array('tableName' => $tableName, 'packageID' => $this->package->packageID, 'action' => 'insert'); + $this->tableLog[] = ['tableName' => $tableName, 'packageID' => $this->package->packageID, 'action' => 'insert']; // execute parent::executeCreateTableStatement($tableName, $columns, $indices); @@ -287,7 +287,7 @@ class PackageInstallationSQLParser extends SQLParser { } else { // log - $this->columnLog[] = array('tableName' => $tableName, 'columnName' => $columnName, 'packageID' => $this->package->packageID, 'action' => 'insert'); + $this->columnLog[] = ['tableName' => $tableName, 'columnName' => $columnName, 'packageID' => $this->package->packageID, 'action' => 'insert']; // execute parent::executeAddColumnStatement($tableName, $columnName, $columnData); @@ -308,8 +308,8 @@ class PackageInstallationSQLParser extends SQLParser { else { // log if ($oldColumnName != $newColumnName) { - $this->columnLog[] = array('tableName' => $tableName, 'columnName' => $oldColumnName, 'packageID' => $this->package->packageID, 'action' => 'delete'); - $this->columnLog[] = array('tableName' => $tableName, 'columnName' => $newColumnName, 'packageID' => $this->package->packageID, 'action' => 'insert'); + $this->columnLog[] = ['tableName' => $tableName, 'columnName' => $oldColumnName, 'packageID' => $this->package->packageID, 'action' => 'delete']; + $this->columnLog[] = ['tableName' => $tableName, 'columnName' => $newColumnName, 'packageID' => $this->package->packageID, 'action' => 'insert']; } // execute @@ -323,7 +323,7 @@ class PackageInstallationSQLParser extends SQLParser { protected function executeAddIndexStatement($tableName, $indexName, $indexData) { if (!$this->test) { // log - $this->indexLog[] = array('tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'insert'); + $this->indexLog[] = ['tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'insert']; // execute parent::executeAddIndexStatement($tableName, $indexName, $indexData); @@ -336,7 +336,7 @@ class PackageInstallationSQLParser extends SQLParser { protected function executeAddForeignKeyStatement($tableName, $indexName, $indexData) { if (!$this->test) { // log - $this->indexLog[] = array('tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'insert'); + $this->indexLog[] = ['tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'insert']; // execute parent::executeAddForeignKeyStatement($tableName, $indexName, $indexData); @@ -356,7 +356,7 @@ class PackageInstallationSQLParser extends SQLParser { } else { // log - $this->columnLog[] = array('tableName' => $tableName, 'columnName' => $columnName, 'packageID' => $this->package->packageID, 'action' => 'delete'); + $this->columnLog[] = ['tableName' => $tableName, 'columnName' => $columnName, 'packageID' => $this->package->packageID, 'action' => 'delete']; // execute parent::executeDropColumnStatement($tableName, $columnName); @@ -376,7 +376,7 @@ class PackageInstallationSQLParser extends SQLParser { } else { // log - $this->indexLog[] = array('tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'delete'); + $this->indexLog[] = ['tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'delete']; // execute parent::executeDropIndexStatement($tableName, $indexName); @@ -396,7 +396,7 @@ class PackageInstallationSQLParser extends SQLParser { } else { // log - $this->indexLog[] = array('tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'delete'); + $this->indexLog[] = ['tableName' => $tableName, 'indexName' => $indexName, 'packageID' => $this->package->packageID, 'action' => 'delete']; // execute parent::executeDropForeignKeyStatement($tableName, $indexName); @@ -416,7 +416,7 @@ class PackageInstallationSQLParser extends SQLParser { } else { // log - $this->tableLog[] = array('tableName' => $tableName, 'packageID' => $this->package->packageID, 'action' => 'delete'); + $this->tableLog[] = ['tableName' => $tableName, 'packageID' => $this->package->packageID, 'action' => 'delete']; // execute parent::executeDropTableStatement($tableName); diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php index 1cbf68af8f..7dd6d40c90 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php @@ -27,25 +27,25 @@ class PackageInstallationScheduler { * stack of package installations / updates * @var array */ - protected $packageInstallationStack = array(); + protected $packageInstallationStack = []; /** * list of package update servers * @var PackageUpdateServer[] */ - protected $packageUpdateServers = array(); + protected $packageUpdateServers = []; /** * list of packages to update or install * @var array */ - protected $selectedPackages = array(); + protected $selectedPackages = []; /** * virtual package versions * @var array */ - protected $virtualPackageVersions = array(); + protected $virtualPackageVersions = []; /** * Creates a new instance of PackageInstallationScheduler @@ -128,14 +128,14 @@ class PackageInstallationScheduler { $download = $this->downloadPackage($package, $packageUpdateVersions, $validateInstallInstructions); // add to stack - $data = array( + $data = [ 'packageName' => $packageUpdateVersions[0]['packageName'], 'packageVersion' => $packageUpdateVersions[0]['packageVersion'], 'package' => $package, 'packageID' => 0, 'archive' => $download, 'action' => 'install' - ); + ]; if ($stackPosition == -1) $this->packageInstallationStack[] = $data; else $this->packageInstallationStack[$stackPosition] = $data; @@ -151,13 +151,13 @@ class PackageInstallationScheduler { */ protected function resolveRequirements($packageUpdateVersionID) { // resolve requirements - $requiredPackages = array(); - $requirementsCache = array(); + $requiredPackages = []; + $requirementsCache = []; $sql = "SELECT * FROM wcf".WCF_N."_package_update_requirement WHERE packageUpdateVersionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageUpdateVersionID)); + $statement->execute([$packageUpdateVersionID]); while ($row = $statement->fetchArray()) { $requiredPackages[] = $row['package']; $requirementsCache[] = $row; @@ -166,16 +166,16 @@ class PackageInstallationScheduler { if (!empty($requiredPackages)) { // find installed packages $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package IN (?)", array($requiredPackages)); + $conditions->add("package IN (?)", [$requiredPackages]); - $installedPackages = array(); + $installedPackages = []; $sql = "SELECT packageID, package, packageVersion FROM wcf".WCF_N."_package ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); while ($row = $statement->fetchArray()) { - if (!isset($installedPackages[$row['package']])) $installedPackages[$row['package']] = array(); + if (!isset($installedPackages[$row['package']])) $installedPackages[$row['package']] = []; $installedPackages[$row['package']][$row['packageID']] = (isset($this->virtualPackageVersions[$row['packageID']]) ? $this->virtualPackageVersions[$row['packageID']] : $row['packageVersion']); } @@ -184,7 +184,7 @@ class PackageInstallationScheduler { if (isset($installedPackages[$row['package']])) { // package already installed -> check version // sort multiple instances by version number - uasort($installedPackages[$row['package']], array('wcf\data\package\Package', 'compareVersion')); + uasort($installedPackages[$row['package']], ['wcf\data\package\Package', 'compareVersion']); foreach ($installedPackages[$row['package']] as $packageID => $packageVersion) { if (empty($row['minversion']) || Package::compareVersion($row['minversion'], $packageVersion, '<=')) { @@ -226,22 +226,22 @@ class PackageInstallationScheduler { if ($packageUpdateVersion['filename']) { $request = new HTTPRequest( $packageUpdateVersion['filename'], - (!empty($authData) ? array('auth' => $authData) : array()), - array( + (!empty($authData) ? ['auth' => $authData] : []), + [ 'apiVersion' => PackageUpdate::API_VERSION - ) + ] ); } else { // create request $request = new HTTPRequest( $this->packageUpdateServers[$packageUpdateVersion['packageUpdateServerID']]->getDownloadURL(), - (!empty($authData) ? array('auth' => $authData) : array()), - array( + (!empty($authData) ? ['auth' => $authData] : []), + [ 'apiVersion' => PackageUpdate::API_VERSION, 'packageName' => $packageUpdateVersion['package'], 'packageVersion' => $packageUpdateVersion['packageVersion'] - ) + ] ); } @@ -256,7 +256,7 @@ class PackageInstallationScheduler { // check response if ($response['statusCode'] != 200) { - throw new SystemException(WCF::getLanguage()->getDynamicVariable('wcf.acp.package.error.downloadFailed', array('__downloadPackage' => $package)) . ' ('.$response['body'].')'); + throw new SystemException(WCF::getLanguage()->getDynamicVariable('wcf.acp.package.error.downloadFailed', ['__downloadPackage' => $package]) . ' ('.$response['body'].')'); } // write content to tmp file @@ -295,11 +295,11 @@ class PackageInstallationScheduler { * @return array */ public function getExcludedPackages() { - $excludedPackages = array(); + $excludedPackages = []; if (!empty($this->packageInstallationStack)) { - $packageInstallations = array(); - $packageIdentifier = array(); + $packageInstallations = []; + $packageIdentifier = []; foreach ($this->packageInstallationStack as $packageInstallation) { $packageInstallation['newVersion'] = ($packageInstallation['action'] == 'update' ? $packageInstallation['toVersion'] : $packageInstallation['packageVersion']); $packageInstallations[] = $packageInstallation; @@ -309,7 +309,7 @@ class PackageInstallationScheduler { // check exclusions of the new packages // get package update ids $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package IN (?)", array($packageIdentifier)); + $conditions->add("package IN (?)", [$packageIdentifier]); $sql = "SELECT packageUpdateID, package FROM wcf".WCF_N."_package_update @@ -327,7 +327,7 @@ class PackageInstallationScheduler { // get exclusions of the new packages // build conditions $conditions = ''; - $statementParameters = array(); + $statementParameters = []; foreach ($packageInstallations as $packageInstallation) { if (!empty($conditions)) $conditions .= ' OR '; $conditions .= "(packageUpdateID = ? AND packageVersion = ?)"; @@ -357,9 +357,9 @@ class PackageInstallationScheduler { foreach ($packageInstallations as $key => $packageInstallation) { if ($packageInstallation['package'] == $row['package']) { if (!isset($packageInstallations[$key]['excludedPackages'])) { - $packageInstallations[$key]['excludedPackages'] = array(); + $packageInstallations[$key]['excludedPackages'] = []; } - $packageInstallations[$key]['excludedPackages'][$row['excludedPackage']] = array('package' => $row['excludedPackage'], 'version' => $row['excludedPackageVersion']); + $packageInstallations[$key]['excludedPackages'][$row['excludedPackage']] = ['package' => $row['excludedPackage'], 'version' => $row['excludedPackageVersion']]; // check version if (!empty($row['excludedPackageVersion'])) { @@ -368,7 +368,7 @@ class PackageInstallationScheduler { } } - $excludedPackages[] = array( + $excludedPackages[] = [ 'package' => $row['package'], 'packageName' => $packageInstallations[$key]['packageName'], 'packageVersion' => $packageInstallations[$key]['newVersion'], @@ -377,14 +377,14 @@ class PackageInstallationScheduler { 'existingPackage' => $row['excludedPackage'], 'existingPackageName' => WCF::getLanguage()->get($row['packageName']), 'existingPackageVersion' => $row['packageVersion'] - ); + ]; } } } // check excluded packages of the existing packages $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("excludedPackage IN (?)", array($packageIdentifier)); + $conditions->add("excludedPackage IN (?)", [$packageIdentifier]); $sql = "SELECT package.*, package_exclusion.* FROM wcf".WCF_N."_package_exclusion package_exclusion @@ -413,7 +413,7 @@ class PackageInstallationScheduler { } } - $excludedPackages[] = array( + $excludedPackages[] = [ 'package' => $row['excludedPackage'], 'packageName' => $packageInstallation['packageName'], 'packageVersion' => $packageInstallation['newVersion'], @@ -422,7 +422,7 @@ class PackageInstallationScheduler { 'existingPackage' => $row['package'], 'existingPackageName' => WCF::getLanguage()->get($row['packageName']), 'existingPackageVersion' => $row['packageVersion'] - ); + ]; } } } @@ -473,15 +473,15 @@ class PackageInstallationScheduler { ) AND packageVersion LIKE ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $package->package, $match[1].'%' - )); + ]); $packageVersions = $statement->fetchAll(\PDO::FETCH_COLUMN); if (count($packageVersions) > 1) { // sort by version number - usort($packageVersions, array('wcf\data\package\Package', 'compareVersion')); + usort($packageVersions, ['wcf\data\package\Package', 'compareVersion']); // get highest version $version = array_pop($packageVersions); @@ -489,7 +489,7 @@ class PackageInstallationScheduler { } // get all fromversion - $fromversions = array(); + $fromversions = []; $sql = "SELECT puv.packageVersion, puf.fromversion FROM wcf".WCF_N."_package_update_fromversion puf LEFT JOIN wcf".WCF_N."_package_update_version puv @@ -504,14 +504,14 @@ class PackageInstallationScheduler { ) )"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($package->package)); + $statement->execute([$package->package]); while ($row = $statement->fetchArray()) { - if (!isset($fromversions[$row['packageVersion']])) $fromversions[$row['packageVersion']] = array(); + if (!isset($fromversions[$row['packageVersion']])) $fromversions[$row['packageVersion']] = []; $fromversions[$row['packageVersion']][$row['fromversion']] = $row['fromversion']; } // sort by version number - uksort($fromversions, array('wcf\data\package\Package', 'compareVersion')); + uksort($fromversions, ['wcf\data\package\Package', 'compareVersion']); // find shortest update thread $updateThread = $this->findShortestUpdateThread($package->package, $fromversions, $packageVersion, $version); @@ -527,7 +527,7 @@ class PackageInstallationScheduler { $download = $this->downloadPackage($package->package, $packageUpdateVersions); // add to stack - $this->packageInstallationStack[] = array( + $this->packageInstallationStack[] = [ 'packageName' => $package->getName(), 'fromversion' => $fromversion, 'toVersion' => $toVersion, @@ -535,7 +535,7 @@ class PackageInstallationScheduler { 'packageID' => $packageID, 'archive' => $download, 'action' => 'update' - ); + ]; // update virtual versions $this->virtualPackageVersions[$packageID] = $toVersion; @@ -560,25 +560,25 @@ class PackageInstallationScheduler { // find direct update foreach ($fromversions[$newVersion] as $fromversion) { if (Package::checkFromversion($currentVersion, $fromversion)) { - return array($currentVersion => $newVersion); + return [$currentVersion => $newVersion]; } } // find intermediate update $packageVersions = array_keys($fromversions); - $updateThreadList = array(); + $updateThreadList = []; foreach ($fromversions[$newVersion] as $fromversion) { - $innerUpdateThreadList = array(); + $innerUpdateThreadList = []; // find matching package versions foreach ($packageVersions as $packageVersion) { if (Package::checkFromversion($packageVersion, $fromversion) && Package::compareVersion($packageVersion, $currentVersion, '>') && Package::compareVersion($packageVersion, $newVersion, '<')) { - $innerUpdateThreadList[] = $this->findShortestUpdateThread($package, $fromversions, $currentVersion, $packageVersion) + array($packageVersion => $newVersion); + $innerUpdateThreadList[] = $this->findShortestUpdateThread($package, $fromversions, $currentVersion, $packageVersion) + [$packageVersion => $newVersion]; } } if (!empty($innerUpdateThreadList)) { // sort by length - usort($innerUpdateThreadList, array($this, 'compareUpdateThreadLists')); + usort($innerUpdateThreadList, [$this, 'compareUpdateThreadLists']); // add to thread list $updateThreadList[] = array_shift($innerUpdateThreadList); @@ -590,7 +590,7 @@ class PackageInstallationScheduler { } // sort by length - usort($updateThreadList, array($this, 'compareUpdateThreadLists')); + usort($updateThreadList, [$this, 'compareUpdateThreadLists']); // take shortest return array_shift($updateThreadList); diff --git a/wcfsetup/install/files/lib/system/package/PackageUninstallationNodeBuilder.class.php b/wcfsetup/install/files/lib/system/package/PackageUninstallationNodeBuilder.class.php index 0aff2c6687..103fc5fc5a 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUninstallationNodeBuilder.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUninstallationNodeBuilder.class.php @@ -37,7 +37,7 @@ class PackageUninstallationNodeBuilder extends PackageInstallationNodeBuilder { } // fetch ordered pips - $pips = array(); + $pips = []; $sql = "SELECT pluginName, className, CASE pluginName WHEN 'packageinstallationplugin' THEN 1 WHEN 'file' THEN 2 ELSE 0 END AS pluginOrder FROM wcf".WCF_N."_package_installation_plugin @@ -56,18 +56,18 @@ class PackageUninstallationNodeBuilder extends PackageInstallationNodeBuilder { $sequenceNo = 0; foreach ($pips as $pip) { - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID, $this->installation->queue->processNo, $sequenceNo, $this->node, $this->parentNode, 'pip', - serialize(array( + serialize([ 'pluginName' => $pip['pluginName'], 'className' => $pip['className'] - )) - )); + ]) + ]); $sequenceNo++; } @@ -84,7 +84,7 @@ class PackageUninstallationNodeBuilder extends PackageInstallationNodeBuilder { (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData) VALUES (?, ?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->queue->queueID, $this->installation->queue->processNo, 0, @@ -92,6 +92,6 @@ class PackageUninstallationNodeBuilder extends PackageInstallationNodeBuilder { $this->parentNode, 'package', 'a:0:{}' - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index 436b691106..c53b37afa7 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -32,12 +32,12 @@ class PackageUpdateDispatcher extends SingletonFactory { * @param integer[] $packageUpdateServerIDs * @param boolean $ignoreCache */ - public function refreshPackageDatabase(array $packageUpdateServerIDs = array(), $ignoreCache = false) { + public function refreshPackageDatabase(array $packageUpdateServerIDs = [], $ignoreCache = false) { // get update server data $tmp = PackageUpdateServer::getActiveUpdateServers($packageUpdateServerIDs); // loop servers - $updateServers = array(); + $updateServers = []; $foundWoltLabServer = false; foreach ($tmp as $updateServer) { if ($ignoreCache || $updateServer->lastUpdateTime < TIME_NOW - 600) { @@ -73,10 +73,10 @@ class PackageUpdateDispatcher extends SingletonFactory { if ($errorMessage) { // save error status $updateServerEditor = new PackageUpdateServerEditor($updateServer); - $updateServerEditor->update(array( + $updateServerEditor->update([ 'status' => 'offline', 'errorMessage' => $errorMessage - )); + ]); } } @@ -94,7 +94,7 @@ class PackageUpdateDispatcher extends SingletonFactory { * @throws SystemException */ protected function getPackageUpdateXML(PackageUpdateServer $updateServer, $forceHTTP = false) { - $settings = array(); + $settings = []; $authData = $updateServer->getAuthData(); if ($authData) $settings['auth'] = $authData; @@ -141,11 +141,11 @@ class PackageUpdateDispatcher extends SingletonFactory { $allNewPackages = $this->parsePackageUpdateXML($reply['body']); } - $data = array( + $data = [ 'lastUpdateTime' => TIME_NOW, 'status' => 'online', 'errorMessage' => '' - ); + ]; // check if server indicates support for a newer API if ($updateServer->apiVersion == '2.0' && !empty($reply['httpHeaders']['wcf-update-server-api'])) { @@ -155,7 +155,7 @@ class PackageUpdateDispatcher extends SingletonFactory { } } - $metaData = array(); + $metaData = []; if ($updateServer->apiVersion == '2.1' || (isset($data['apiVersion']) && $data['apiVersion'] == '2.1')) { if (empty($reply['httpHeaders']['etag']) && empty($reply['httpHeaders']['last-modified'])) { throw new SystemException("Missing required HTTP headers 'etag' and 'last-modified'."); @@ -164,7 +164,7 @@ class PackageUpdateDispatcher extends SingletonFactory { throw new SystemException("Missing required HTTP header 'wcf-update-server-ssl'."); } - $metaData['list'] = array(); + $metaData['list'] = []; if (!empty($reply['httpHeaders']['etag'])) $metaData['list']['etag'] = reset($reply['httpHeaders']['etag']); if (!empty($reply['httpHeaders']['last-modified'])) $metaData['list']['lastModified'] = reset($reply['httpHeaders']['last-modified']); @@ -179,7 +179,7 @@ class PackageUpdateDispatcher extends SingletonFactory { $sql = "DELETE FROM wcf".WCF_N."_package_update WHERE packageUpdateServerID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($updateServer->packageUpdateServerID)); + $statement->execute([$updateServer->packageUpdateServerID]); // save packages if (!empty($allNewPackages)) { @@ -206,7 +206,7 @@ class PackageUpdateDispatcher extends SingletonFactory { $xml->loadXML('packageUpdateServer.xml', $content); $xpath = $xml->xpath(); - $allNewPackages = array(); + $allNewPackages = []; $packages = $xpath->query('/ns:section/ns:package'); foreach ($packages as $package) { if (!Package::isValidPackageName($package->getAttribute('name'))) { @@ -228,13 +228,13 @@ class PackageUpdateDispatcher extends SingletonFactory { */ protected function parsePackageUpdateXMLBlock(\DOMXPath $xpath, \DOMNode $package) { // define default values - $packageInfo = array( + $packageInfo = [ 'author' => '', 'authorURL' => '', 'isApplication' => 0, 'packageDescription' => '', - 'versions' => array() - ); + 'versions' => [] + ]; // parse package information $elements = $xpath->query('./ns:packageinformation/*', $package); @@ -272,10 +272,10 @@ class PackageUpdateDispatcher extends SingletonFactory { $elements = $xpath->query('./ns:versions/ns:version', $package); foreach ($elements as $element) { $versionNo = $element->getAttribute('name'); - $packageInfo['versions'][$versionNo] = array( + $packageInfo['versions'][$versionNo] = [ 'isAccessible' => ($element->getAttribute('accessible') == 'true' ? true : false), 'isCritical' => ($element->getAttribute('critical') == 'true' ? true : false) - ); + ]; $children = $xpath->query('child::*', $element); foreach ($children as $child) { @@ -301,7 +301,7 @@ class PackageUpdateDispatcher extends SingletonFactory { $minVersion = $requiredPackage->getAttribute('minversion'); $required = $requiredPackage->nodeValue; - $packageInfo['versions'][$versionNo]['requiredPackages'][$required] = array(); + $packageInfo['versions'][$versionNo]['requiredPackages'][$required] = []; if (!empty($minVersion)) { $packageInfo['versions'][$versionNo]['requiredPackages'][$required]['minversion'] = $minVersion; } @@ -309,7 +309,7 @@ class PackageUpdateDispatcher extends SingletonFactory { break; case 'optionalpackages': - $packageInfo['versions'][$versionNo]['optionalPackages'] = array(); + $packageInfo['versions'][$versionNo]['optionalPackages'] = []; $optionalPackages = $xpath->query('child::*', $child); foreach ($optionalPackages as $optionalPackage) { @@ -323,7 +323,7 @@ class PackageUpdateDispatcher extends SingletonFactory { $exclusion = $excludedPackage->nodeValue; $version = $excludedPackage->getAttribute('version'); - $packageInfo['versions'][$versionNo]['excludedPackages'][$exclusion] = array(); + $packageInfo['versions'][$versionNo]['excludedPackages'][$exclusion] = []; if (!empty($version)) { $packageInfo['versions'][$versionNo]['excludedPackages'][$exclusion]['version'] = $version; } @@ -331,10 +331,10 @@ class PackageUpdateDispatcher extends SingletonFactory { break; case 'license': - $packageInfo['versions'][$versionNo]['license'] = array( + $packageInfo['versions'][$versionNo]['license'] = [ 'license' => $child->nodeValue, 'licenseURL' => ($child->hasAttribute('url') ? $child->getAttribute('url') : '') - ); + ]; break; } } @@ -351,11 +351,11 @@ class PackageUpdateDispatcher extends SingletonFactory { */ protected function savePackageUpdates(array &$allNewPackages, $packageUpdateServerID) { // insert updates - $excludedPackagesParameters = $fromversionParameters = $insertParameters = $optionalInserts = $requirementInserts = array(); + $excludedPackagesParameters = $fromversionParameters = $insertParameters = $optionalInserts = $requirementInserts = []; WCF::getDB()->beginTransaction(); foreach ($allNewPackages as $identifier => $packageData) { // create new database entry - $packageUpdate = PackageUpdateEditor::create(array( + $packageUpdate = PackageUpdateEditor::create([ 'packageUpdateServerID' => $packageUpdateServerID, 'package' => $identifier, 'packageName' => $packageData['packageName'], @@ -363,7 +363,7 @@ class PackageUpdateDispatcher extends SingletonFactory { 'author' => $packageData['author'], 'authorURL' => $packageData['authorURL'], 'isApplication' => $packageData['isApplication'] - )); + ]); $packageUpdateID = $packageUpdate->packageUpdateID; @@ -374,7 +374,7 @@ class PackageUpdateDispatcher extends SingletonFactory { else $packageFile = ''; // create new database entry - $version = PackageUpdateVersionEditor::create(array( + $version = PackageUpdateVersionEditor::create([ 'filename' => $packageFile, 'license' => (isset($versionData['license']['license']) ? $versionData['license']['license'] : ''), 'licenseURL' => (isset($versionData['license']['license']) ? $versionData['license']['licenseURL'] : ''), @@ -383,49 +383,49 @@ class PackageUpdateDispatcher extends SingletonFactory { 'packageDate' => $versionData['packageDate'], 'packageUpdateID' => $packageUpdateID, 'packageVersion' => $packageVersion - )); + ]); $packageUpdateVersionID = $version->packageUpdateVersionID; // register requirement(s) of this update package version. if (isset($versionData['requiredPackages'])) { foreach ($versionData['requiredPackages'] as $requiredIdentifier => $required) { - $requirementInserts[] = array( + $requirementInserts[] = [ 'packageUpdateVersionID' => $packageUpdateVersionID, 'package' => $requiredIdentifier, 'minversion' => (isset($required['minversion']) ? $required['minversion'] : '') - ); + ]; } } // register optional packages of this update package version if (isset($versionData['optionalPackages'])) { foreach ($versionData['optionalPackages'] as $optionalPackage) { - $optionalInserts[] = array( + $optionalInserts[] = [ 'packageUpdateVersionID' => $packageUpdateVersionID, 'package' => $optionalPackage - ); + ]; } } // register excluded packages of this update package version. if (isset($versionData['excludedPackages'])) { foreach ($versionData['excludedPackages'] as $excludedIdentifier => $exclusion) { - $excludedPackagesParameters[] = array( + $excludedPackagesParameters[] = [ 'packageUpdateVersionID' => $packageUpdateVersionID, 'excludedPackage' => $excludedIdentifier, 'excludedPackageVersion' => (isset($exclusion['version']) ? $exclusion['version'] : '') - ); + ]; } } // register fromversions of this update package version. if (isset($versionData['fromversions'])) { foreach ($versionData['fromversions'] as $fromversion) { - $fromversionInserts[] = array( + $fromversionInserts[] = [ 'packageUpdateVersionID' => $packageUpdateVersionID, 'fromversion' => $fromversion - ); + ]; } } } @@ -442,11 +442,11 @@ class PackageUpdateDispatcher extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($requirementInserts as $requirement) { - $statement->execute(array( + $statement->execute([ $requirement['packageUpdateVersionID'], $requirement['package'], $requirement['minversion'] - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -459,10 +459,10 @@ class PackageUpdateDispatcher extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($optionalInserts as $requirement) { - $statement->execute(array( + $statement->execute([ $requirement['packageUpdateVersionID'], $requirement['package'] - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -475,11 +475,11 @@ class PackageUpdateDispatcher extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($excludedPackagesParameters as $excludedPackage) { - $statement->execute(array( + $statement->execute([ $excludedPackage['packageUpdateVersionID'], $excludedPackage['excludedPackage'], $excludedPackage['excludedPackageVersion'] - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -492,10 +492,10 @@ class PackageUpdateDispatcher extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($fromversionInserts as $fromversion) { - $statement->execute(array( + $statement->execute([ $fromversion['packageUpdateVersionID'], $fromversion['fromversion'] - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -509,7 +509,7 @@ class PackageUpdateDispatcher extends SingletonFactory { * @return array */ public function getAvailableUpdates($removeRequirements = true, $removeOlderMinorReleases = false) { - $updates = array(); + $updates = []; // get update server data $updateServers = PackageUpdateServer::getActiveUpdateServers(); @@ -517,7 +517,7 @@ class PackageUpdateDispatcher extends SingletonFactory { if (empty($packageUpdateServerIDs)) return $updates; // get existing packages and their versions - $existingPackages = array(); + $existingPackages = []; $sql = "SELECT packageID, package, packageDescription, packageName, packageVersion, packageDate, author, authorURL, isApplication FROM wcf".WCF_N."_package"; @@ -530,7 +530,7 @@ class PackageUpdateDispatcher extends SingletonFactory { // get all update versions $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("pu.packageUpdateServerID IN (?)", array($packageUpdateServerIDs)); + $conditions->add("pu.packageUpdateServerID IN (?)", [$packageUpdateServerIDs]); $conditions->add("package IN (SELECT DISTINCT package FROM wcf".WCF_N."_package)"); $sql = "SELECT pu.packageUpdateID, pu.packageUpdateServerID, pu.package, @@ -547,27 +547,27 @@ class PackageUpdateDispatcher extends SingletonFactory { if (Package::compareVersion($existingVersion['packageVersion'], $row['packageVersion'], '<')) { // package data if (!isset($updates[$existingVersion['packageID']])) { - $existingVersion['versions'] = array(); + $existingVersion['versions'] = []; $updates[$existingVersion['packageID']] = $existingVersion; } // version data if (!isset($updates[$existingVersion['packageID']]['versions'][$row['packageVersion']])) { - $updates[$existingVersion['packageID']]['versions'][$row['packageVersion']] = array( + $updates[$existingVersion['packageID']]['versions'][$row['packageVersion']] = [ 'isCritical' => $row['isCritical'], 'packageDate' => $row['packageDate'], 'packageVersion' => $row['packageVersion'], - 'servers' => array() - ); + 'servers' => [] + ]; } // server data - $updates[$existingVersion['packageID']]['versions'][$row['packageVersion']]['servers'][] = array( + $updates[$existingVersion['packageID']]['versions'][$row['packageVersion']]['servers'][] = [ 'packageUpdateID' => $row['packageUpdateID'], 'packageUpdateServerID' => $row['packageUpdateServerID'], 'packageUpdateVersionID' => $row['packageUpdateVersionID'], 'filename' => $row['filename'] - ); + ]; } } } @@ -575,7 +575,7 @@ class PackageUpdateDispatcher extends SingletonFactory { // sort package versions // and remove old versions foreach ($updates as $packageID => $data) { - uksort($updates[$packageID]['versions'], array('wcf\data\package\Package', 'compareVersion')); + uksort($updates[$packageID]['versions'], ['wcf\data\package\Package', 'compareVersion']); $updates[$packageID]['version'] = end($updates[$packageID]['versions']); } @@ -593,7 +593,7 @@ class PackageUpdateDispatcher extends SingletonFactory { // remove older minor releases from list, e.g. only display 1.0.2, even if 1.0.1 is available if ($removeOlderMinorReleases) { foreach ($updates as &$updateData) { - $highestVersions = array(); + $highestVersions = []; foreach ($updateData['versions'] as $versionNumber => $dummy) { if (preg_match('~^(\d+\.\d+)\.~', $versionNumber, $matches)) { $major = $matches[1]; @@ -634,7 +634,7 @@ class PackageUpdateDispatcher extends SingletonFactory { ON (p.package = pur.package) WHERE pur.packageUpdateVersionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageUpdateVersionID)); + $statement->execute([$packageUpdateVersionID]); while ($row = $statement->fetchArray()) { if (isset($updates[$row['packageID']])) { $updates = $this->removeUpdateRequirements($updates, $updates[$row['packageID']]['version']['servers'][0]['packageUpdateVersionID']); @@ -672,7 +672,7 @@ class PackageUpdateDispatcher extends SingletonFactory { } // get versions - $versions = array(); + $versions = []; $sql = "SELECT puv.*, pu.*, pus.loginUsername, pus.loginPassword FROM wcf".WCF_N."_package_update_version puv LEFT JOIN wcf".WCF_N."_package_update pu @@ -683,11 +683,11 @@ class PackageUpdateDispatcher extends SingletonFactory { AND puv.packageVersion = ? AND pus.isDisabled = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $package, $version, 0 - )); + ]); while ($row = $statement->fetchArray()) { $versions[] = $row; } @@ -707,7 +707,7 @@ class PackageUpdateDispatcher extends SingletonFactory { */ public function getNewestPackageVersion($package) { // get all versions - $versions = array(); + $versions = []; $sql = "SELECT packageVersion FROM wcf".WCF_N."_package_update_version WHERE packageUpdateID IN ( @@ -716,13 +716,13 @@ class PackageUpdateDispatcher extends SingletonFactory { WHERE package = ? )"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($package)); + $statement->execute([$package]); while ($row = $statement->fetchArray()) { $versions[$row['packageVersion']] = $row['packageVersion']; } // sort by version number - usort($versions, array('wcf\data\package\Package', 'compareVersion')); + usort($versions, ['wcf\data\package\Package', 'compareVersion']); // take newest (last) return array_pop($versions); @@ -738,7 +738,7 @@ class PackageUpdateDispatcher extends SingletonFactory { public function cacheDownload($package, $version, $filename) { $cachedDownloads = WCF::getSession()->getVar('cachedPackageUpdateDownloads'); if (!is_array($cachedDownloads)) { - $cachedDownloads = array(); + $cachedDownloads = []; } // store in session diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php index eb32740b35..484c7d4fc2 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php @@ -20,7 +20,7 @@ class PackageUpdateUnauthorizedException extends UserException { * package update version * @var array */ - protected $packageUpdateVersion = array(); + protected $packageUpdateVersion = []; /** * HTTP request object @@ -41,7 +41,7 @@ class PackageUpdateUnauthorizedException extends UserException { * @param \wcf\data\package\update\server\PackageUpdateServer $updateServer * @param array $packageUpdateVersion */ - public function __construct(HTTPRequest $request, PackageUpdateServer $updateServer, array $packageUpdateVersion = array()) { + public function __construct(HTTPRequest $request, PackageUpdateServer $updateServer, array $packageUpdateVersion = []) { $this->request = $request; $this->updateServer = $updateServer; $this->packageUpdateVersion = $packageUpdateVersion; @@ -53,11 +53,11 @@ class PackageUpdateUnauthorizedException extends UserException { * @return string */ public function getRenderedTemplate() { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'packageUpdateVersion' => $this->packageUpdateVersion, 'request' => $this->request, 'updateServer' => $this->updateServer - )); + ]); return WCF::getTPL()->fetch('packageUpdateUnauthorized'); } diff --git a/wcfsetup/install/files/lib/system/package/TemplatesFileHandler.class.php b/wcfsetup/install/files/lib/system/package/TemplatesFileHandler.class.php index da6d7962a4..40c47b1def 100644 --- a/wcfsetup/install/files/lib/system/package/TemplatesFileHandler.class.php +++ b/wcfsetup/install/files/lib/system/package/TemplatesFileHandler.class.php @@ -37,14 +37,14 @@ class TemplatesFileHandler extends ACPTemplatesFileHandler { unset($file); // get existing templates - $existingTemplates = $updateTemplateIDs = array(); + $existingTemplates = $updateTemplateIDs = []; $sql = "SELECT templateName, templateID FROM wcf".WCF_N."_template WHERE packageID = ? AND application = ? AND templateGroupID IS NULL"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID, $this->application)); + $statement->execute([$packageID, $this->application]); while ($row = $statement->fetchArray()) { $existingTemplates[$row['templateName']] = $row['templateID']; } @@ -60,24 +60,24 @@ class TemplatesFileHandler extends ACPTemplatesFileHandler { continue; } - $statement->execute(array( + $statement->execute([ $packageID, $file, TIME_NOW, $this->application - )); + ]); } if (!empty($updateTemplateIDs)) { // update old templates $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('templateID IN (?)', array($updateTemplateIDs)); + $conditionBuilder->add('templateID IN (?)', [$updateTemplateIDs]); $sql = "UPDATE wcf".WCF_N."_template SET lastModificationTime = ? ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array(TIME_NOW), $conditionBuilder->getParameters())); + $statement->execute(array_merge([TIME_NOW], $conditionBuilder->getParameters())); } } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php index d4685fb01e..243916cfd9 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACLOptionPackageInstallationPlugin.class.php @@ -23,7 +23,7 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati * list of loaded acl object type ids sorted by their option type name * @var integer[] */ - protected $optionTypeIDs = array(); + protected $optionTypeIDs = []; /** * @see \wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName @@ -41,7 +41,7 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati protected function importCategories(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:categories/ns:category'); foreach ($elements as $element) { - $data = array('categoryName' => $element->getAttribute('name')); + $data = ['categoryName' => $element->getAttribute('name')]; // get child elements $children = $xpath->query('child::*', $element); @@ -66,11 +66,11 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati AND objectTypeID = ? AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $category['categoryName'], $objectTypeID, $this->installation->getPackageID() - )); + ]); $row = $statement->fetchArray(); if (!$row) { // insert new category @@ -78,11 +78,11 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati (packageID, objectTypeID, categoryName) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), $objectTypeID, $category['categoryName'] - )); + ]); } } @@ -95,7 +95,7 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati protected function importOptions(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:options/ns:option'); foreach ($elements as $element) { - $data = array(); + $data = []; $children = $xpath->query('child::*', $element); foreach ($children as $child) { $data[$child->tagName] = $child->nodeValue; @@ -110,21 +110,21 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati WHERE categoryName = ? AND objectTypeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $data['categoryname'], $objectTypeID - )); + ]); if (!$statement->fetchSingleColumn()) { throw new SystemException("unknown category '".$data['categoryname']."' for acl object type '".$data['objecttype']."' given"); } } - $data = array( + $data = [ 'categoryName' => (isset($data['categoryname'])) ? $data['categoryname'] : '', 'optionName' => $element->getAttribute('name'), 'objectTypeID' => $objectTypeID - ); + ]; // check for option existence $sql = "SELECT optionID @@ -133,33 +133,33 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati AND objectTypeID = ? AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $data['optionName'], $data['objectTypeID'], $this->installation->getPackageID() - )); + ]); $row = $statement->fetchArray(); if (!$row) { $sql = "INSERT INTO wcf".WCF_N."_".$this->tableName." (packageID, objectTypeID, optionName, categoryName) VALUES (?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), $data['objectTypeID'], $data['optionName'], $data['categoryName'] - )); + ]); } else { $sql = "UPDATE wcf".WCF_N."_".$this->tableName." SET categoryName = ? WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $data['categoryName'], $row['optionID'] - )); + ]); } } } @@ -190,7 +190,7 @@ class ACLOptionPackageInstallationPlugin extends AbstractOptionPackageInstallati WHERE definitionName = 'com.woltlab.wcf.acl' )"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array($optionType)); + $statement->execute([$optionType]); $row = $statement->fetchArray(); if (!$row) { throw new SystemException("unknown object type '".$optionType."' given"); diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACPSearchProviderPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACPSearchProviderPackageInstallationPlugin.class.php index d315bf091a..e64cf587f0 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACPSearchProviderPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACPSearchProviderPackageInstallationPlugin.class.php @@ -30,10 +30,10 @@ class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInsta WCF::getDB()->beginTransaction(); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -46,11 +46,11 @@ class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInsta $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null; $showOrder = $this->getShowOrder($showOrder); - return array( + return [ 'className' => $data['elements']['classname'], 'providerName' => $data['attributes']['name'], 'showOrder' => $showOrder - ); + ]; } /** @@ -61,15 +61,15 @@ class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInsta FROM wcf".WCF_N."_".$this->tableName." WHERE providerName = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['providerName'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php index 7e83a8bd68..2ef0f9bf06 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACPTemplatePackageInstallationPlugin.class.php @@ -61,12 +61,12 @@ class ACPTemplatePackageInstallationPlugin extends AbstractPackageInstallationPl FROM wcf".WCF_N."_acp_template WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); - $templates = array(); + $templates = []; while ($row = $statement->fetchArray()) { if (!isset($templates[$row['application']])) { - $templates[$row['application']] = array(); + $templates[$row['application']] = []; } $templates[$row['application']][] = 'acp/templates/'.$row['templateName'].'.tpl'; diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractMenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractMenuPackageInstallationPlugin.class.php index 9ad13b0cd7..26b091273f 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractMenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractMenuPackageInstallationPlugin.class.php @@ -23,10 +23,10 @@ abstract class AbstractMenuPackageInstallationPlugin extends AbstractXMLPackageI AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -40,7 +40,7 @@ abstract class AbstractMenuPackageInstallationPlugin extends AbstractXMLPackageI $showOrder = $this->getShowOrder($showOrder, $parent, 'parentMenuItem'); // merge values and default values - return array( + return [ 'menuItem' => $data['attributes']['name'], 'menuItemController' => isset($data['elements']['controller']) ? $data['elements']['controller'] : '', 'menuItemLink' => (isset($data['elements']['link'])) ? $data['elements']['link'] : '', @@ -48,7 +48,7 @@ abstract class AbstractMenuPackageInstallationPlugin extends AbstractXMLPackageI 'parentMenuItem' => (isset($data['elements']['parent'])) ? $data['elements']['parent'] : '', 'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : '', 'showOrder' => $showOrder - ); + ]; } /** @@ -63,7 +63,7 @@ abstract class AbstractMenuPackageInstallationPlugin extends AbstractXMLPackageI FROM ".$this->application.WCF_N."_".$this->tableName." WHERE menuItem = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($data['parentMenuItem'])); + $statement->execute([$data['parentMenuItem']]); if (!$statement->fetchSingleColumn()) { throw new SystemException("Unable to find parent 'menu item' with name '".$data['parentMenuItem']."' for 'menu item' with name '".$data['menuItem']."'."); @@ -78,14 +78,14 @@ abstract class AbstractMenuPackageInstallationPlugin extends AbstractXMLPackageI FROM ".$this->application.WCF_N."_".$this->tableName." WHERE menuItem = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['menuItem'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php index 4604fd7fd5..7deb85c73d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php @@ -41,7 +41,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag protected function deleteItems(\DOMXPath $xpath) { // delete options $elements = $xpath->query('/ns:data/ns:delete/ns:option'); - $options = array(); + $options = []; foreach ($elements as $element) { $options[] = $element->getAttribute('name'); } @@ -53,16 +53,16 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag $statement = WCF::getDB()->prepareStatement($sql); foreach ($options as $option) { - $statement->execute(array( + $statement->execute([ $option, $this->installation->getPackageID() - )); + ]); } } // delete categories $elements = $xpath->query('/ns:data/ns:delete/ns:optioncategory'); - $categories = array(); + $categories = []; foreach ($elements as $element) { $categories[] = $element->getAttribute('name'); } @@ -74,10 +74,10 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($categories as $category) { - $statement->execute(array( + $statement->execute([ $category, $this->installation->getPackageID() - )); + ]); } // delete categories @@ -87,10 +87,10 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag $statement = WCF::getDB()->prepareStatement($sql); foreach ($categories as $category) { - $statement->execute(array( + $statement->execute([ $category, $this->installation->getPackageID() - )); + ]); } } } @@ -104,7 +104,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag protected function importCategories(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:categories/ns:category'); foreach ($elements as $element) { - $data = array(); + $data = []; // get child elements $children = $xpath->query('child::*', $element); @@ -113,13 +113,13 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag } // build data block with defaults - $data = array( + $data = [ 'categoryName' => $element->getAttribute('name'), 'options' => (isset($data['options'])) ? $data['options'] : '', 'parentCategoryName' => (isset($data['parent'])) ? $data['parent'] : '', 'permissions' => (isset($data['permissions'])) ? $data['permissions'] : '', 'showOrder' => (isset($data['showorder'])) ? intval($data['showorder']) : null - ); + ]; // adjust show order if ($data['showOrder'] !== null || $this->installation->getAction() != 'update') { @@ -132,7 +132,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag FROM ".$this->application.WCF_N."_".$this->tableName."_category WHERE categoryName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($data['parentCategoryName'])); + $statement->execute([$data['parentCategoryName']]); if (!$statement->fetchSingleColumn()) { throw new SystemException("Unable to find parent 'option category' with name '".$data['parentCategoryName']."' for category with name '".$data['categoryName']."'."); @@ -153,7 +153,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag protected function importOptions(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:options/ns:option'); foreach ($elements as $element) { - $data = array(); + $data = []; $children = $xpath->query('child::*', $element); foreach ($children as $child) { $data[$child->tagName] = $child->nodeValue; @@ -162,7 +162,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag $data['name'] = $element->getAttribute('name'); if (!preg_match("/^[\w-\.]+$/", $data['name'])) { - $matches = array(); + $matches = []; preg_match_all("/(\W)/", $data['name'], $matches); throw new SystemException("The option '".$data['name']."' has at least one non-alphanumeric character (underscore is permitted): (".implode("), ( ", $matches[1]).")."); } @@ -180,7 +180,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag FROM ".$this->application.WCF_N."_".$this->tableName."_category WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); return ($hasUninstallOptions || $statement->fetchSingleColumn() > 0); } @@ -196,7 +196,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag $sql = "DELETE FROM ".$this->application.WCF_N."_".$this->tableName."_category WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); } /** @@ -211,9 +211,9 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag FROM ".$this->application.WCF_N."_".$this->tableName."_category WHERE categoryName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $category['categoryName'] - )); + ]); $row = $statement->fetchArray(); if (empty($row['categoryID'])) { // insert new category @@ -223,13 +223,13 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag VALUES (?, ?, ?, ?, ?".($category['showOrder'] !== null ? ", ?" : "").")"; $statement = WCF::getDB()->prepareStatement($sql); - $data = array( + $data = [ $this->installation->getPackageID(), $category['categoryName'], $category['parentCategoryName'], $category['permissions'], $category['options'] - ); + ]; if ($category['showOrder'] !== null) $data[] = $category['showOrder']; $statement->execute($data); @@ -248,11 +248,11 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag WHERE categoryID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $data = array( + $data = [ $category['parentCategoryName'], $category['permissions'], $category['options'] - ); + ]; if ($category['showOrder'] !== null) $data[] = $category['showOrder']; $data[] = $row['categoryID']; diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php index d48b6df7d3..5cad28189e 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php @@ -38,7 +38,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation * install/update instructions * @var array */ - public $instruction = array(); + public $instruction = []; /** * Creates a new AbstractPackageInstallationPlugin object. @@ -46,7 +46,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation * @param \wcf\system\package\PackageInstallationDispatcher $installation * @param array $instruction */ - public function __construct(PackageInstallationDispatcher $installation, $instruction = array()) { + public function __construct(PackageInstallationDispatcher $installation, $instruction = []) { $this->installation = $installation; $this->instruction = $instruction; @@ -83,7 +83,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation FROM ".$this->application.WCF_N."_".$this->tableName." WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); return $statement->fetchSingleColumn() > 0; } @@ -98,7 +98,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation $sql = "DELETE FROM ".$this->application.WCF_N."_".$this->tableName." WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractXMLPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractXMLPackageInstallationPlugin.class.php index 2555aed7a5..5c99dc32dc 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractXMLPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractXMLPackageInstallationPlugin.class.php @@ -35,12 +35,12 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta /** * @see \wcf\system\package\plugin\AbstractPackageInstallationPlugin::install() */ - public function __construct(PackageInstallationDispatcher $installation, $instruction = array()) { + public function __construct(PackageInstallationDispatcher $installation, $instruction = []) { parent::__construct($installation, $instruction); // autoset 'tableName' property if (empty($this->tableName) && !empty($this->className)) { - $this->tableName = call_user_func(array($this->className, 'getDatabaseTableAlias')); + $this->tableName = call_user_func([$this->className, 'getDatabaseTableAlias']); } // autoset 'tagName' property @@ -88,13 +88,13 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta */ protected function deleteItems(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:delete/ns:'.$this->tagName); - $items = array(); + $items = []; foreach ($elements as $element) { - $data = array( - 'attributes' => array(), - 'elements' => array(), + $data = [ + 'attributes' => [], + 'elements' => [], 'value' => $element->nodeValue - ); + ]; // get attributes $attributes = $xpath->query('attribute::*', $element); @@ -125,11 +125,11 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta protected function importItems(\DOMXPath $xpath) { $elements = $xpath->query('/ns:data/ns:import/ns:'.$this->tagName); foreach ($elements as $element) { - $data = array( - 'attributes' => array(), - 'elements' => array(), + $data = [ + 'attributes' => [], + 'elements' => [], 'nodeValue' => '' - ); + ]; // fetch attributes $attributes = $xpath->query('attribute::*', $element); @@ -166,7 +166,7 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta } // ensure a valid parameter for import() - if ($row === false) $row = array(); + if ($row === false) $row = []; // import items $this->import($row, $data); @@ -252,11 +252,11 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta // create new item $this->prepareCreate($data); - return call_user_func(array($this->className, 'create'), $data); + return call_user_func([$this->className, 'create'], $data); } else { // update existing item - $baseClass = call_user_func(array($this->className, 'getBaseClass')); + $baseClass = call_user_func([$this->className, 'getBaseClass']); /** @var \wcf\data\DatabaseObjectEditor $itemEditor */ $itemEditor = new $this->className(new $baseClass(null, $row)); @@ -374,7 +374,7 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta if ($showOrder === null) { // get greatest showOrder value $conditions = new PreparedStatementConditionBuilder(); - if ($columnName !== null) $conditions->add($columnName." = ?", array($parentName)); + if ($columnName !== null) $conditions->add($columnName." = ?", [$parentName]); $sql = "SELECT MAX(showOrder) AS showOrder FROM ".$this->application.WCF_N."_".$this->tableName.$tableNameExtension." @@ -392,7 +392,7 @@ abstract class AbstractXMLPackageInstallationPlugin extends AbstractPackageInsta ".($columnName !== null ? "AND ".$columnName." = ?" : ""); $statement = WCF::getDB()->prepareStatement($sql); - $data = array($showOrder); + $data = [$showOrder]; if ($columnName !== null) $data[] = $parentName; $statement->execute($data); diff --git a/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php index c2d8216712..bd71e3ac68 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ClipboardActionPackageInstallationPlugin.class.php @@ -22,7 +22,7 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall * list of pages per action id * @var mixed[][] */ - protected $pages = array(); + protected $pages = []; /** * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName @@ -39,11 +39,11 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $item['elements']['actionclassname'], $this->installation->getPackageID() - )); + ]); } } @@ -55,7 +55,7 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall // read pages if ($element->tagName == 'pages') { - $nodeValue = array(); + $nodeValue = []; $pages = $xpath->query('child::ns:page', $element); foreach ($pages as $page) { @@ -73,12 +73,12 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall $showOrder = (isset($data['elements']['showorder'])) ? intval($data['elements']['showorder']) : null; $showOrder = $this->getShowOrder($showOrder, $data['elements']['actionclassname'], 'actionClassName'); - return array( + return [ 'actionClassName' => $data['elements']['actionclassname'], 'actionName' => $data['attributes']['name'], 'pages' => $data['elements']['pages'], 'showOrder' => $showOrder - ); + ]; } /** @@ -90,16 +90,16 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall WHERE actionName = ? AND actionClassName = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['actionName'], $data['actionClassName'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** @@ -125,7 +125,7 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall $sql = "DELETE FROM wcf".WCF_N."_clipboard_page WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); if (!empty($this->pages)) { // insert pages @@ -135,11 +135,11 @@ class ClipboardActionPackageInstallationPlugin extends AbstractXMLPackageInstall $statement = WCF::getDB()->prepareStatement($sql); foreach ($this->pages as $actionID => $pages) { foreach ($pages as $pageClassName) { - $statement->execute(array( + $statement->execute([ $pageClassName, $this->installation->getPackageID(), $actionID - )); + ]); } } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/CoreObjectPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/CoreObjectPackageInstallationPlugin.class.php index 476b554ed6..57fab8f70c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/CoreObjectPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/CoreObjectPackageInstallationPlugin.class.php @@ -28,10 +28,10 @@ class CoreObjectPackageInstallationPlugin extends AbstractXMLPackageInstallation AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -39,9 +39,9 @@ class CoreObjectPackageInstallationPlugin extends AbstractXMLPackageInstallation * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport() */ protected function prepareImport(array $data) { - return array( + return [ 'objectName' => $data['elements']['objectname'] - ); + ]; } /** @@ -52,15 +52,15 @@ class CoreObjectPackageInstallationPlugin extends AbstractXMLPackageInstallation FROM wcf".WCF_N."_".$this->tableName." WHERE objectName = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['objectName'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php index ac5527ab2f..b0a913455c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php @@ -27,7 +27,7 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu protected function getElement(\DOMXPath $xpath, array &$elements, \DOMElement $element) { if ($element->tagName == 'description') { if (!isset($elements['description'])) { - $elements['description'] = array(); + $elements['description'] = []; } $elements['description'][$element->getAttribute('language')] = $element->nodeValue; @@ -53,16 +53,16 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu foreach ($items as $item) { if (!isset($item['attributes']['name'])) { - $legacyStatement->execute(array( + $legacyStatement->execute([ $item['elements']['classname'], $this->installation->getPackageID() - )); + ]); } else { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } } @@ -71,7 +71,7 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport() */ protected function prepareImport(array $data) { - return array( + return [ 'canBeDisabled' => (isset($data['elements']['canbedisabled'])) ? intval($data['elements']['canbedisabled']) : 1, 'canBeEdited' => (isset($data['elements']['canbeedited'])) ? intval($data['elements']['canbeedited']) : 1, 'className' => (isset($data['elements']['classname'])) ? $data['elements']['classname'] : '', @@ -84,7 +84,7 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu 'startHour' => $data['elements']['starthour'], 'startMinute' => $data['elements']['startminute'], 'startMonth' => $data['elements']['startmonth'] - ); + ]; } /** @@ -109,9 +109,9 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu // update cronjob name if (!$cronjob->cronjobName) { $cronjobEditor = new CronjobEditor($cronjob); - $cronjobEditor->update(array( + $cronjobEditor->update([ 'cronjobName' => Cronjob::AUTOMATIC_NAME_PREFIX.$cronjob->cronjobID - )); + ]); $cronjob = new Cronjob($cronjob->cronjobID); } @@ -129,15 +129,15 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu FROM wcf".WCF_N."_".$this->tableName." WHERE packageID = ? AND cronjobName = ?"; - $parameters = array( + $parameters = [ $this->installation->getPackageID(), $data['cronjobName'] - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php index 4af83f14c1..66bbcd9b1e 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/EventListenerPackageInstallationPlugin.class.php @@ -46,20 +46,20 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat foreach ($items as $item) { if (!isset($item['attributes']['name'])) { - $legacyStatement->execute(array( + $legacyStatement->execute([ $this->installation->getPackageID(), (isset($item['elements']['environment']) ? $item['elements']['environment'] : 'user'), $item['elements']['eventclassname'], $item['elements']['eventname'], (isset($item['elements']['inherit'])) ? $item['elements']['inherit'] : 0, $item['elements']['listenerclassname'] - )); + ]); } else { - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), $item['attributes']['name'] - )); + ]); } } } @@ -72,7 +72,7 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat if ($nice < -128) $nice = -128; else if ($nice > 127) $nice = 127; - return array( + return [ 'environment' => (isset($data['elements']['environment']) ? $data['elements']['environment'] : 'user'), 'eventClassName' => $data['elements']['eventclassname'], 'eventName' => $data['elements']['eventname'], @@ -82,7 +82,7 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat 'niceValue' => $nice, 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : ''), 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '') - ); + ]; } /** @@ -100,9 +100,9 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat // update event listener name if (!$eventListener->listenerName) { $eventListenerEditor = new EventListenerEditor($eventListener); - $eventListenerEditor->update(array( + $eventListenerEditor->update([ 'listenerName' => EventListener::AUTOMATIC_NAME_PREFIX.$eventListener->listenerID - )); + ]); $eventListener = new EventListener($eventListener->listenerID); } @@ -122,29 +122,29 @@ class EventListenerPackageInstallationPlugin extends AbstractXMLPackageInstallat AND eventClassName = ? AND eventName = ? AND listenerClassName = ?"; - $parameters = array( + $parameters = [ $this->installation->getPackageID(), $data['environment'], $data['eventClassName'], $data['eventName'], $data['listenerClassName'] - ); + ]; } else { $sql = "SELECT * FROM wcf".WCF_N."_".$this->tableName." WHERE packageID = ? AND listenerName = ?"; - $parameters = array( + $parameters = [ $this->installation->getPackageID(), $data['listenerName'] - ); + ]; } - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php index c41c485ae8..7d57ce6d48 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/FilePackageInstallationPlugin.class.php @@ -63,11 +63,11 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin { (packageID, filename, application) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), 'config.inc.php', Package::getAbbreviation($this->installation->getPackage()->package) - )); + ]); // load application WCF::loadRuntimeApplication($this->installation->getPackageID()); @@ -89,12 +89,12 @@ class FilePackageInstallationPlugin extends AbstractPackageInstallationPlugin { FROM wcf".WCF_N."_package_installation_file_log WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); - $files = array(); + $files = []; while ($row = $statement->fetchArray()) { if (!isset($files[$row['application']])) { - $files[$row['application']] = array(); + $files[$row['application']] = []; } $files[$row['application']][] = $row['filename']; diff --git a/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php index b8950e513f..456942675d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/LanguagePackageInstallationPlugin.class.php @@ -31,7 +31,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl AbstractPackageInstallationPlugin::install(); // get language files - $languageFiles = array(); + $languageFiles = []; $multipleFiles = false; $filename = $this->instruction['value']; if (strpos($filename, '*') !== false) { @@ -69,7 +69,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl } // get installed languages - $installedLanguages = array(); + $installedLanguages = []; $sql = "SELECT * FROM wcf".WCF_N."_language ORDER BY isDefault DESC"; @@ -149,9 +149,9 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl FROM wcf".WCF_N."_language_item WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); - $itemIDs = array(); - $categoryIDs = array(); + $statement->execute([$this->installation->getPackageID()]); + $itemIDs = []; + $categoryIDs = []; while ($row = $statement->fetchArray()) { $itemIDs[] = $row['languageItemID']; @@ -166,10 +166,10 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl $statement = WCF::getDB()->prepareStatement($sql); foreach ($itemIDs as $itemID) { - $statement->execute(array( + $statement->execute([ $itemID, $this->installation->getPackageID() - )); + ]); } $this->deleteEmptyCategories(array_keys($categoryIDs), $this->installation->getPackageID()); @@ -207,7 +207,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl protected function deleteEmptyCategories(array $categoryIDs, $packageID) { // Get empty categories which where changed by this package. $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("language_category.languageCategoryID IN (?)", array($categoryIDs)); + $conditions->add("language_category.languageCategoryID IN (?)", [$categoryIDs]); $sql = "SELECT COUNT(item.languageItemID) AS count, language_category.languageCategoryID, @@ -220,7 +220,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl language_category.languageCategory ASC"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $categoriesToDelete = array(); + $categoriesToDelete = []; while ($row = $statement->fetchArray()) { if ($row['count'] == 0) { $categoriesToDelete[$row['languageCategoryID']] = $row['languageCategory']; @@ -234,7 +234,7 @@ class LanguagePackageInstallationPlugin extends AbstractXMLPackageInstallationPl $statement = WCF::getDB()->prepareStatement($sql); foreach ($categoriesToDelete as $category) { - $statement->execute(array($category)); + $statement->execute([$category]); } } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php index f182713164..d61d6f77a0 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php @@ -156,15 +156,15 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl FROM wcf".WCF_N."_menu_item WHERE identifier = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['identifier'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index 69f9f2c78e..2e33f206c0 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -161,15 +161,15 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin FROM wcf".WCF_N."_menu WHERE identifier = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['identifier'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/ObjectTypeDefinitionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ObjectTypeDefinitionPackageInstallationPlugin.class.php index 56bef31660..2c7f003cb1 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ObjectTypeDefinitionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ObjectTypeDefinitionPackageInstallationPlugin.class.php @@ -32,10 +32,10 @@ class ObjectTypeDefinitionPackageInstallationPlugin extends AbstractXMLPackageIn AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -43,11 +43,11 @@ class ObjectTypeDefinitionPackageInstallationPlugin extends AbstractXMLPackageIn * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport() */ protected function prepareImport(array $data) { - return array( + return [ 'interfaceName' => (isset($data['elements']['interfacename']) ? $data['elements']['interfacename'] : ''), 'definitionName' => $data['elements']['name'], 'categoryName' => (isset($data['elements']['categoryname']) ? $data['elements']['categoryname'] : '') - ); + ]; } /** @@ -57,11 +57,11 @@ class ObjectTypeDefinitionPackageInstallationPlugin extends AbstractXMLPackageIn $sql = "SELECT * FROM wcf".WCF_N."_".$this->tableName." WHERE definitionName = ?"; - $parameters = array($data['definitionName']); + $parameters = [$data['definitionName']]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php index 96005cfe06..9e2ad9f73c 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php @@ -28,7 +28,7 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation * list of names of tags which aren't considered as additional data * @var string[] */ - public static $reservedTags = array('classname', 'definitionname', 'name'); + public static $reservedTags = ['classname', 'definitionname', 'name']; /** * Gets the definition id by name @@ -43,7 +43,7 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation FROM wcf".WCF_N."_object_type_definition WHERE definitionName = ?"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array($definitionName)); + $statement->execute([$definitionName]); $row = $statement->fetchArray(); if (empty($row['definitionID'])) throw new SystemException("unknown object type definition '".$definitionName."' given"); return $row['definitionID']; @@ -59,11 +59,11 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->getDefinitionID($item['elements']['definitionname']), $this->installation->getPackageID() - )); + ]); } } @@ -71,17 +71,17 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport() */ protected function prepareImport(array $data) { - $additionalData = array(); + $additionalData = []; foreach ($data['elements'] as $tagName => $nodeValue) { if (!in_array($tagName, self::$reservedTags)) $additionalData[$tagName] = $nodeValue; } - return array( + return [ 'definitionID' => $this->getDefinitionID($data['elements']['definitionname']), 'objectType' => $data['elements']['name'], 'className' => (isset($data['elements']['classname']) ? $data['elements']['classname'] : ''), 'additionalData' => serialize($additionalData) - ); + ]; } /** @@ -93,15 +93,15 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation WHERE objectType = ? AND definitionID = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['objectType'], $data['definitionID'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php index f322915fda..2e50ff3f8f 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php @@ -26,7 +26,7 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP * list of names of tags which aren't considered as additional data * @var string[] */ - public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'validationpattern', 'enableoptions', 'showorder', 'hidden', 'selectoptions', 'categoryname', 'permissions', 'options', 'attrs', 'cdata', 'supporti18n', 'requirei18n'); + public static $reservedTags = ['name', 'optiontype', 'defaultvalue', 'validationpattern', 'enableoptions', 'showorder', 'hidden', 'selectoptions', 'categoryname', 'permissions', 'options', 'attrs', 'cdata', 'supporti18n', 'requirei18n']; /** * @see \wcf\system\package\plugin\AbstractOptionPackageInstallationPlugin::saveOption() @@ -53,13 +53,13 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP if (isset($option['requirei18n'])) $requireI18n = $option['requirei18n']; // collect additional tags and their values - $additionalData = array(); + $additionalData = []; foreach ($option as $tag => $value) { if (!in_array($tag, self::$reservedTags)) $additionalData[$tag] = $value; } // build update or create data - $data = array( + $data = [ 'categoryName' => $categoryName, 'optionType' => $optionType, 'validationPattern' => $validationPattern, @@ -72,16 +72,16 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP 'supportI18n' => $supportI18n, 'requireI18n' => $requireI18n, 'additionalData' => serialize($additionalData) - ); + ]; // try to find an existing option for updating $sql = "SELECT * FROM wcf".WCF_N."_".$this->tableName." WHERE optionName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $optionName - )); + ]); $row = $statement->fetchArray(); // result was 'false' thus create a new item diff --git a/wcfsetup/install/files/lib/system/package/plugin/PIPPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/PIPPackageInstallationPlugin.class.php index 0b8a65d662..15efd7be45 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/PIPPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/PIPPackageInstallationPlugin.class.php @@ -32,10 +32,10 @@ class PIPPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -43,11 +43,11 @@ class PIPPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport() */ protected function prepareImport(array $data) { - return array( + return [ 'className' => $data['nodeValue'], 'pluginName' => $data['attributes']['name'], 'priority' => ($this->installation->getPackage()->package == 'com.woltlab.wcf' ? 1 : 0) - ); + ]; } /** @@ -66,14 +66,14 @@ class PIPPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin FROM wcf".WCF_N."_".$this->tableName." WHERE pluginName = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['pluginName'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php index 360f4dff01..61ac9a54de 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php @@ -34,7 +34,7 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin { // replace app1_ with app{WCF_N}_ in the table names for // all applications $packageList = new PackageList(); - $packageList->getConditionBuilder()->add('package.isApplication = ?', array(1)); + $packageList->getConditionBuilder()->add('package.isApplication = ?', [1]); $packageList->readObjects(); foreach ($packageList as $package) { $abbreviation = Package::getAbbreviation($package->package); @@ -46,8 +46,8 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin { $parser = new PackageInstallationSQLParser($queries, $this->installation->getPackage(), $this->installation->getAction()); $conflicts = $parser->test(); if (!empty($conflicts) && (isset($conflicts['CREATE TABLE']) || isset($conflicts['DROP TABLE']))) { - $unknownCreateTable = isset($conflicts['CREATE TABLE']) ? $conflicts['CREATE TABLE'] : array(); - $unknownDropTable = isset($conflicts['DROP TABLE']) ? $conflicts['DROP TABLE'] : array(); + $unknownCreateTable = isset($conflicts['CREATE TABLE']) ? $conflicts['CREATE TABLE'] : []; + $unknownDropTable = isset($conflicts['DROP TABLE']) ? $conflicts['DROP TABLE'] : []; $errorMessage = "Can't"; if (!empty($unknownDropTable)) { @@ -90,8 +90,8 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin { WHERE packageID = ? ORDER BY sqlIndex DESC, sqlColumn DESC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); - $entries = array(); + $statement->execute([$this->installation->getPackageID()]); + $entries = []; while ($row = $statement->fetchArray()) { $entries[] = $row; } diff --git a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php index bed9141c32..c7cccb3886 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php @@ -53,10 +53,10 @@ class ScriptPackageInstallationPlugin extends AbstractPackageInstallationPlugin WHERE packageID = ? AND filename = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), $this->instruction['value'] - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/SitemapPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/SitemapPackageInstallationPlugin.class.php index cdd0fef676..bb1538440b 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/SitemapPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/SitemapPackageInstallationPlugin.class.php @@ -28,10 +28,10 @@ class SitemapPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -42,13 +42,13 @@ class SitemapPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu $showOrder = (isset($data['elements']['showOrder'])) ? intval($data['elements']['showOrder']) : null; $showOrder = $this->getShowOrder($showOrder, null, 'showOrder'); - return array( + return [ 'sitemapName' => $data['attributes']['name'], 'className' => $data['elements']['classname'], 'showOrder' => $showOrder, 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '', 'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : '' - ); + ]; } /** @@ -59,15 +59,15 @@ class SitemapPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu FROM wcf".WCF_N."_".$this->tableName." WHERE sitemapName = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['sitemapName'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/SmileyPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/SmileyPackageInstallationPlugin.class.php index dff628fe8c..10cd79266f 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/SmileyPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/SmileyPackageInstallationPlugin.class.php @@ -37,10 +37,10 @@ class SmileyPackageInstallationPlugin extends AbstractXMLPackageInstallationPlug AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -48,12 +48,12 @@ class SmileyPackageInstallationPlugin extends AbstractXMLPackageInstallationPlug * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport() */ protected function prepareImport(array $data) { - return array( + return [ 'smileyCode' => $data['attributes']['name'], 'smileyTitle' => $data['elements']['title'], 'smileyPath' => $data['elements']['path'], 'aliases' => (isset($data['elements']['aliases']) ? $data['elements']['aliases'] : '') - ); + ]; } /** @@ -64,14 +64,14 @@ class SmileyPackageInstallationPlugin extends AbstractXMLPackageInstallationPlug FROM wcf".WCF_N."_".$this->tableName." WHERE smileyCode = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['smileyCode'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/StylePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/StylePackageInstallationPlugin.class.php index 4cec3b5a47..fc69f14c59 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/StylePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/StylePackageInstallationPlugin.class.php @@ -55,7 +55,7 @@ class StylePackageInstallationPlugin extends AbstractPackageInstallationPlugin { // get all style of this package $isDefault = false; $styleList = new StyleList(); - $styleList->getConditionBuilder()->add("packageID = ?", array($this->installation->getPackageID())); + $styleList->getConditionBuilder()->add("packageID = ?", [$this->installation->getPackageID()]); $styleList->readObjects(); foreach ($styleList->getObjects() as $style) { diff --git a/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php index 2b5bab46ed..a5567e445f 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php @@ -31,13 +31,13 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal AND templateName = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), $item['elements']['environment'], $item['elements']['eventname'], $item['attributes']['name'], $item['elements']['templatename'] - )); + ]); } } @@ -53,7 +53,7 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal $niceValue = 127; } - return array( + return [ 'environment' => $data['elements']['environment'], 'eventName' => $data['elements']['eventname'], 'niceValue' => $niceValue, @@ -62,7 +62,7 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : ''), 'templateCode' => $data['elements']['templatecode'], 'templateName' => $data['elements']['templatename'] - ); + ]; } /** @@ -76,18 +76,18 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal AND templateName = ? AND eventName = ? AND environment = ?"; - $parameters = array( + $parameters = [ $this->installation->getPackageID(), $data['name'], $data['templateName'], $data['eventName'], $data['environment'] - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php index 817588c72d..3ff138ce10 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/TemplatePackageInstallationPlugin.class.php @@ -63,12 +63,12 @@ class TemplatePackageInstallationPlugin extends AbstractPackageInstallationPlugi ON (template_group.templateGroupID = template.templateGroupID) WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); - $templates = array(); + $templates = []; while ($row = $statement->fetchArray()) { if (!isset($templates[$row['application']])) { - $templates[$row['application']] = array(); + $templates[$row['application']] = []; } $templates[$row['application']][] = 'templates/'.$row['templateGroupFolderName'].$row['templateName'].'.tpl'; diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php index 162245492c..099737e3ee 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php @@ -31,7 +31,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst * list of names of tags which aren't considered as additional data * @var string[] */ - public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'admindefaultvalue', 'userdefaultvalue', 'moddefaultvalue', 'validationpattern', 'showorder', 'categoryname', 'selectoptions', 'enableoptions', 'permissions', 'options', 'attrs', 'cdata', 'usersonly'); + public static $reservedTags = ['name', 'optiontype', 'defaultvalue', 'admindefaultvalue', 'userdefaultvalue', 'moddefaultvalue', 'validationpattern', 'showorder', 'categoryname', 'selectoptions', 'enableoptions', 'permissions', 'options', 'attrs', 'cdata', 'usersonly']; /** * @see \wcf\system\package\plugin\AbstractOptionPackageInstallationPlugin::saveOption() @@ -58,7 +58,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst if (isset($option['usersonly'])) $usersOnly = $option['usersonly']; // collect additional tags and their values - $additionalData = array(); + $additionalData = []; foreach ($option as $tag => $value) { if (!in_array($tag, self::$reservedTags)) $additionalData[$tag] = $value; } @@ -69,13 +69,13 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst WHERE optionName = ? AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $optionName, $this->installation->getPackageID() - )); + ]); $row = $statement->fetchArray(); - $data = array( + $data = [ 'categoryName' => $categoryName, 'optionType' => $optionType, 'defaultValue' => (isset($option['userdefaultvalue']) ? $userDefaultValue : $defaultValue), @@ -86,7 +86,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst 'options' => $options, 'usersOnly' => $usersOnly, 'additionalData' => serialize($additionalData) - ); + ]; if (!empty($row['optionID'])) { $groupOption = new UserGroupOption(null, $row); @@ -102,7 +102,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst $optionID = $groupOptionEditor->optionID; $this->getGroupIDs(); - $values = array(); + $values = []; foreach ($this->groupIDs['all'] as $groupID) { $values[$groupID] = $defaultValue; } @@ -129,11 +129,11 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($values as $groupID => $value) { - $statement->execute(array( + $statement->execute([ $groupID, $optionID, $value - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -146,12 +146,12 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst */ protected function getGroupIDs() { if ($this->groupIDs === null) { - $this->groupIDs = array( - 'admin' => array(), - 'mod' => array(), - 'all' => array(), - 'registered' => array() - ); + $this->groupIDs = [ + 'admin' => [], + 'mod' => [], + 'all' => [], + 'registered' => [] + ]; $sql = "SELECT groupID, groupType FROM wcf".WCF_N."_user_group"; diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php index 358f78d8a8..9b8e054f8b 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php @@ -33,7 +33,7 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI * preset event ids * @var integer[] */ - protected $presetEventIDs = array(); + protected $presetEventIDs = []; /** * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete() @@ -44,10 +44,10 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI AND eventName = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $this->installation->getPackageID(), $item['elements']['name'] - )); + ]); } } @@ -65,7 +65,7 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI WHERE definitionName = 'com.woltlab.wcf.notification.objectType' )"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array($data['elements']['objecttype'])); + $statement->execute([$data['elements']['objecttype']]); $row = $statement->fetchArray(); if (empty($row['objectTypeID'])) throw new SystemException("unknown notification object type '".$data['elements']['objecttype']."' given"); $objectTypeID = $row['objectTypeID']; @@ -75,7 +75,7 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI $presetMailNotificationType = $data['elements']['presetmailnotificationtype']; } - return array( + return [ 'eventName' => $data['elements']['name'], 'className' => $data['elements']['classname'], 'objectTypeID' => $objectTypeID, @@ -83,7 +83,7 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : ''), 'preset' => (!empty($data['elements']['preset']) ? 1 : 0), 'presetMailNotificationType' => $presetMailNotificationType - ); + ]; } /** @@ -112,7 +112,7 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($this->presetEventIDs as $eventID => $mailNotificationType) { - $statement->execute(array($eventID, $mailNotificationType)); + $statement->execute([$eventID, $mailNotificationType]); } WCF::getDB()->commitTransaction(); } @@ -125,14 +125,14 @@ class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageI FROM wcf".WCF_N."_".$this->tableName." WHERE objectTypeID = ? AND eventName = ?"; - $parameters = array( + $parameters = [ $data['objectTypeID'], $data['eventName'] - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php index 4c42459118..d33379f2c3 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php @@ -27,18 +27,18 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat * list of names of tags which aren't considered as additional data * @var string[] */ - public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'validationpattern', 'required', 'editable', 'visible', 'searchable', 'showorder', 'outputclass', 'selectoptions', 'enableoptions', 'isdisabled', 'categoryname', 'permissions', 'options', 'attrs', 'cdata'); + public static $reservedTags = ['name', 'optiontype', 'defaultvalue', 'validationpattern', 'required', 'editable', 'visible', 'searchable', 'showorder', 'outputclass', 'selectoptions', 'enableoptions', 'isdisabled', 'categoryname', 'permissions', 'options', 'attrs', 'cdata']; /** * @see \wcf\system\package\plugin\AbstractOptionPackageInstallationPlugin::saveCategory() */ protected function saveCategory($category, $categoryXML = null) { // use for create and update - $data = array( + $data = [ 'parentCategoryName' => $category['parentCategoryName'], 'permissions' => $category['permissions'], 'options' => $category['options'] - ); + ]; // append show order if explicitly stated if ($category['showOrder'] !== null) $data['showOrder'] = $category['showOrder']; @@ -89,7 +89,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat if (isset($option['options'])) $options = $option['options']; // collect additional tags and their values - $additionalData = array(); + $additionalData = []; foreach ($option as $tag => $value) { if (!in_array($tag, self::$reservedTags)) $additionalData[$tag] = $value; } @@ -100,14 +100,14 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat WHERE optionName = ? AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $optionName, $this->installation->getPackageID() - )); + ]); $result = $statement->fetchArray(); // build data array - $data = array( + $data = [ 'categoryName' => $categoryName, 'optionType' => $optionType, 'defaultValue' => $defaultValue, @@ -126,7 +126,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat 'options' => $options, 'additionalData' => serialize($additionalData), 'originIsSystem' => 1 - ); + ]; // update option if (!empty($result['optionID']) && $this->installation->getAction() == 'update') { @@ -152,7 +152,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat FROM wcf".WCF_N."_user_option WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->installation->getPackageID())); + $statement->execute([$this->installation->getPackageID()]); while ($row = $statement->fetchArray()) { WCF::getDB()->getEditor()->dropColumn('wcf'.WCF_N.'_user_option_value', 'userOption'.$row['optionID']); } diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserProfileMenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserProfileMenuPackageInstallationPlugin.class.php index ff27f5541b..9951388fc3 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserProfileMenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserProfileMenuPackageInstallationPlugin.class.php @@ -37,10 +37,10 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall AND packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($items as $item) { - $statement->execute(array( + $statement->execute([ $item['attributes']['name'], $this->installation->getPackageID() - )); + ]); } } @@ -53,13 +53,13 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall $showOrder = $this->getShowOrder($showOrder); // merge values and default values - return array( + return [ 'menuItem' => $data['attributes']['name'], 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '', 'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : '', 'showOrder' => $showOrder, 'className' => $data['elements']['classname'] - ); + ]; } /** @@ -70,14 +70,14 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall FROM wcf".WCF_N."_".$this->tableName." WHERE menuItem = ? AND packageID = ?"; - $parameters = array( + $parameters = [ $data['menuItem'], $this->installation->getPackageID() - ); + ]; - return array( + return [ 'sql' => $sql, 'parameters' => $parameters - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php b/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php index dc1fa26025..018e09dcd9 100644 --- a/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php @@ -21,7 +21,7 @@ class PackageValidationArchive implements \RecursiveIterator { * list of excluded packages grouped by package * @var string[] */ - protected static $excludedPackages = array(); + protected static $excludedPackages = []; /** * package archive object @@ -33,7 +33,7 @@ class PackageValidationArchive implements \RecursiveIterator { * list of direct requirements delivered by this package * @var PackageValidationArchive[] */ - protected $children = array(); + protected $children = []; /** * nesting depth @@ -108,11 +108,11 @@ class PackageValidationArchive implements \RecursiveIterator { PackageValidationManager::getInstance()->addVirtualPackage($package, $this->archive->getPackageInfo('version')); // cache excluded packages - self::$excludedPackages[$package] = array(); + self::$excludedPackages[$package] = []; $excludedPackages = $this->archive->getExcludedPackages(); for ($i = 0, $count = count($excludedPackages); $i < $count; $i++) { if (!isset(self::$excludedPackages[$package][$excludedPackages[$i]['name']])) { - self::$excludedPackages[$package][$excludedPackages[$i]['name']] = array(); + self::$excludedPackages[$package][$excludedPackages[$i]['name']] = []; } self::$excludedPackages[$package][$excludedPackages[$i]['name']][] = $excludedPackages[$i]['version']; @@ -128,14 +128,14 @@ class PackageValidationArchive implements \RecursiveIterator { FROM wcf".WCF_N."_package WHERE package = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($requirement['name'])); + $statement->execute([$requirement['name']]); $package = $statement->fetchObject('wcf\data\package\Package'); - throw new PackageValidationException(PackageValidationException::MISSING_REQUIREMENT, array( + throw new PackageValidationException(PackageValidationException::MISSING_REQUIREMENT, [ 'package' => $package, 'packageName' => $requirement['name'], 'packageVersion' => $requirement['minversion'] - )); + ]); } $archive = $this->archive->extractTar($requirement['file']); @@ -192,18 +192,18 @@ class PackageValidationArchive implements \RecursiveIterator { // delivered package does not provide the minimum required version if (Package::compareVersion($requiredVersion, $this->archive->getPackageInfo('version'), '>')) { - throw new PackageValidationException(PackageValidationException::INSUFFICIENT_VERSION, array( + throw new PackageValidationException(PackageValidationException::INSUFFICIENT_VERSION, [ 'packageName' => $package->packageName, 'packageVersion' => $package->packageVersion, 'deliveredPackageVersion' => $this->archive->getPackageInfo('version') - )); + ]); } // package is not installed yet if ($package === null) { $instructions = $this->archive->getInstallInstructions(); if (empty($instructions)) { - throw new PackageValidationException(PackageValidationException::NO_INSTALL_PATH, array('packageName' => $this->archive->getPackageInfo('name'))); + throw new PackageValidationException(PackageValidationException::NO_INSTALL_PATH, ['packageName' => $this->archive->getPackageInfo('name')]); } if ($validationMode == PackageValidationManager::VALIDATION_RECURSIVE) { @@ -213,11 +213,11 @@ class PackageValidationArchive implements \RecursiveIterator { else { // package is already installed, check update path if (!$this->archive->isValidUpdate($package)) { - throw new PackageValidationException(PackageValidationException::NO_UPDATE_PATH, array( + throw new PackageValidationException(PackageValidationException::NO_UPDATE_PATH, [ 'packageName' => $package->packageName, 'packageVersion' => $package->packageVersion, 'deliveredPackageVersion' => $this->archive->getPackageInfo('version') - )); + ]); } if ($validationMode === PackageValidationManager::VALIDATION_RECURSIVE) { @@ -237,11 +237,11 @@ class PackageValidationArchive implements \RecursiveIterator { for ($i = 0, $length = count($instructions); $i < $length; $i++) { $instruction = $instructions[$i]; if (!PackageValidationManager::getInstance()->validatePackageInstallationPluginInstruction($this->archive, $instruction['pip'], $instruction['value'])) { - throw new PackageValidationException(PackageValidationException::MISSING_INSTRUCTION_FILE, array( + throw new PackageValidationException(PackageValidationException::MISSING_INSTRUCTION_FILE, [ 'pip' => $instruction['pip'], 'type' => $type, 'value' => $instruction['value'] - )); + ]); } } } @@ -262,8 +262,8 @@ class PackageValidationArchive implements \RecursiveIterator { ON (package.packageID = package_exclusion.packageID) WHERE excludedPackage = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getArchive()->getPackageInfo('name'))); - $excludingPackages = array(); + $statement->execute([$this->getArchive()->getPackageInfo('name')]); + $excludingPackages = []; while ($row = $statement->fetchArray()) { $excludingPackage = $row['package']; @@ -291,25 +291,25 @@ class PackageValidationArchive implements \RecursiveIterator { } if (!empty($excludingPackages)) { - throw new PackageValidationException(PackageValidationException::EXCLUDING_PACKAGES, array('packages' => $excludingPackages)); + throw new PackageValidationException(PackageValidationException::EXCLUDING_PACKAGES, ['packages' => $excludingPackages]); } // excluded packages: current -> installed if (!empty(self::$excludedPackages[$package])) { // get installed packages $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("package IN (?)", array(array_keys(self::$excludedPackages[$package]))); + $conditions->add("package IN (?)", [array_keys(self::$excludedPackages[$package])]); $sql = "SELECT * FROM wcf".WCF_N."_package ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $packages = array(); + $packages = []; while ($row = $statement->fetchArray()) { $packages[$row['package']] = new Package(null, $row); } - $excludedPackages = array(); + $excludedPackages = []; foreach ($packages as $excludedPackage => $packageObj) { $version = PackageValidationManager::getInstance()->getVirtualPackage($excludedPackage); if ($version === null) { @@ -326,7 +326,7 @@ class PackageValidationArchive implements \RecursiveIterator { } if (!empty($excludedPackages)) { - throw new PackageValidationException(PackageValidationException::EXCLUDED_PACKAGES, array('packages' => $excludedPackages)); + throw new PackageValidationException(PackageValidationException::EXCLUDED_PACKAGES, ['packages' => $excludedPackages]); } } } diff --git a/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php b/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php index a7da497366..c7c86712e9 100644 --- a/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php +++ b/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php @@ -20,7 +20,7 @@ class PackageValidationException extends SystemException { * list of additional details for each subtype * @var string[] */ - protected $details = array(); + protected $details = []; /** * missing archive, expects the detail 'archive' and optionally 'targetArchive' (extracting archive from the archive) @@ -95,7 +95,7 @@ class PackageValidationException extends SystemException { * @param integer $code * @param string[] $details */ - public function __construct($code, array $details = array()) { + public function __construct($code, array $details = []) { $this->details = $details; parent::__construct($this->getLegacyMessage($code), $code); diff --git a/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php b/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php index 46c3a87e8d..92027f2c9b 100644 --- a/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php +++ b/wcfsetup/install/files/lib/system/package/validation/PackageValidationManager.class.php @@ -20,7 +20,7 @@ class PackageValidationManager extends SingletonFactory { * list of known package installation plugins * @var string[] */ - protected $packageInstallationPlugins = array(); + protected $packageInstallationPlugins = []; /** * package validation archive object @@ -32,7 +32,7 @@ class PackageValidationManager extends SingletonFactory { * virtual package list containing package => packageVersion * @var string[] */ - protected $virtualPackageList = array(); + protected $virtualPackageList = []; /** * validation will only check if the primary package looks like it can be installed or updated @@ -74,7 +74,7 @@ class PackageValidationManager extends SingletonFactory { * @return boolean */ public function validate($archive, $deepInspection) { - $this->virtualPackageList = array(); + $this->virtualPackageList = []; $this->packageValidationArchive = new PackageValidationArchive($archive); if ($deepInspection) { @@ -138,7 +138,7 @@ class PackageValidationManager extends SingletonFactory { */ public function getPackageValidationArchiveList() { $packageValidationArchive = new PackageValidationArchive(''); - $packageValidationArchive->setChildren(array($this->packageValidationArchive)); + $packageValidationArchive->setChildren([$this->packageValidationArchive]); return new \RecursiveIteratorIterator($packageValidationArchive, \RecursiveIteratorIterator::SELF_FIRST); } @@ -185,7 +185,7 @@ class PackageValidationManager extends SingletonFactory { */ public function validatePackageInstallationPluginInstruction(PackageArchive $archive, $pip, $instruction) { if (isset($this->packageInstallationPlugins[$pip])) { - return call_user_func(array($this->packageInstallationPlugins[$pip], 'isValid'), $archive, $instruction); + return call_user_func([$this->packageInstallationPlugins[$pip], 'isValid'], $archive, $instruction); } return true; diff --git a/wcfsetup/install/files/lib/system/page/PageManager.class.php b/wcfsetup/install/files/lib/system/page/PageManager.class.php index 0d846bc6c4..2f7a506949 100644 --- a/wcfsetup/install/files/lib/system/page/PageManager.class.php +++ b/wcfsetup/install/files/lib/system/page/PageManager.class.php @@ -22,7 +22,7 @@ class PageManager extends SingletonFactory { * list of available page object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * @see \wcf\system\SingletonFactory::init() @@ -75,11 +75,11 @@ class PageManager extends SingletonFactory { } } - $selection = array(); + $selection = []; foreach ($objectTypes as $objectType) { $categoryName = WCF::getLanguage()->get('wcf.page.category.'.$objectType->categoryname); if (!isset($selection[$categoryName])) { - $selection[$categoryName] = array(); + $selection[$categoryName] = []; } $selection[$categoryName][$objectType->objectTypeID] = WCF::getLanguage()->get('wcf.page.'.$objectType->objectType); diff --git a/wcfsetup/install/files/lib/system/payment/method/PaymentMethodHandler.class.php b/wcfsetup/install/files/lib/system/payment/method/PaymentMethodHandler.class.php index 4f4d708845..6c601174e9 100644 --- a/wcfsetup/install/files/lib/system/payment/method/PaymentMethodHandler.class.php +++ b/wcfsetup/install/files/lib/system/payment/method/PaymentMethodHandler.class.php @@ -19,13 +19,13 @@ class PaymentMethodHandler extends SingletonFactory { * payment methods * @var array */ - protected $paymentMethods = array(); + protected $paymentMethods = []; /** * payment method object types * @var array */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * @see \wcf\system\SingletonFactory::init() @@ -55,7 +55,7 @@ class PaymentMethodHandler extends SingletonFactory { * @return string[] */ public function getPaymentMethodSelection() { - $selection = array(); + $selection = []; foreach ($this->objectTypes as $objectType) { $selection[$objectType->objectType] = WCF::getLanguage()->get('wcf.payment.'.$objectType->objectType); } diff --git a/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php b/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php index d502ed7405..2dd1d64c0c 100644 --- a/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php +++ b/wcfsetup/install/files/lib/system/payment/method/PaypalPaymentMethod.class.php @@ -26,7 +26,7 @@ class PaypalPaymentMethod extends AbstractPaymentMethod { * @see \wcf\system\payment\method\IPaymentMethod::getSupportedCurrencies() */ public function getSupportedCurrencies() { - return array( + return [ 'AUD', // Australian Dollar 'BRL', // Brazilian Real 'CAD', // Canadian Dollar @@ -52,7 +52,7 @@ class PaypalPaymentMethod extends AbstractPaymentMethod { 'THB', // Thai Baht 'TRY', // Turkish Lira 'USD' // U.S. Dollar - ); + ]; } /** @@ -77,7 +77,7 @@ class PaypalPaymentMethod extends AbstractPaymentMethod { - + @@ -98,7 +98,7 @@ class PaypalPaymentMethod extends AbstractPaymentMethod { - + diff --git a/wcfsetup/install/files/lib/system/payment/method/SofortUeberweisungPaymentMethod.class.php b/wcfsetup/install/files/lib/system/payment/method/SofortUeberweisungPaymentMethod.class.php index efc55e1187..00b986cbaf 100644 --- a/wcfsetup/install/files/lib/system/payment/method/SofortUeberweisungPaymentMethod.class.php +++ b/wcfsetup/install/files/lib/system/payment/method/SofortUeberweisungPaymentMethod.class.php @@ -16,9 +16,9 @@ class SofortUeberweisungPaymentMethod extends AbstractPaymentMethod { * @see \wcf\system\payment\method\IPaymentMethod::getSupportedCurrencies() */ public function getSupportedCurrencies() { - return array( + return [ 'EUR' // Euro - ); + ]; } /** diff --git a/wcfsetup/install/files/lib/system/payment/type/PaidSubscriptionPaymentType.class.php b/wcfsetup/install/files/lib/system/payment/type/PaidSubscriptionPaymentType.class.php index ad0ea3d05e..04fb8466ee 100644 --- a/wcfsetup/install/files/lib/system/payment/type/PaidSubscriptionPaymentType.class.php +++ b/wcfsetup/install/files/lib/system/payment/type/PaidSubscriptionPaymentType.class.php @@ -62,16 +62,16 @@ class PaidSubscriptionPaymentType extends AbstractPaymentType { // active/extend subscription if ($userSubscription === null) { // create new subscription - $action = new PaidSubscriptionUserAction(array(), 'create', array( + $action = new PaidSubscriptionUserAction([], 'create', [ 'user' => $user, 'subscription' => $subscription - )); + ]); $returnValues = $action->executeAction(); $userSubscription = $returnValues['returnValues']; } else { // extend existing subscription - $action = new PaidSubscriptionUserAction(array($userSubscription), 'extend'); + $action = new PaidSubscriptionUserAction([$userSubscription], 'extend'); $action->executeAction(); } $logMessage = 'payment completed'; @@ -79,7 +79,7 @@ class PaidSubscriptionPaymentType extends AbstractPaymentType { if ($status == 'reversed') { if ($userSubscription !== null) { // revoke subscription - $action = new PaidSubscriptionUserAction(array($userSubscription), 'revoke'); + $action = new PaidSubscriptionUserAction([$userSubscription], 'revoke'); $action->executeAction(); } $logMessage = 'payment reversed'; @@ -87,14 +87,14 @@ class PaidSubscriptionPaymentType extends AbstractPaymentType { if ($status == 'canceled_reversal') { if ($userSubscription !== null) { // restore subscription - $action = new PaidSubscriptionUserAction(array($userSubscription), 'restore'); + $action = new PaidSubscriptionUserAction([$userSubscription], 'restore'); $action->executeAction(); } $logMessage = 'reversal canceled'; } // log success - $action = new PaidSubscriptionTransactionLogAction(array(), 'create', array('data' => array( + $action = new PaidSubscriptionTransactionLogAction([], 'create', ['data' => [ 'subscriptionUserID' => $userSubscription->subscriptionUserID, 'userID' => $user->userID, 'subscriptionID' => $subscription->subscriptionID, @@ -103,12 +103,12 @@ class PaidSubscriptionPaymentType extends AbstractPaymentType { 'transactionID' => $transactionID, 'logMessage' => $logMessage, 'transactionDetails' => serialize($transactionDetails) - ))); + ]]); $action->executeAction(); } catch (SystemException $e) { // log failure - $action = new PaidSubscriptionTransactionLogAction(array(), 'create', array('data' => array( + $action = new PaidSubscriptionTransactionLogAction([], 'create', ['data' => [ 'subscriptionUserID' => ($userSubscription !== null ? $userSubscription->subscriptionUserID : null), 'userID' => ($user !== null ? $user->userID : null), 'subscriptionID' => ($subscription !== null ? $subscription->subscriptionID : null), @@ -117,7 +117,7 @@ class PaidSubscriptionPaymentType extends AbstractPaymentType { 'transactionID' => $transactionID, 'logMessage' => $e->getMessage(), 'transactionDetails' => serialize($transactionDetails) - ))); + ]]); $action->executeAction(); throw $e; } diff --git a/wcfsetup/install/files/lib/system/poll/PollManager.class.php b/wcfsetup/install/files/lib/system/poll/PollManager.class.php index 2571a0b6ed..ac849cb50d 100644 --- a/wcfsetup/install/files/lib/system/poll/PollManager.class.php +++ b/wcfsetup/install/files/lib/system/poll/PollManager.class.php @@ -28,7 +28,7 @@ class PollManager extends SingletonFactory { * list of object types * @var ObjectType[] */ - protected $cache = array(); + protected $cache = []; /** * current object id @@ -52,7 +52,7 @@ class PollManager extends SingletonFactory { * poll data * @var mixed[] */ - protected $pollData = array( + protected $pollData = [ 'endTime' => '', 'isChangeable' => 0, 'isPublic' => 0, @@ -60,7 +60,7 @@ class PollManager extends SingletonFactory { 'question' => '', 'resultsRequireVote' => 0, 'sortByVotes' => 0 - ); + ]; /** * poll id @@ -72,7 +72,7 @@ class PollManager extends SingletonFactory { * list of poll options * @var string[] */ - protected $pollOptions = array(); + protected $pollOptions = []; /** * @see \wcf\system\SingletonFactory::init() @@ -91,7 +91,7 @@ class PollManager extends SingletonFactory { */ public function removePolls(array $pollIDs) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("pollID IN (?)", array($pollIDs)); + $conditions->add("pollID IN (?)", [$pollIDs]); $sql = "DELETE FROM wcf".WCF_N."_poll ".$conditions; @@ -128,7 +128,7 @@ class PollManager extends SingletonFactory { } // populate poll data - $this->pollData = array( + $this->pollData = [ 'endTime' => $this->poll->endTime, 'isChangeable' => $this->poll->isChangeable, 'isPublic' => $this->poll->isPublic, @@ -136,7 +136,7 @@ class PollManager extends SingletonFactory { 'question' => $this->poll->question, 'resultsRequireVote' => $this->poll->resultsRequireVote, 'sortByVotes' => $this->poll->sortByVotes - ); + ]; // load poll options $sql = "SELECT optionID, optionValue @@ -144,7 +144,7 @@ class PollManager extends SingletonFactory { WHERE pollID = ? ORDER BY showOrder ASC"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->poll->pollID)); + $statement->execute([$this->poll->pollID]); while ($row = $statement->fetchArray()) { $this->pollOptions[] = $row; } @@ -158,7 +158,7 @@ class PollManager extends SingletonFactory { */ public function readFormParameters() { // reset poll data and options prior to reading form input - $this->pollData = $this->pollOptions = array(); + $this->pollData = $this->pollOptions = []; // poll data if (isset($_POST['pollEndTime'])) { @@ -186,10 +186,10 @@ class PollManager extends SingletonFactory { if (isset($_POST['pollOptions']) && is_array($_POST['pollOptions'])) { foreach ($_POST['pollOptions'] as $showOrder => $value) { list($optionID, $optionValue) = explode('_', $value, 2); - $this->pollOptions[$showOrder] = array( + $this->pollOptions[$showOrder] = [ 'optionID' => intval($optionID), 'optionValue' => StringUtil::trim($optionValue) - ); + ]; } } } @@ -262,17 +262,17 @@ class PollManager extends SingletonFactory { $data['objectTypeID'] = $this->cache[$this->objectType]->objectTypeID; $data['time'] = TIME_NOW; - $action = new PollAction(array(), 'create', array( + $action = new PollAction([], 'create', [ 'data' => $data, 'options' => $this->pollOptions - )); + ]); $returnValues = $action->executeAction(); $this->poll = $returnValues['returnValues']; } else { // remove poll if (empty($this->pollData['question'])) { - $action = new PollAction(array($this->poll), 'delete'); + $action = new PollAction([$this->poll], 'delete'); $action->executeAction(); $this->poll = null; @@ -280,10 +280,10 @@ class PollManager extends SingletonFactory { } else { // update existing poll - $action = new PollAction(array($this->poll), 'update', array( + $action = new PollAction([$this->poll], 'update', [ 'data' => $this->pollData, 'options' => $this->pollOptions - )); + ]); $action->executeAction(); } } @@ -295,11 +295,11 @@ class PollManager extends SingletonFactory { * Assigns variables for poll management or display. */ public function assignVariables() { - $variables = array( + $variables = [ '__showPoll' => true, 'pollID' => ($this->poll === null ? 0 : $this->poll->pollID), 'pollOptions' => $this->pollOptions - ); + ]; foreach ($this->pollData as $key => $value) { if ($key == 'endTime') { if (!$value) $value = ''; @@ -340,7 +340,7 @@ class PollManager extends SingletonFactory { // invalid poll ids if (empty($polls)) { - return array(); + return []; } // fetch options for every poll @@ -362,7 +362,7 @@ class PollManager extends SingletonFactory { */ public function getPollOptions(array $pollIDs) { $optionList = new PollOptionList(); - $optionList->getConditionBuilder()->add("poll_option.pollID IN (?)", array($pollIDs)); + $optionList->getConditionBuilder()->add("poll_option.pollID IN (?)", [$pollIDs]); // check for user votes if (WCF::getUser()->userID) { @@ -428,7 +428,7 @@ class PollManager extends SingletonFactory { throw new SystemException("'".$className."' does not extend 'wcf\system\SingletonFactory'"); } - $object = call_user_func(array($className, 'getInstance')); + $object = call_user_func([$className, 'getInstance']); return $object; } } diff --git a/wcfsetup/install/files/lib/system/recaptcha/RecaptchaHandlerV2.class.php b/wcfsetup/install/files/lib/system/recaptcha/RecaptchaHandlerV2.class.php index 20062d2acc..1c5f6a0ed6 100644 --- a/wcfsetup/install/files/lib/system/recaptcha/RecaptchaHandlerV2.class.php +++ b/wcfsetup/install/files/lib/system/recaptcha/RecaptchaHandlerV2.class.php @@ -30,7 +30,7 @@ class RecaptchaHandlerV2 extends SingletonFactory { throw new UserInputException('recaptchaString', 'false'); } - $request = new HTTPRequest('https://www.google.com/recaptcha/api/siteverify?secret='.rawurlencode(RECAPTCHA_PRIVATEKEY).'&response='.rawurlencode($response).'&remoteip='.rawurlencode(UserUtil::getIpAddress()), array('timeout' => 10)); + $request = new HTTPRequest('https://www.google.com/recaptcha/api/siteverify?secret='.rawurlencode(RECAPTCHA_PRIVATEKEY).'&response='.rawurlencode($response).'&remoteip='.rawurlencode(UserUtil::getIpAddress()), ['timeout' => 10]); try { $request->execute(); diff --git a/wcfsetup/install/files/lib/system/request/FlexibleRoute.class.php b/wcfsetup/install/files/lib/system/request/FlexibleRoute.class.php index 500c789a03..3bbbe939c7 100644 --- a/wcfsetup/install/files/lib/system/request/FlexibleRoute.class.php +++ b/wcfsetup/install/files/lib/system/request/FlexibleRoute.class.php @@ -20,7 +20,7 @@ class FlexibleRoute implements IRoute { * schema for outgoing links * @var mixed[][] */ - protected $buildSchema = array(); + protected $buildSchema = []; /** * route is restricted to ACP @@ -38,13 +38,13 @@ class FlexibleRoute implements IRoute { * list of required components * @var string[] */ - protected $requireComponents = array(); + protected $requireComponents = []; /** * parsed request data * @var mixed[] */ - protected $routeData = array(); + protected $routeData = []; /** * Creates a new flexible route instace. @@ -77,11 +77,11 @@ class FlexibleRoute implements IRoute { * @param string $buildSchema */ public function setBuildSchema($buildSchema) { - $this->buildSchema = array(); + $this->buildSchema = []; $buildSchema = ltrim($buildSchema, '/'); $components = preg_split('~({(?:[a-z]+)})~', $buildSchema, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - $delimiters = array('/', '-', '.', '_'); + $delimiters = ['/', '-', '.', '_']; foreach ($components as $component) { $type = 'component'; @@ -92,10 +92,10 @@ class FlexibleRoute implements IRoute { $type = 'separator'; } - $this->buildSchema[] = array( + $this->buildSchema[] = [ 'type' => $type, 'value' => $component - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php index 199a5d4e63..cad79a2b44 100644 --- a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php @@ -79,10 +79,10 @@ class RequestHandler extends SingletonFactory { } else { @header('HTTP/1.1 503 Service Unavailable'); - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'templateName' => 'offline', 'templateNameApplication' => 'wcf' - )); + ]); WCF::getTPL()->display('offline'); } diff --git a/wcfsetup/install/files/lib/system/request/Route.class.php b/wcfsetup/install/files/lib/system/request/Route.class.php index 299b63d1d4..0e6846571c 100644 --- a/wcfsetup/install/files/lib/system/request/Route.class.php +++ b/wcfsetup/install/files/lib/system/request/Route.class.php @@ -34,7 +34,7 @@ class Route implements IRoute { * schema component options * @var array */ - protected $parameterOptions = array(); + protected $parameterOptions = []; /** * route name @@ -46,7 +46,7 @@ class Route implements IRoute { * route schema data * @var array */ - protected $routeSchema = array(); + protected $routeSchema = []; /** * parsed route data @@ -58,7 +58,7 @@ class Route implements IRoute { * cached list of transformed controller names * @var string[] */ - protected static $controllerNames = array(); + protected static $controllerNames = []; /** * list of application abbreviation and default controller name @@ -99,7 +99,7 @@ class Route implements IRoute { throw new SystemException("Placeholder expected, but invalid string '" . $part . "' given."); } - $part = str_replace(array('{', '}'), '', $part); + $part = str_replace(['{', '}'], '', $part); if ($part == 'controller') { if ($this->controller !== null) { throw new SystemException('Controller may not be part of the scheme if a route controller is given.'); @@ -126,11 +126,11 @@ class Route implements IRoute { * @param boolean $isOptional */ public function setParameterOption($key, $default = null, $regexPattern = null, $isOptional = false) { - $this->parameterOptions[$key] = array( + $this->parameterOptions[$key] = [ 'default' => $default, 'isOptional' => $isOptional, 'regexPattern' => $regexPattern - ); + ]; } /** @@ -138,7 +138,7 @@ class Route implements IRoute { */ public function matches($requestURL) { $urlParts = $this->getParts($requestURL); - $data = array(); + $data = []; // handle each route schema component for ($i = 0, $size = count($this->routeSchema); $i < $size; $i++) { @@ -380,7 +380,7 @@ class Route implements IRoute { */ protected static function loadDefaultControllers() { if (self::$defaultControllers === null) { - self::$defaultControllers = array(); + self::$defaultControllers = []; foreach (ApplicationHandler::getInstance()->getApplications() as $application) { $app = WCF::getApplicationObject($application); diff --git a/wcfsetup/install/files/lib/system/request/RouteHandler.class.php b/wcfsetup/install/files/lib/system/request/RouteHandler.class.php index eef7151216..9ca7f39ddc 100644 --- a/wcfsetup/install/files/lib/system/request/RouteHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RouteHandler.class.php @@ -69,7 +69,7 @@ class RouteHandler extends SingletonFactory { * list of available routes * @var IRoute[] */ - protected $routes = array(); + protected $routes = []; /** * parsed route data @@ -263,7 +263,7 @@ class RouteHandler extends SingletonFactory { * @param array $removeComponents * @return string */ - public static function getPath(array $removeComponents = array()) { + public static function getPath(array $removeComponents = []) { if (empty(self::$path)) { self::$path = FileUtil::addTrailingSlash(dirname($_SERVER['SCRIPT_NAME'])); } @@ -368,7 +368,7 @@ class RouteHandler extends SingletonFactory { */ protected function loadDefaultControllers() { if ($this->defaultControllers === null) { - $this->defaultControllers = array(); + $this->defaultControllers = []; foreach (ApplicationHandler::getInstance()->getApplications() as $application) { $app = WCF::getApplicationObject($application); diff --git a/wcfsetup/install/files/lib/system/search/AbstractSearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/AbstractSearchIndexManager.class.php index d77cf49922..cc851b9462 100644 --- a/wcfsetup/install/files/lib/system/search/AbstractSearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/AbstractSearchIndexManager.class.php @@ -26,11 +26,11 @@ abstract class AbstractSearchIndexManager extends SingletonFactory implements IS FROM wcf".WCF_N."_object_type_definition WHERE definitionName = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array('com.woltlab.wcf.searchableObjectType')); + $statement->execute(['com.woltlab.wcf.searchableObjectType']); $row = $statement->fetchArray(); $objectTypeList = new ObjectTypeList(); - $objectTypeList->getConditionBuilder()->add("object_type.definitionID = ?", array($row['definitionID'])); + $objectTypeList->getConditionBuilder()->add("object_type.definitionID = ?", [$row['definitionID']]); $objectTypeList->readObjects(); foreach ($objectTypeList as $objectType) { diff --git a/wcfsetup/install/files/lib/system/search/ISearchEngine.class.php b/wcfsetup/install/files/lib/system/search/ISearchEngine.class.php index 6ee79a2491..24f9c9196b 100644 --- a/wcfsetup/install/files/lib/system/search/ISearchEngine.class.php +++ b/wcfsetup/install/files/lib/system/search/ISearchEngine.class.php @@ -59,5 +59,5 @@ interface ISearchEngine { * @param integer $limit * @return array */ - public function search($q, array $objectTypes, $subjectOnly = false, PreparedStatementConditionBuilder $searchIndexCondition = null, array $additionalConditions = array(), $orderBy = 'time DESC', $limit = 1000); + public function search($q, array $objectTypes, $subjectOnly = false, PreparedStatementConditionBuilder $searchIndexCondition = null, array $additionalConditions = [], $orderBy = 'time DESC', $limit = 1000); } diff --git a/wcfsetup/install/files/lib/system/search/SearchEngine.class.php b/wcfsetup/install/files/lib/system/search/SearchEngine.class.php index 5f3a52ac90..b93011953d 100644 --- a/wcfsetup/install/files/lib/system/search/SearchEngine.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchEngine.class.php @@ -26,7 +26,7 @@ class SearchEngine extends SingletonFactory implements ISearchEngine { * list of available object types * @var array */ - protected $availableObjectTypes = array(); + protected $availableObjectTypes = []; /** * search engine object @@ -90,7 +90,7 @@ class SearchEngine extends SingletonFactory implements ISearchEngine { $className = 'wcf\system\search\mysql\MysqlSearchEngine'; } - $this->searchEngine = call_user_func(array($className, 'getInstance')); + $this->searchEngine = call_user_func([$className, 'getInstance']); } return $this->searchEngine; @@ -99,7 +99,7 @@ class SearchEngine extends SingletonFactory implements ISearchEngine { /** * @see \wcf\system\search\ISearchEngine::search() */ - public function search($q, array $objectTypes, $subjectOnly = false, PreparedStatementConditionBuilder $searchIndexCondition = null, array $additionalConditions = array(), $orderBy = 'time DESC', $limit = 1000) { + public function search($q, array $objectTypes, $subjectOnly = false, PreparedStatementConditionBuilder $searchIndexCondition = null, array $additionalConditions = [], $orderBy = 'time DESC', $limit = 1000) { return $this->getSearchEngine()->search($q, $objectTypes, $subjectOnly, $searchIndexCondition, $additionalConditions, $orderBy, $limit); } diff --git a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php index 402ef3d74d..a7dc9e383f 100644 --- a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php @@ -22,13 +22,13 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager * list of available object types * @var array */ - protected $availableObjectTypes = array(); + protected $availableObjectTypes = []; /** * list of application packages * @var Package[] */ - protected static $packages = array(); + protected static $packages = []; /** * search index manager object @@ -94,7 +94,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager $className = 'wcf\system\search\mysql\MysqlSearchIndexManager'; } - $this->searchIndexManager = call_user_func(array($className, 'getInstance')); + $this->searchIndexManager = call_user_func([$className, 'getInstance']); } return $this->searchIndexManager; @@ -174,7 +174,7 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager if (!empty($tableName)) { if (empty(self::$packages)) { $packageList = new PackageList(); - $packageList->getConditionBuilder()->add('package.isApplication = ?', array(1)); + $packageList->getConditionBuilder()->add('package.isApplication = ?', [1]); $packageList->readObjects(); self::$packages = $packageList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/search/SearchKeywordManager.class.php b/wcfsetup/install/files/lib/system/search/SearchKeywordManager.class.php index f6d7525ef3..567dbf5c78 100644 --- a/wcfsetup/install/files/lib/system/search/SearchKeywordManager.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchKeywordManager.class.php @@ -28,20 +28,20 @@ class SearchKeywordManager extends SingletonFactory { FROM wcf".WCF_N."_search_keyword WHERE keyword = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($keyword)); + $statement->execute([$keyword]); if (($object = $statement->fetchObject('wcf\data\search\keyword\SearchKeyword')) !== null) { - $action = new SearchKeywordAction(array($object), 'update', array('data' => array( + $action = new SearchKeywordAction([$object], 'update', ['data' => [ 'searches' => $object->searches + 1, 'lastSearchTime' => TIME_NOW - ))); + ]]); $action->executeAction(); } else { - $action = new SearchKeywordAction(array(), 'create', array('data' => array( + $action = new SearchKeywordAction([], 'create', ['data' => [ 'keyword' => mb_substr($keyword, 0, 255), 'searches' => 1, 'lastSearchTime' => TIME_NOW - ))); + ]]); $action->executeAction(); } } diff --git a/wcfsetup/install/files/lib/system/search/SearchResultTextParser.class.php b/wcfsetup/install/files/lib/system/search/SearchResultTextParser.class.php index 16e681fd7e..10a1bed2f6 100644 --- a/wcfsetup/install/files/lib/system/search/SearchResultTextParser.class.php +++ b/wcfsetup/install/files/lib/system/search/SearchResultTextParser.class.php @@ -117,14 +117,14 @@ class SearchResultTextParser extends SingletonFactory { } } else { - $matches = array(); + $matches = []; $shiftLength = static::MAX_LENGTH; // find first match of each keyword foreach ($this->searchQuery as $keyword) { $start = mb_strripos($text, $keyword); if ($start !== false) { $shiftLength -= mb_strlen($keyword); - $matches[$keyword] = array('start' => $start, 'end' => $start + mb_strlen($keyword)); + $matches[$keyword] = ['start' => $start, 'end' => $start + mb_strlen($keyword)]; } } diff --git a/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php b/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php index 92df82d6ad..6e88051a34 100644 --- a/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/ACPSearchHandler.class.php @@ -21,7 +21,7 @@ class ACPSearchHandler extends SingletonFactory { * list of application abbreviations * @var string[] */ - public $abbreviations = array(); + public $abbreviations = []; /** * list of acp search provider @@ -45,7 +45,7 @@ class ACPSearchHandler extends SingletonFactory { * @throws SystemException */ public function search($query, $limit = 10) { - $data = array(); + $data = []; $maxResultsPerProvider = ceil($limit / 2); $totalResultCount = 0; @@ -130,7 +130,7 @@ class ACPSearchHandler extends SingletonFactory { } if (!empty($suffix)) { - $abbreviations = array(); + $abbreviations = []; foreach ($this->abbreviations as $abbreviation) { $abbreviations[] = $abbreviation . $suffix; } diff --git a/wcfsetup/install/files/lib/system/search/acp/ACPSearchResultList.class.php b/wcfsetup/install/files/lib/system/search/acp/ACPSearchResultList.class.php index 0798fb88d0..638dbc90f5 100644 --- a/wcfsetup/install/files/lib/system/search/acp/ACPSearchResultList.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/ACPSearchResultList.class.php @@ -29,7 +29,7 @@ class ACPSearchResultList implements \Countable, \Iterator { * result list * @var ACPSearchResult[] */ - protected $results = array(); + protected $results = []; /** * Creates a new ACPSearchResultList. @@ -58,7 +58,7 @@ class ACPSearchResultList implements \Countable, \Iterator { public function reduceResults($count) { // more results than available should be whiped, just set it to 0 if ($count >= count($this->results)) { - $this->results = array(); + $this->results = []; } else { while ($count > 0) { diff --git a/wcfsetup/install/files/lib/system/search/acp/AbstractCategorizedACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/AbstractCategorizedACPSearchResultProvider.class.php index 1e2be6888b..be07a93542 100644 --- a/wcfsetup/install/files/lib/system/search/acp/AbstractCategorizedACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/AbstractCategorizedACPSearchResultProvider.class.php @@ -18,7 +18,7 @@ abstract class AbstractCategorizedACPSearchResultProvider extends AbstractACPSea * list of categories * @var DatabaseObject[] */ - protected $categories = array(); + protected $categories = []; /** * class name for category list @@ -30,7 +30,7 @@ abstract class AbstractCategorizedACPSearchResultProvider extends AbstractACPSea * list of top category names (level 1 and 2) * @var string[] */ - protected $topCategories = array(); + protected $topCategories = []; /** * Creates a new categorized ACP search result provider. @@ -112,7 +112,7 @@ abstract class AbstractCategorizedACPSearchResultProvider extends AbstractACPSea } // create level 2 categories - $topCategories = array(); + $topCategories = []; foreach ($this->categories as $category) { if ($category->parentCategoryName && in_array($category->parentCategoryName, $this->topCategories)) { $topCategories[] = $category->categoryName; diff --git a/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php index 3fabb36b7c..867f16ae54 100644 --- a/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php @@ -19,22 +19,22 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im * @see \wcf\system\search\acp\IACPSearchResultProvider::search() */ public function search($query) { - $results = array(); + $results = []; // search by language item $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); + $conditions->add("languageID = ?", [WCF::getLanguage()->languageID]); // filter by language item $languageItemsConditions = ''; - $languageItemsParameters = array(); + $languageItemsParameters = []; foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.menu.link.%') as $abbreviation) { if (!empty($languageItemsConditions)) $languageItemsConditions .= " OR "; $languageItemsConditions .= "languageItem LIKE ?"; $languageItemsParameters[] = $abbreviation; } $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters); - $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); + $conditions->add("languageItemValue LIKE ?", ['%'.$query.'%']); $sql = "SELECT languageItem, languageItemValue FROM wcf".WCF_N."_language_item @@ -42,17 +42,17 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im ORDER BY languageItemValue ASC"; $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here $statement->execute($conditions->getParameters()); - $languageItems = array(); + $languageItems = []; while ($row = $statement->fetchArray()) { $languageItems[$row['languageItem']] = $row['languageItemValue']; } if (empty($languageItems)) { - return array(); + return []; } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("menuItem IN (?)", array(array_keys($languageItems))); + $conditions->add("menuItem IN (?)", [array_keys($languageItems)]); $conditions->add("menuItemController <> ''"); $sql = "SELECT * @@ -70,15 +70,15 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im } $parentMenuItem = $menuItem->parentMenuItem; - $parentMenuItems = array(); + $parentMenuItems = []; while ($parentMenuItem && isset($menuItems[$parentMenuItem])) { array_unshift($parentMenuItems, $parentMenuItem); $parentMenuItem = $menuItems[$parentMenuItem]->parentMenuItem; } - $results[] = new ACPSearchResult($languageItems[$menuItem->menuItem], $menuItem->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', array( + $results[] = new ACPSearchResult($languageItems[$menuItem->menuItem], $menuItem->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', [ 'pieces' => $parentMenuItems - ))); + ])); } return $results; diff --git a/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php index 4c37916816..b1992c3983 100644 --- a/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php @@ -25,13 +25,13 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr * @see \wcf\system\search\acp\IACPSearchResultProvider::search() */ public function search($query) { - $results = array(); + $results = []; // search by language item $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); - $conditions->add("languageItem LIKE ?", array('wcf.acp.option.%')); - $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); + $conditions->add("languageID = ?", [WCF::getLanguage()->languageID]); + $conditions->add("languageItem LIKE ?", ['wcf.acp.option.%']); + $conditions->add("languageItemValue LIKE ?", ['%'.$query.'%']); $sql = "SELECT languageItem, languageItemValue FROM wcf".WCF_N."_language_item @@ -39,8 +39,8 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr ORDER BY languageItemValue ASC"; $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here $statement->execute($conditions->getParameters()); - $languageItems = array(); - $optionNames = array(); + $languageItems = []; + $optionNames = []; while ($row = $statement->fetchArray()) { $optionName = preg_replace('~^([a-z]+)\.acp\.option\.~', '', $row['languageItem']); @@ -49,11 +49,11 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr } if (empty($optionNames)) { - return array(); + return []; } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionName IN (?)", array($optionNames)); + $conditions->add("optionName IN (?)", [$optionNames]); $sql = "SELECT optionName, categoryName, options, permissions, hidden FROM wcf".WCF_N."_option @@ -61,7 +61,7 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here $statement->execute($conditions->getParameters()); - $optionCategories = OptionCacheBuilder::getInstance()->getData(array(), 'categories'); + $optionCategories = OptionCacheBuilder::getInstance()->getData([], 'categories'); while ($option = $statement->fetchObject('wcf\data\option\Option')) { // category is not accessible @@ -74,18 +74,18 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr continue; } - $link = LinkHandler::getInstance()->getLink('Option', array('id' => $this->getCategoryID($this->getTopCategory($option->categoryName)->parentCategoryName)), 'optionName='.$option->optionName.'#'.$this->getCategoryName($option->categoryName)); + $link = LinkHandler::getInstance()->getLink('Option', ['id' => $this->getCategoryID($this->getTopCategory($option->categoryName)->parentCategoryName)], 'optionName='.$option->optionName.'#'.$this->getCategoryName($option->categoryName)); $categoryName = $option->categoryName; - $parentCategories = array(); + $parentCategories = []; while (isset($optionCategories[$categoryName])) { array_unshift($parentCategories, 'wcf.acp.option.category.'.$optionCategories[$categoryName]->categoryName); $categoryName = $optionCategories[$categoryName]->parentCategoryName; } - $results[] = new ACPSearchResult($languageItems[$option->optionName], $link, WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', array( + $results[] = new ACPSearchResult($languageItems[$option->optionName], $link, WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', [ 'pieces' => $parentCategories - ))); + ])); } return $results; diff --git a/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php index d30dd71746..a0af60aef3 100644 --- a/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php @@ -20,16 +20,16 @@ class PackageACPSearchResultProvider implements IACPSearchResultProvider { */ public function search($query) { if (!WCF::getSession()->getPermission('admin.configuration.package.canUpdatePackage') && !WCF::getSession()->getPermission('admin.configuration.package.canUninstallPackage')) { - return array(); + return []; } - $results = array(); + $results = []; // search by language item $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); - $conditions->add("languageItem LIKE ?", array('wcf.acp.package.packageName.package%')); - $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); + $conditions->add("languageID = ?", [WCF::getLanguage()->languageID]); + $conditions->add("languageItem LIKE ?", ['wcf.acp.package.packageName.package%']); + $conditions->add("languageItemValue LIKE ?", ['%'.$query.'%']); $sql = "SELECT languageItem FROM wcf".WCF_N."_language_item @@ -37,14 +37,14 @@ class PackageACPSearchResultProvider implements IACPSearchResultProvider { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $packageIDs = array(); + $packageIDs = []; while ($row = $statement->fetchArray()) { $packageIDs[] = str_replace('wcf.acp.package.packageName.package', '', $row['languageItem']); } $conditions = new PreparedStatementConditionBuilder(false); if (!empty($packageIDs)) { - $conditions->add("packageID IN (?)", array($packageIDs)); + $conditions->add("packageID IN (?)", [$packageIDs]); } $sql = "SELECT * @@ -53,16 +53,16 @@ class PackageACPSearchResultProvider implements IACPSearchResultProvider { OR package LIKE ? ".(count($conditions->getParameters()) ? "OR ".$conditions : ""); $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array_merge(array( + $statement->execute(array_merge([ '%'.$query.'%', '%'.$query.'%' - ), $conditions->getParameters())); + ], $conditions->getParameters())); while ($package = $statement->fetchObject('wcf\data\package\Package')) { - $results[] = new ACPSearchResult($package->getName(), LinkHandler::getInstance()->getLink('Package', array( + $results[] = new ACPSearchResult($package->getName(), LinkHandler::getInstance()->getLink('Package', [ 'id' => $package->packageID, 'title' => $package->getName() - ))); + ])); } return $results; diff --git a/wcfsetup/install/files/lib/system/search/acp/UserACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/UserACPSearchResultProvider.class.php index 7cffbe5df8..f51bae0fb7 100644 --- a/wcfsetup/install/files/lib/system/search/acp/UserACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/UserACPSearchResultProvider.class.php @@ -20,22 +20,22 @@ class UserACPSearchResultProvider implements IACPSearchResultProvider { */ public function search($query) { if (!WCF::getSession()->getPermission('admin.user.canEditUser')) { - return array(); + return []; } - $results = array(); + $results = []; $sql = "SELECT * FROM wcf".WCF_N."_user WHERE username LIKE ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($query.'%')); + $statement->execute([$query.'%']); while ($user = $statement->fetchObject('wcf\data\user\User')) { if (UserGroup::isAccessibleGroup($user->getGroupIDs())) { - $results[] = new ACPSearchResult($user->username, LinkHandler::getInstance()->getLink('UserEdit', array( + $results[] = new ACPSearchResult($user->username, LinkHandler::getInstance()->getLink('UserEdit', [ 'object' => $user - ))); + ])); } } diff --git a/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php index 88f5cddc4c..14f6318b9e 100644 --- a/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php @@ -25,13 +25,13 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc * @see \wcf\system\search\acp\IACPSearchResultProvider::search() */ public function search($query) { - $results = array(); + $results = []; // search by language item $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID)); - $conditions->add("languageItem LIKE ?", array('wcf.acp.group.option.%')); - $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%')); + $conditions->add("languageID = ?", [WCF::getLanguage()->languageID]); + $conditions->add("languageItem LIKE ?", ['wcf.acp.group.option.%']); + $conditions->add("languageItemValue LIKE ?", ['%'.$query.'%']); $sql = "SELECT languageItem, languageItemValue FROM wcf".WCF_N."_language_item @@ -39,7 +39,7 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc ORDER BY languageItemValue ASC"; $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here $statement->execute($conditions->getParameters()); - $languageItems = array(); + $languageItems = []; while ($row = $statement->fetchArray()) { // ignore descriptions if (substr($row['languageItem'], -12) == '.description') { @@ -51,11 +51,11 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc } if (empty($languageItems)) { - return array(); + return []; } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionName IN (?)", array(array_keys($languageItems))); + $conditions->add("optionName IN (?)", [array_keys($languageItems)]); $sql = "SELECT optionID, optionName, categoryName, permissions, options FROM wcf".WCF_N."_user_group_option @@ -63,7 +63,7 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here $statement->execute($conditions->getParameters()); - $optionCategories = UserGroupOptionCacheBuilder::getInstance()->getData(array(), 'categories'); + $optionCategories = UserGroupOptionCacheBuilder::getInstance()->getData([], 'categories'); while ($userGroupOption = $statement->fetchObject('wcf\data\user\group\option\UserGroupOption')) { // category is not accessible @@ -76,18 +76,18 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc continue; } - $link = LinkHandler::getInstance()->getLink('UserGroupOption', array('id' => $userGroupOption->optionID)); + $link = LinkHandler::getInstance()->getLink('UserGroupOption', ['id' => $userGroupOption->optionID]); $categoryName = $userGroupOption->categoryName; - $parentCategories = array(); + $parentCategories = []; while (isset($optionCategories[$categoryName])) { array_unshift($parentCategories, 'wcf.acp.group.option.category.'.$optionCategories[$categoryName]->categoryName); $categoryName = $optionCategories[$categoryName]->parentCategoryName; } - $results[] = new ACPSearchResult($languageItems[$userGroupOption->optionName], $link, WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', array( + $results[] = new ACPSearchResult($languageItems[$userGroupOption->optionName], $link, WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', [ 'pieces' => $parentCategories - ))); + ])); } return $results; diff --git a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php index 9aeccc4932..b05de4a36d 100644 --- a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php +++ b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchEngine.class.php @@ -28,15 +28,15 @@ class MysqlSearchEngine extends AbstractSearchEngine { /** * @see \wcf\system\search\AbstractSearchEngine::$specialCharacters */ - protected $specialCharacters = array('(', ')', '@', '+', '-', '"', '<', '>', '~', '*'); + protected $specialCharacters = ['(', ')', '@', '+', '-', '"', '<', '>', '~', '*']; /** * @see \wcf\system\search\ISearchEngine::search() */ - public function search($q, array $objectTypes, $subjectOnly = false, PreparedStatementConditionBuilder $searchIndexCondition = null, array $additionalConditions = array(), $orderBy = 'time DESC', $limit = 1000) { + public function search($q, array $objectTypes, $subjectOnly = false, PreparedStatementConditionBuilder $searchIndexCondition = null, array $additionalConditions = [], $orderBy = 'time DESC', $limit = 1000) { // build search query $sql = ''; - $parameters = array(); + $parameters = []; foreach ($objectTypes as $objectTypeName) { $objectType = SearchEngine::getInstance()->getObjectType($objectTypeName); @@ -81,14 +81,14 @@ class MysqlSearchEngine extends AbstractSearchEngine { } // send search query - $messages = array(); + $messages = []; $statement = WCF::getDB()->prepareStatement($sql, $limit); $statement->execute($parameters); while ($row = $statement->fetchArray()) { - $messages[] = array( + $messages[] = [ 'objectID' => $row['objectID'], 'objectType' => $row['objectType'] - ); + ]; } return $messages; @@ -104,7 +104,7 @@ class MysqlSearchEngine extends AbstractSearchEngine { $q = $this->parseSearchQuery($q); $fulltextCondition = new PreparedStatementConditionBuilder(false); - $fulltextCondition->add("MATCH (subject".(!$subjectOnly ? ', message, metaData' : '').") AGAINST (? IN BOOLEAN MODE)", array($q)); + $fulltextCondition->add("MATCH (subject".(!$subjectOnly ? ', message, metaData' : '').") AGAINST (? IN BOOLEAN MODE)", [$q]); if ($orderBy == 'relevance ASC' || $orderBy == 'relevance DESC') { $relevanceCalc = "MATCH (subject".(!$subjectOnly ? ', message, metaData' : '').") AGAINST ('".escapeString($q)."') + (5 / (1 + POW(LN(1 + (".TIME_NOW." - time) / 2592000), 2))) AS relevance"; @@ -119,11 +119,11 @@ class MysqlSearchEngine extends AbstractSearchEngine { ".(!empty($orderBy) && $fulltextCondition === null ? 'ORDER BY '.$orderBy : '')." LIMIT ".($limit == 1000 ? SearchEngine::INNER_SEARCH_LIMIT : $limit); - return array( + return [ 'fulltextCondition' => $fulltextCondition, 'searchIndexCondition' => $searchIndexCondition, 'sql' => $sql - ); + ]; } /** @@ -140,7 +140,7 @@ class MysqlSearchEngine extends AbstractSearchEngine { } catch (DatabaseException $e) { // fallback if user is disallowed to issue 'SHOW VARIABLES' - $row = array('Value' => 4); + $row = ['Value' => 4]; } $this->ftMinWordLen = $row['Value']; diff --git a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php index 0b9ed2440a..fc905cb47b 100644 --- a/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php +++ b/wcfsetup/install/files/lib/system/search/mysql/MysqlSearchIndexManager.class.php @@ -27,7 +27,7 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager { (objectID, subject, message, time, userID, username, languageID, metaData) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($objectID, $subject, $message, $time, $userID, $username, $languageID, $metaData)); + $statement->execute([$objectID, $subject, $message, $time, $userID, $username, $languageID, $metaData]); } /** @@ -35,7 +35,7 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager { */ public function update($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID = null, $metaData = '') { // delete existing entry - $this->delete($objectType, array($objectID)); + $this->delete($objectType, [$objectID]); // save new entry $this->add($objectType, $objectID, $message, $subject, $time, $userID, $username, $languageID, $metaData); @@ -50,7 +50,7 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager { $statement = WCF::getDB()->prepareStatement($sql); WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { - $statement->execute(array($objectID)); + $statement->execute([$objectID]); } WCF::getDB()->commitTransaction(); } @@ -75,31 +75,31 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager { FROM wcf".WCF_N."_package_installation_sql_log WHERE sqlTable = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($tableName)); + $statement->execute([$tableName]); if ($statement->fetchSingleColumn()) { // table already exists return false; } - $columns = array( - array('name' => 'objectID', 'data' => array('length' => 10, 'notNull' => true, 'type' => 'int')), - array('name' => 'subject', 'data' => array('default' => '', 'length' => 255, 'notNull' => true, 'type' => 'varchar')), - array('name' => 'message', 'data' => array('type' => 'mediumtext')), - array('name' => 'metaData', 'data' => array('type' => 'mediumtext')), - array('name' => 'time', 'data' => array('default' => 0, 'length' => 10, 'notNull' => true, 'type' => 'int')), - array('name' => 'userID', 'data' => array('default' => '', 'length' => 10, 'type' => 'int')), - array('name' => 'username', 'data' => array('default' => '', 'length' => 255,'notNull' => true, 'type' => 'varchar')), - array('name' => 'languageID', 'data' => array('default' => 0, 'length' => 10, 'notNull' => true, 'type' => 'int')) - ); + $columns = [ + ['name' => 'objectID', 'data' => ['length' => 10, 'notNull' => true, 'type' => 'int']], + ['name' => 'subject', 'data' => ['default' => '', 'length' => 255, 'notNull' => true, 'type' => 'varchar']], + ['name' => 'message', 'data' => ['type' => 'mediumtext']], + ['name' => 'metaData', 'data' => ['type' => 'mediumtext']], + ['name' => 'time', 'data' => ['default' => 0, 'length' => 10, 'notNull' => true, 'type' => 'int']], + ['name' => 'userID', 'data' => ['default' => '', 'length' => 10, 'type' => 'int']], + ['name' => 'username', 'data' => ['default' => '', 'length' => 255,'notNull' => true, 'type' => 'varchar']], + ['name' => 'languageID', 'data' => ['default' => 0, 'length' => 10, 'notNull' => true, 'type' => 'int']] + ]; - $indices = array( - array('name' => 'objectAndLanguage', 'data' => array('columns' => 'objectID, languageID', 'type' => 'UNIQUE')), - array('name' => 'fulltextIndex', 'data' => array('columns' => 'subject, message, metaData', 'type' => 'FULLTEXT')), - array('name' => 'fulltextIndexSubjectOnly', 'data' => array('columns' => 'subject', 'type' => 'FULLTEXT')), - array('name' => 'language', 'data' => array('columns' => 'languageID', 'type' => 'KEY')), - array('name' => 'user', 'data' => array('columns' => 'userID, time', 'type'=> 'KEY')) - ); + $indices = [ + ['name' => 'objectAndLanguage', 'data' => ['columns' => 'objectID, languageID', 'type' => 'UNIQUE']], + ['name' => 'fulltextIndex', 'data' => ['columns' => 'subject, message, metaData', 'type' => 'FULLTEXT']], + ['name' => 'fulltextIndexSubjectOnly', 'data' => ['columns' => 'subject', 'type' => 'FULLTEXT']], + ['name' => 'language', 'data' => ['columns' => 'languageID', 'type' => 'KEY']], + ['name' => 'user', 'data' => ['columns' => 'userID, time', 'type'=> 'KEY']] + ]; WCF::getDB()->getEditor()->createTable($tableName, $columns, $indices); @@ -114,10 +114,10 @@ class MysqlSearchIndexManager extends AbstractSearchIndexManager { (packageID, sqlTable) VALUES (?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectType->packageID, $tableName - )); + ]); return true; } diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 73f86bf02f..b6b9013ce3 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -53,7 +53,7 @@ class SessionHandler extends SingletonFactory { * various environment variables * @var array */ - protected $environment = array(); + protected $environment = []; /** * group data and permissions @@ -149,7 +149,7 @@ class SessionHandler extends SingletonFactory { * list of names of permissions only available for users * @var string[] */ - protected $usersOnlyPermissions = array(); + protected $usersOnlyPermissions = []; /** * Provides access to session data. @@ -170,7 +170,7 @@ class SessionHandler extends SingletonFactory { */ protected function init() { $this->isACP = (class_exists(WCFACP::class, false) || !PACKAGE_ID); - $this->usersOnlyPermissions = UserGroupOptionCacheBuilder::getInstance()->getData(array(), 'usersOnlyOptions'); + $this->usersOnlyPermissions = UserGroupOptionCacheBuilder::getInstance()->getData([], 'usersOnlyOptions'); } /** @@ -210,8 +210,8 @@ class SessionHandler extends SingletonFactory { */ public function load($sessionEditorClassName, $sessionID) { $this->sessionEditorClassName = $sessionEditorClassName; - $this->sessionClassName = call_user_func(array($sessionEditorClassName, 'getBaseClass')); - $this->supportsVirtualSessions = call_user_func(array($this->sessionClassName, 'supportsVirtualSessions')); + $this->sessionClassName = call_user_func([$sessionEditorClassName, 'getBaseClass']); + $this->supportsVirtualSessions = call_user_func([$this->sessionClassName, 'supportsVirtualSessions']); // try to get existing session if (!empty($sessionID)) { @@ -260,9 +260,9 @@ class SessionHandler extends SingletonFactory { /** @var \wcf\data\DatabaseObjectEditor $sessionEditor */ $sessionEditor = new $this->sessionEditorClassName($this->session); - $sessionEditor->update(array( + $sessionEditor->update([ 'sessionID' => $newSessionID - )); + ]); // fetch new session data from database $this->session = new $this->sessionClassName($newSessionID); @@ -274,14 +274,14 @@ class SessionHandler extends SingletonFactory { * Initializes environment variables. */ protected function initEnvironment() { - $this->environment = array( + $this->environment = [ 'lastRequestURI' => $this->session->requestURI, 'lastRequestMethod' => $this->session->requestMethod, 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => UserUtil::getUserAgent(), 'requestURI' => UserUtil::getRequestURI(), 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : '') - ); + ]; } /** @@ -377,7 +377,7 @@ class SessionHandler extends SingletonFactory { protected function loadVariables() { @$this->variables = unserialize($this->virtualSession->sessionVariables); if (!is_array($this->variables)) { - $this->variables = array(); + $this->variables = []; } } @@ -432,10 +432,10 @@ class SessionHandler extends SingletonFactory { if ($this->virtualSession === null || $forceReload) { $this->virtualSession = null; if ($this->isACP) { - $virtualSessionAction = new ACPSessionVirtualAction(array(), 'create', array('data' => array('sessionID' => $this->session->sessionID))); + $virtualSessionAction = new ACPSessionVirtualAction([], 'create', ['data' => ['sessionID' => $this->session->sessionID]]); } else { - $virtualSessionAction = new SessionVirtualAction(array(), 'create', array('data' => array('sessionID' => $this->session->sessionID))); + $virtualSessionAction = new SessionVirtualAction([], 'create', ['data' => ['sessionID' => $this->session->sessionID]]); } try { @@ -510,7 +510,7 @@ class SessionHandler extends SingletonFactory { $sessionID = StringUtil::getRandomID(); // get user automatically - $this->user = UserAuthenticationFactory::getInstance()->getUserAuthentication()->loginAutomatically(call_user_func(array($this->sessionClassName, 'supportsPersistentLogins'))); + $this->user = UserAuthenticationFactory::getInstance()->getUserAuthentication()->loginAutomatically(call_user_func([$this->sessionClassName, 'supportsPersistentLogins'])); // create user if ($this->user === null) { @@ -520,12 +520,12 @@ class SessionHandler extends SingletonFactory { } else if (!$this->supportsVirtualSessions) { // delete all other sessions of this user - call_user_func(array($this->sessionEditorClassName, 'deleteUserSessions'), array($this->user->userID)); + call_user_func([$this->sessionEditorClassName, 'deleteUserSessions'], [$this->user->userID]); } $createNewSession = true; // find existing session - $session = call_user_func(array($this->sessionClassName, 'getSessionByUserID'), $this->user->userID); + $session = call_user_func([$this->sessionClassName, 'getSessionByUserID'], $this->user->userID); if ($session !== null) { // inherit existing session @@ -537,7 +537,7 @@ class SessionHandler extends SingletonFactory { if ($createNewSession) { // save session - $sessionData = array( + $sessionData = [ 'sessionID' => $sessionID, 'userID' => $this->user->userID, 'ipAddress' => UserUtil::getIpAddress(), @@ -545,19 +545,19 @@ class SessionHandler extends SingletonFactory { 'lastActivityTime' => TIME_NOW, 'requestURI' => UserUtil::getRequestURI(), 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : '') - ); + ]; if ($spiderID !== null) $sessionData['spiderID'] = $spiderID; try { - $this->session = call_user_func(array($this->sessionEditorClassName, 'create'), $sessionData); + $this->session = call_user_func([$this->sessionEditorClassName, 'create'], $sessionData); } catch (DatabaseException $e) { // MySQL error 23000 = unique key // do not check against the message itself, some weird systems localize them if ($e->getCode() == 23000) { // find existing session - $session = call_user_func(array($this->sessionClassName, 'getSessionByUserID'), $this->user->userID); + $session = call_user_func([$this->sessionClassName, 'getSessionByUserID'], $this->user->userID); if ($session === null) { // MySQL reported a unique key error, but no corresponding session exists, rethrow exception @@ -626,7 +626,7 @@ class SessionHandler extends SingletonFactory { FROM wcf".WCF_N."_user_to_group WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->user->userID)); + $statement->execute([$this->user->userID]); $groupIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } else { @@ -636,7 +636,7 @@ class SessionHandler extends SingletonFactory { // get group data from cache $this->groupData = UserGroupPermissionCacheBuilder::getInstance()->getData($groupIDs); if (isset($this->groupData['groupIDs']) && $this->groupData['groupIDs'] != $groupIDs) { - $this->groupData = array(); + $this->groupData = []; } } @@ -657,7 +657,7 @@ class SessionHandler extends SingletonFactory { protected function loadLanguageIDs() { if ($this->languageIDs !== null) return; - $this->languageIDs = array(); + $this->languageIDs = []; if (!$this->user->userID) { return; @@ -669,7 +669,7 @@ class SessionHandler extends SingletonFactory { FROM wcf".WCF_N."_user_to_language WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->user->userID)); + $statement->execute([$this->user->userID]); $this->languageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); } else { @@ -685,7 +685,7 @@ class SessionHandler extends SingletonFactory { * @param boolean $hideSession if true, database won't be updated */ public function changeUser(User $user, $hideSession = false) { - $eventParameters = array('user' => $user, 'hideSession' => $hideSession); + $eventParameters = ['user' => $user, 'hideSession' => $hideSession]; EventHandler::getInstance()->fireAction($this, 'beforeChangeUser', $eventParameters); @@ -750,7 +750,7 @@ class SessionHandler extends SingletonFactory { // there are still other virtual sessions, create a new session if ($sessionCount) { // save session - $sessionData = array( + $sessionData = [ 'sessionID' => StringUtil::getRandomID(), 'userID' => $user->userID, 'ipAddress' => UserUtil::getIpAddress(), @@ -758,9 +758,9 @@ class SessionHandler extends SingletonFactory { 'lastActivityTime' => TIME_NOW, 'requestURI' => UserUtil::getRequestURI(), 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : '') - ); + ]; - $this->session = call_user_func(array($this->sessionEditorClassName, 'create'), $sessionData); + $this->session = call_user_func([$this->sessionEditorClassName, 'create'], $sessionData); HeaderUtil::setCookie('cookieHash'.$this->cookieSuffix, $this->session->sessionID); } @@ -768,9 +768,9 @@ class SessionHandler extends SingletonFactory { // this was the last virtual session, re-use current session // update session $sessionEditor = new $this->sessionEditorClassName($this->session); - $sessionEditor->update(array( + $sessionEditor->update([ 'userID' => $user->userID - )); + ]); } break; @@ -780,11 +780,11 @@ class SessionHandler extends SingletonFactory { default: if (!$this->supportsVirtualSessions) { // delete all other sessions of this user - call_user_func(array($this->sessionEditorClassName, 'deleteUserSessions'), array($user->userID)); + call_user_func([$this->sessionEditorClassName, 'deleteUserSessions'], [$user->userID]); } // find existing session for this user - $session = call_user_func(array($this->sessionClassName, 'getSessionByUserID'), $user->userID); + $session = call_user_func([$this->sessionClassName, 'getSessionByUserID'], $user->userID); // no session exists, re-use current session if ($session === null) { @@ -794,9 +794,9 @@ class SessionHandler extends SingletonFactory { try { $this->register('__changeSessionID', true); - $sessionEditor->update(array( + $sessionEditor->update([ 'userID' => $user->userID - )); + ]); } catch (DatabaseException $e) { // MySQL error 23000 = unique key @@ -844,13 +844,13 @@ class SessionHandler extends SingletonFactory { if ($this->doNotUpdate) return; // set up data - $data = array( + $data = [ 'ipAddress' => UserUtil::getIpAddress(), 'userAgent' => $this->userAgent, 'requestURI' => $this->requestURI, 'requestMethod' => $this->requestMethod, 'lastActivityTime' => TIME_NOW - ); + ]; if (!class_exists('wcf\system\CLIWCF', false) && PACKAGE_ID && RequestHandler::getInstance()->getActiveRequest() && RequestHandler::getInstance()->getActiveRequest()->getRequestObject() instanceof ITrackablePage && RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->isTracked()) { $data['controller'] = RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->getController(); $data['parentObjectType'] = RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->getParentObjectType(); @@ -890,9 +890,9 @@ class SessionHandler extends SingletonFactory { // update last activity time /** @var \wcf\data\DatabaseObjectEditor $sessionEditor */ $sessionEditor = new $this->sessionEditorClassName($this->session); - $sessionEditor->update(array( + $sessionEditor->update([ 'lastActivityTime' => TIME_NOW - )); + ]); if ($this->virtualSession instanceof ACPSessionVirtual) { if ($this->isACP) { @@ -911,12 +911,12 @@ class SessionHandler extends SingletonFactory { public function delete() { // clear storage if ($this->user->userID) { - self::resetSessions(array($this->user->userID)); + self::resetSessions([$this->user->userID]); // update last activity time if (!$this->isACP) { $editor = new UserEditor($this->user); - $editor->update(array('lastActivityTime' => TIME_NOW)); + $editor->update(['lastActivityTime' => TIME_NOW]); } } @@ -976,7 +976,7 @@ class SessionHandler extends SingletonFactory { * * @param integer[] $userIDs */ - public static function resetSessions(array $userIDs = array()) { + public static function resetSessions(array $userIDs = []) { if (!empty($userIDs)) { UserStorageHandler::getInstance()->reset($userIDs, 'groupIDs'); UserStorageHandler::getInstance()->reset($userIDs, 'languageIDs'); @@ -1018,7 +1018,7 @@ class SessionHandler extends SingletonFactory { WHERE spiderID = ? AND userID IS NULL"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($spiderID)); + $statement->execute([$spiderID]); $row = $statement->fetchArray(); if ($row !== false) { // fix session validation diff --git a/wcfsetup/install/files/lib/system/setup/Installer.class.php b/wcfsetup/install/files/lib/system/setup/Installer.class.php index 1a48c3d6b6..a21c52cf40 100644 --- a/wcfsetup/install/files/lib/system/setup/Installer.class.php +++ b/wcfsetup/install/files/lib/system/setup/Installer.class.php @@ -123,8 +123,8 @@ class Installer { $tar = new Tar($this->source); // distinct directories and files - $directories = array(); - $files = array(); + $directories = []; + $files = []; foreach ($tar->getContentList() as $index => $file) { if (empty($this->folder) || mb_strpos($file['filename'], $this->folder) === 0) { if (!empty($this->folder)) { @@ -146,7 +146,7 @@ class Installer { $this->checkFiles($files); // now create the directories - $errors = array(); + $errors = []; foreach ($directories as $dir) { try { $this->createDir($dir); diff --git a/wcfsetup/install/files/lib/system/setup/Uninstaller.class.php b/wcfsetup/install/files/lib/system/setup/Uninstaller.class.php index d4ca918ec6..021ea5e1b7 100644 --- a/wcfsetup/install/files/lib/system/setup/Uninstaller.class.php +++ b/wcfsetup/install/files/lib/system/setup/Uninstaller.class.php @@ -97,7 +97,7 @@ class Uninstaller { protected function uninstall() { if ($this->checkTargetDir()) { // delete all files - $directories = array(); + $directories = []; foreach ($this->files as $file) { $this->deleteFile($this->targetDir.$file); diff --git a/wcfsetup/install/files/lib/system/sitemap/SitemapHandler.class.php b/wcfsetup/install/files/lib/system/sitemap/SitemapHandler.class.php index d3dad1e19a..7593e42d80 100644 --- a/wcfsetup/install/files/lib/system/sitemap/SitemapHandler.class.php +++ b/wcfsetup/install/files/lib/system/sitemap/SitemapHandler.class.php @@ -35,7 +35,7 @@ class SitemapHandler extends SingletonFactory { * @return Sitemap[] */ public function getTree() { - $tree = array(); + $tree = []; if (!empty($this->cache)) { foreach ($this->cache as $sitemap) { diff --git a/wcfsetup/install/files/lib/system/stat/AbstractCommentStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/AbstractCommentStatDailyHandler.class.php index e9173fa381..cf0cf01e5c 100644 --- a/wcfsetup/install/files/lib/system/stat/AbstractCommentStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/AbstractCommentStatDailyHandler.class.php @@ -44,14 +44,14 @@ abstract class AbstractCommentStatDailyHandler extends AbstractStatDailyHandler AND comment_response.time BETWEEN ? AND ? )"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $date, $date + 86399, $objectTypeID, $date, $date + 86399 - )); + ]); $counter = $statement->fetchColumn(); $sql = "SELECT ( @@ -68,17 +68,17 @@ abstract class AbstractCommentStatDailyHandler extends AbstractStatDailyHandler AND comment_response.time < ? )"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $date + 86400, $objectTypeID, $date + 86400 - )); + ]); $total = $statement->fetchColumn(); - return array( + return [ 'counter' => $counter, 'total' => $total - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/stat/AbstractDiskUsageStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/AbstractDiskUsageStatDailyHandler.class.php index 4c6b10260c..6d7877f218 100644 --- a/wcfsetup/install/files/lib/system/stat/AbstractDiskUsageStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/AbstractDiskUsageStatDailyHandler.class.php @@ -21,7 +21,7 @@ abstract class AbstractDiskUsageStatDailyHandler extends AbstractStatDailyHandle FROM ".$tableName." WHERE ".$dateColumnName." BETWEEN ? AND ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($date, $date + 86399)); + $statement->execute([$date, $date + 86399]); return $statement->fetchColumn(); } @@ -33,7 +33,7 @@ abstract class AbstractDiskUsageStatDailyHandler extends AbstractStatDailyHandle FROM ".$tableName." WHERE ".$dateColumnName." < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($date + 86400)); + $statement->execute([$date + 86400]); return $statement->fetchColumn(); } diff --git a/wcfsetup/install/files/lib/system/stat/AbstractStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/AbstractStatDailyHandler.class.php index d390db36e9..ed019cbd43 100644 --- a/wcfsetup/install/files/lib/system/stat/AbstractStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/AbstractStatDailyHandler.class.php @@ -26,7 +26,7 @@ abstract class AbstractStatDailyHandler implements IStatDailyHandler { FROM " . $tableName . " WHERE " . $dateColumnName . " BETWEEN ? AND ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($date, $date + 86399)); + $statement->execute([$date, $date + 86399]); return $statement->fetchColumn(); } @@ -43,7 +43,7 @@ abstract class AbstractStatDailyHandler implements IStatDailyHandler { FROM " . $tableName . " WHERE " . $dateColumnName . " < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($date + 86400)); + $statement->execute([$date + 86400]); return $statement->fetchColumn(); } diff --git a/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php index 42c0227503..fe664f6e9d 100644 --- a/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/AttachmentDiskUsageStatDailyHandler.class.php @@ -16,9 +16,9 @@ class AttachmentDiskUsageStatDailyHandler extends AbstractDiskUsageStatDailyHand * @see \wcf\system\stat\IStatDailyHandler::getData() */ public function getData($date) { - return array( + return [ 'counter' => $this->getCounter($date, 'wcf'.WCF_N.'_attachment', 'uploadTime'), 'total' => $this->getTotal($date, 'wcf'.WCF_N.'_attachment', 'uploadTime') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/stat/AttachmentStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/AttachmentStatDailyHandler.class.php index a23e7ef6c7..a19987d24f 100644 --- a/wcfsetup/install/files/lib/system/stat/AttachmentStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/AttachmentStatDailyHandler.class.php @@ -16,9 +16,9 @@ class AttachmentStatDailyHandler extends AbstractStatDailyHandler { * @see \wcf\system\stat\IStatDailyHandler::getData() */ public function getData($date) { - return array( + return [ 'counter' => $this->getCounter($date, 'wcf'.WCF_N.'_attachment', 'uploadTime'), 'total' => $this->getTotal($date, 'wcf'.WCF_N.'_attachment', 'uploadTime') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php index fdca6723a8..8ac4769cbd 100644 --- a/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/LikeStatDailyHandler.class.php @@ -25,7 +25,7 @@ class LikeStatDailyHandler extends AbstractStatDailyHandler { WHERE time BETWEEN ? AND ? AND likeValue = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($date, $date + 86399, $this->likeValue)); + $statement->execute([$date, $date + 86399, $this->likeValue]); $counter = intval($statement->fetchColumn()); $sql = "SELECT COUNT(*) @@ -33,12 +33,12 @@ class LikeStatDailyHandler extends AbstractStatDailyHandler { WHERE time < ? AND likeValue = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($date + 86400, $this->likeValue)); + $statement->execute([$date + 86400, $this->likeValue]); $total = intval($statement->fetchColumn()); - return array( + return [ 'counter' => $counter, 'total' => $total - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/stat/UserStatDailyHandler.class.php b/wcfsetup/install/files/lib/system/stat/UserStatDailyHandler.class.php index 1e20a0d82a..f7107a41a3 100644 --- a/wcfsetup/install/files/lib/system/stat/UserStatDailyHandler.class.php +++ b/wcfsetup/install/files/lib/system/stat/UserStatDailyHandler.class.php @@ -16,9 +16,9 @@ class UserStatDailyHandler extends AbstractStatDailyHandler { * @see \wcf\system\stat\IStatDailyHandler::getData() */ public function getData($date) { - return array( + return [ 'counter' => $this->getCounter($date, 'wcf'.WCF_N.'_user', 'registrationDate'), 'total' => $this->getTotal($date, 'wcf'.WCF_N.'_user', 'registrationDate') - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php index 6402f5b8bc..eacf59c388 100644 --- a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php @@ -23,7 +23,7 @@ class StyleHandler extends SingletonFactory { * style information cache * @var array */ - protected $cache = array(); + protected $cache = []; /** * active style object @@ -45,7 +45,7 @@ class StyleHandler extends SingletonFactory { * @return Style[] */ public function getAvailableStyles() { - $styles = array(); + $styles = []; foreach ($this->cache['styles'] as $styleID => $style) { if (!$style->isDisabled || WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { diff --git a/wcfsetup/install/files/lib/system/tagging/TagCloud.class.php b/wcfsetup/install/files/lib/system/tagging/TagCloud.class.php index 849996752c..1a1c9f1d96 100644 --- a/wcfsetup/install/files/lib/system/tagging/TagCloud.class.php +++ b/wcfsetup/install/files/lib/system/tagging/TagCloud.class.php @@ -31,7 +31,7 @@ class TagCloud { * list of tags * @var TagCloudTag[] */ - protected $tags = array(); + protected $tags = []; /** * max value of tag counter @@ -49,14 +49,14 @@ class TagCloud { * active language ids * @var integer[] */ - protected $languageIDs = array(); + protected $languageIDs = []; /** * Contructs a new TagCloud object. * * @param integer[] $languageIDs */ - public function __construct(array $languageIDs = array()) { + public function __construct(array $languageIDs = []) { $this->languageIDs = $languageIDs; if (empty($this->languageIDs)) { $this->languageIDs = array_keys(LanguageFactory::getInstance()->getLanguages()); diff --git a/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php b/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php index fc12c55a38..c79c230781 100644 --- a/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php +++ b/wcfsetup/install/files/lib/system/tagging/TagEngine.class.php @@ -39,15 +39,15 @@ class TagEngine extends SingletonFactory { AND objectID = ? AND languageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, $languageID - )); + ]); } // get tag ids - $tagIDs = array(); + $tagIDs = []; foreach ($tags as $tag) { if (empty($tag)) continue; @@ -60,10 +60,10 @@ class TagEngine extends SingletonFactory { $tagObj = Tag::getTag($tag, $languageID); if ($tagObj === null) { // create new tag - $tagAction = new TagAction(array(), 'create', array('data' => array( + $tagAction = new TagAction([], 'create', ['data' => [ 'name' => $tag, 'languageID' => $languageID - ))); + ]]); $tagAction->executeAction(); $returnValues = $tagAction->getReturnValues(); @@ -81,7 +81,7 @@ class TagEngine extends SingletonFactory { WCF::getDB()->beginTransaction(); $statement = WCF::getDB()->prepareStatement($sql); foreach ($tagIDs as $tagID) { - $statement->execute(array($objectID, $tagID, $objectTypeID, $languageID)); + $statement->execute([$objectID, $tagID, $objectTypeID, $languageID]); } WCF::getDB()->commitTransaction(); } @@ -101,10 +101,10 @@ class TagEngine extends SingletonFactory { AND objectID = ? ".($languageID !== null ? "AND languageID = ?" : ""); $statement = WCF::getDB()->prepareStatement($sql); - $parameters = array( + $parameters = [ $objectTypeID, $objectID - ); + ]; if ($languageID !== null) $parameters[] = $languageID; $statement->execute($parameters); } @@ -119,8 +119,8 @@ class TagEngine extends SingletonFactory { $objectTypeID = $this->getObjectTypeID($objectType); $conditionsBuilder = new PreparedStatementConditionBuilder(); - $conditionsBuilder->add('objectTypeID = ?', array($objectTypeID)); - $conditionsBuilder->add('objectID IN (?)', array($objectIDs)); + $conditionsBuilder->add('objectTypeID = ?', [$objectTypeID]); + $conditionsBuilder->add('objectID IN (?)', [$objectIDs]); $sql = "DELETE FROM wcf".WCF_N."_tag_to_object ".$conditionsBuilder; @@ -136,10 +136,10 @@ class TagEngine extends SingletonFactory { * @param integer[] $languageIDs * @return Tag[] */ - public function getObjectTags($objectType, $objectID, array $languageIDs = array()) { - $tags = $this->getObjectsTags($objectType, array($objectID), $languageIDs); + public function getObjectTags($objectType, $objectID, array $languageIDs = []) { + $tags = $this->getObjectsTags($objectType, [$objectID], $languageIDs); - return isset($tags[$objectID]) ? $tags[$objectID] : array(); + return isset($tags[$objectID]) ? $tags[$objectID] : []; } /** @@ -150,19 +150,19 @@ class TagEngine extends SingletonFactory { * @param integer[] $languageIDs * @return array */ - public function getObjectsTags($objectType, array $objectIDs, array $languageIDs = array()) { + public function getObjectsTags($objectType, array $objectIDs, array $languageIDs = []) { $objectTypeID = $this->getObjectTypeID($objectType); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("tag_to_object.objectTypeID = ?", array($objectTypeID)); - $conditions->add("tag_to_object.objectID IN (?)", array($objectIDs)); + $conditions->add("tag_to_object.objectTypeID = ?", [$objectTypeID]); + $conditions->add("tag_to_object.objectID IN (?)", [$objectIDs]); if (!empty($languageIDs)) { foreach ($languageIDs as $index => $languageID) { if (!$languageID) unset($languageIDs[$index]); } if (!empty($languageIDs)) { - $conditions->add("tag_to_object.languageID IN (?)", array($languageIDs)); + $conditions->add("tag_to_object.languageID IN (?)", [$languageIDs]); } } @@ -174,10 +174,10 @@ class TagEngine extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $tags = array(); + $tags = []; while ($tag = $statement->fetchObject('wcf\data\tag\Tag')) { if (!isset($tags[$tag->objectID])) { - $tags[$tag->objectID] = array(); + $tags[$tag->objectID] = []; } $tags[$tag->objectID][$tag->tagID] = $tag; } diff --git a/wcfsetup/install/files/lib/system/tagging/TypedTagCloud.class.php b/wcfsetup/install/files/lib/system/tagging/TypedTagCloud.class.php index 63e30b668b..f3aab43f13 100644 --- a/wcfsetup/install/files/lib/system/tagging/TypedTagCloud.class.php +++ b/wcfsetup/install/files/lib/system/tagging/TypedTagCloud.class.php @@ -18,7 +18,7 @@ class TypedTagCloud extends TagCloud { * object type ids * @var integer[] */ - protected $objectTypeIDs = array(); + protected $objectTypeIDs = []; /** * Contructs a new TypedTagCloud object. @@ -26,7 +26,7 @@ class TypedTagCloud extends TagCloud { * @param string $objectType * @param integer[] $languageIDs */ - public function __construct($objectType, array $languageIDs = array()) { + public function __construct($objectType, array $languageIDs = []) { $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.tagging.taggableObject', $objectType); $this->objectTypeIDs[] = $objectTypeObj->objectTypeID; @@ -37,9 +37,9 @@ class TypedTagCloud extends TagCloud { * Loads the tag cloud cache. */ protected function loadCache() { - $this->tags = TypedTagCloudCacheBuilder::getInstance()->getData(array( + $this->tags = TypedTagCloudCacheBuilder::getInstance()->getData([ 'languageIDs' => $this->languageIDs, 'objectTypeIDs' => $this->objectTypeIDs - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/template/ACPTemplateEngine.class.php b/wcfsetup/install/files/lib/system/template/ACPTemplateEngine.class.php index f90eaae7d9..91ff743e60 100644 --- a/wcfsetup/install/files/lib/system/template/ACPTemplateEngine.class.php +++ b/wcfsetup/install/files/lib/system/template/ACPTemplateEngine.class.php @@ -24,7 +24,7 @@ class ACPTemplateEngine extends TemplateEngine { protected function init() { parent::init(); - $this->templatePaths = array('wcf' => WCF_DIR.'acp/templates/'); + $this->templatePaths = ['wcf' => WCF_DIR.'acp/templates/']; $this->compileDir = WCF_DIR.'acp/templates/compiled/'; if (!defined('NO_IMPORTS')) { diff --git a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php index 288ad6b614..81fcab0af6 100755 --- a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php @@ -37,7 +37,7 @@ class TemplateEngine extends SingletonFactory { * directories used as template source * @var string[] */ - public $templatePaths = array(); + public $templatePaths = []; /** * namespace containing template modifiers and plugins @@ -61,13 +61,13 @@ class TemplateEngine extends SingletonFactory { * list of registered prefilters * @var string[] */ - protected $prefilters = array(); + protected $prefilters = []; /** * cached list of known template groups * @var array */ - protected $templateGroupCache = array(); + protected $templateGroupCache = []; /** * active template group id @@ -79,19 +79,19 @@ class TemplateEngine extends SingletonFactory { * all available template variables and those assigned during runtime * @var mixed[][] */ - protected $v = array(); + protected $v = []; /** * all cached variables for usage after execution in sandbox * @var mixed[][] */ - protected $sandboxVars = array(); + protected $sandboxVars = []; /** * contains all templates with assigned template listeners. * @var string[][][] */ - protected $templateListeners = array(); + protected $templateListeners = []; /** * true, if template listener code was already loaded @@ -109,7 +109,7 @@ class TemplateEngine extends SingletonFactory { * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $this->templatePaths = array('wcf' => WCF_DIR.'templates/'); + $this->templatePaths = ['wcf' => WCF_DIR.'templates/']; $this->pluginNamespace = 'wcf\system\template\plugin\\'; $this->compileDir = WCF_DIR.'templates/compiled/'; @@ -141,7 +141,7 @@ class TemplateEngine extends SingletonFactory { * Assigns some system variables. */ protected function assignSystemVariables() { - $this->v['tpl'] = array(); + $this->v['tpl'] = []; // assign super globals $this->v['tpl']['get'] =& $_GET; @@ -153,10 +153,10 @@ class TemplateEngine extends SingletonFactory { // system info $this->v['tpl']['now'] = TIME_NOW; $this->v['tpl']['template'] = ''; - $this->v['tpl']['includedTemplates'] = array(); + $this->v['tpl']['includedTemplates'] = []; // section / foreach / capture arrays - $this->v['tpl']['section'] = $this->v['tpl']['foreach'] = $this->v['tpl']['capture'] = array(); + $this->v['tpl']['section'] = $this->v['tpl']['foreach'] = $this->v['tpl']['capture'] = []; } /** @@ -284,7 +284,7 @@ class TemplateEngine extends SingletonFactory { * during runtime as it could leed to an unexpected behaviour. */ public function clearAllAssign() { - $this->v = array(); + $this->v = []; } /** @@ -310,11 +310,11 @@ class TemplateEngine extends SingletonFactory { // check if compilation is necessary if (($metaData === null) || !$this->isCompiled($templateName, $sourceFilename, $compiledFilename, $application, $metaData)) { // compile - $this->compileTemplate($templateName, $sourceFilename, $compiledFilename, array( + $this->compileTemplate($templateName, $sourceFilename, $compiledFilename, [ 'application' => $application, 'data' => $metaData, 'filename' => $metaDataFilename - )); + ]); } // assign current package id @@ -531,7 +531,7 @@ class TemplateEngine extends SingletonFactory { * @param boolean $sandbox enables execution in sandbox * @return string */ - public function fetch($templateName, $application = 'wcf', array $variables = array(), $sandbox = false) { + public function fetch($templateName, $application = 'wcf', array $variables = [], $sandbox = false) { // enable sandbox if ($sandbox) { $this->enableSandbox(); @@ -564,7 +564,7 @@ class TemplateEngine extends SingletonFactory { * @param boolean $sandbox enables execution in sandbox * @return string */ - public function fetchString($compiledSource, array $variables = array(), $sandbox = true) { + public function fetchString($compiledSource, array $variables = [], $sandbox = true) { // enable sandbox if ($sandbox) { $this->enableSandbox(); @@ -672,7 +672,7 @@ class TemplateEngine extends SingletonFactory { * @param array $variables * @param boolean $sandbox enables execution in sandbox */ - protected function includeTemplate($templateName, $application, array $variables = array(), $sandbox = true) { + protected function includeTemplate($templateName, $application, array $variables = [], $sandbox = true) { // enable sandbox if ($sandbox) { $this->enableSandbox(); @@ -729,7 +729,7 @@ class TemplateEngine extends SingletonFactory { */ protected function loadTemplateListenerCode() { if (!$this->templateListenersLoaded) { - $this->templateListeners = TemplateListenerCodeCacheBuilder::getInstance()->getData(array('environment' => $this->environment)); + $this->templateListeners = TemplateListenerCodeCacheBuilder::getInstance()->getData(['environment' => $this->environment]); $this->templateListenersLoaded = true; } } diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index c9d2ffd9d8..a3a93a09c9 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -28,17 +28,17 @@ class TemplateScriptingCompiler { * to PHP's function_exists function * @var string[] */ - protected $unknownPHPFunctions = array('isset', 'unset', 'empty'); + protected $unknownPHPFunctions = ['isset', 'unset', 'empty']; /** * PHP functions that can not be used in the modifier syntax * @var string[] */ - protected $disabledPHPFunctions = array( + protected $disabledPHPFunctions = [ 'system', 'exec', 'passthru', 'shell_exec', // command line execution 'include', 'require', 'include_once', 'require_once', // includes 'eval', 'virtual', 'call_user_func_array', 'call_user_func', 'assert' // code execution - ); + ]; /** * pattern to match variable operators like -> or . @@ -122,25 +122,25 @@ class TemplateScriptingCompiler { * list of automatically loaded tenplate plugins * @var string[] */ - protected $autoloadPlugins = array(); + protected $autoloadPlugins = []; /** * stack with template tags data * @var array */ - protected $tagStack = array(); + protected $tagStack = []; /** * list of loaded compiler plugin objects * @var ICompilerTemplatePlugin[] */ - protected $compilerPlugins = array(); + protected $compilerPlugins = []; /** * stack used to compile the capture tag * @var array */ - protected $captureStack = array(); + protected $captureStack = []; /** * left delimiter of template syntax @@ -170,7 +170,7 @@ class TemplateScriptingCompiler { * list of static includes per template * @var string[] */ - protected $staticIncludes = array(); + protected $staticIncludes = []; /** * Creates a new TemplateScriptingCompiler object. @@ -198,21 +198,21 @@ class TemplateScriptingCompiler { * @return string * @throws SystemException */ - public function compileString($identifier, $sourceContent, array $metaData = array(), $isolated = false) { + public function compileString($identifier, $sourceContent, array $metaData = [], $isolated = false) { if ($isolated) { - $previousData = array( + $previousData = [ 'autoloadPlugins' => $this->autoloadPlugins, 'currentIdentifier' => $this->currentIdentifier, 'currentLineNo' => $this->currentLineNo, 'tagStack' => $this->tagStack - ); + ]; } else { - $this->staticIncludes = array(); + $this->staticIncludes = []; } // reset vars - $this->autoloadPlugins = $this->tagStack = array(); + $this->autoloadPlugins = $this->tagStack = []; $this->currentIdentifier = $identifier; $this->currentLineNo = 1; @@ -229,7 +229,7 @@ class TemplateScriptingCompiler { $sourceContent = $this->removeComments($sourceContent); // match all template tags - $matches = array(); + $matches = []; preg_match_all("~".$this->ldq."(.*?)".$this->rdq."~s", $sourceContent, $matches); $templateTags = $matches[1]; @@ -237,7 +237,7 @@ class TemplateScriptingCompiler { $textBlocks = preg_split("~".$this->ldq.".*?".$this->rdq."~s", $sourceContent); // compile the template tags into php-code - $compiledTags = array(); + $compiledTags = []; for ($i = 0, $j = count($templateTags); $i < $j; $i++) { $this->currentLineNo += mb_substr_count($textBlocks[$i], "\n"); $compiledTags[] = $this->compileTag($templateTags[$i], $identifier, $metaData); @@ -287,12 +287,12 @@ class TemplateScriptingCompiler { $this->tagStack = $previousData['tagStack']; } - return array( - 'meta' => array( + return [ + 'meta' => [ 'include' => $this->staticIncludes - ), + ], 'template' => $compiledAutoloadPlugins.$compiledContent - ); + ]; } /** @@ -310,7 +310,7 @@ class TemplateScriptingCompiler { return $this->compileOutputTag($tag); } - $match = array(); + $match = []; // replace 'else if' with 'elseif' $tag = preg_replace('~^else\s+if(?=\s)~i', 'elseif', $tag); @@ -570,7 +570,7 @@ class TemplateScriptingCompiler { } } - $this->captureStack[] = array('name' => $args['name'], 'variable' => $args['assign'], 'append' => $append); + $this->captureStack[] = ['name' => $args['name'], 'variable' => $args['assign'], 'append' => $append]; return ''; } else { @@ -776,7 +776,7 @@ class TemplateScriptingCompiler { if ($staticInclude) { $phpCode = ''; if (!isset($this->staticIncludes[$application])) { - $this->staticIncludes[$application] = array(); + $this->staticIncludes[$application] = []; } if (!in_array($templateName, $this->staticIncludes[$application])) { @@ -784,7 +784,7 @@ class TemplateScriptingCompiler { } // pass remaining tag args as variables - $variables = array(); + $variables = []; if (!empty($args)) { foreach ($args as $variable => $value) { if (substr($value, 0, 1) == "'") { @@ -808,11 +808,11 @@ class TemplateScriptingCompiler { $sourceFilename = $this->template->getSourceFilename($templateName, $application); $metaDataFilename = $this->template->getMetaDataFilename($templateName); - $data = $this->compileString($templateName, file_get_contents($sourceFilename), array( + $data = $this->compileString($templateName, file_get_contents($sourceFilename), [ 'application' => $application, 'data' => null, 'filename' => '' - ), true); + ], true); return $phpCode . $data['template']; } @@ -866,10 +866,10 @@ class TemplateScriptingCompiler { } // parse tag arguments - $matches = array(); + $matches = []; // find all variables preg_match_all('~\s+(\w+)\s*=\s*([^=]*)(?=\s|$)~s', $tagArgs, $matches); - $args = array(); + $args = []; for ($i = 0, $j = count($matches[1]); $i < $j; $i++) { $name = $matches[1][$i]; $string = $this->compileVariableTag($matches[2][$i], false); @@ -942,7 +942,7 @@ class TemplateScriptingCompiler { */ protected function compileIfTag($tagArgs, $elseif = false) { $tagArgs = $this->replaceQuotes($tagArgs); - $tagArgs = str_replace(array(' ', "\n"), '', $tagArgs); + $tagArgs = str_replace([' ', "\n"], '', $tagArgs); // split tags preg_match_all('~('.$this->conditionOperatorPattern.')~', $tagArgs, $matches); @@ -1002,7 +1002,7 @@ class TemplateScriptingCompiler { * @param string $tag */ public function pushTag($tag) { - $this->tagStack[] = array($tag, $this->currentLineNo); + $this->tagStack[] = [$tag, $this->currentLineNo]; } /** @@ -1141,7 +1141,7 @@ class TemplateScriptingCompiler { $values = preg_split('~(?:'.$this->variableOperatorPattern.')~', $compiledTag); // parse tags - $statusStack = array(0 => 'start'); + $statusStack = [0 => 'start']; $result = ''; $modifierData = null; for ($i = 0, $j = count($values); $i < $j; $i++) { @@ -1335,8 +1335,8 @@ class TemplateScriptingCompiler { } } - $statusStack = array(0 => 'modifier'); - $modifierData = array('name' => '', 'parameter' => array(0 => $result)); + $statusStack = [0 => 'modifier']; + $modifierData = ['name' => '', 'parameter' => [0 => $result]]; $result = ''; break; @@ -1503,7 +1503,7 @@ class TemplateScriptingCompiler { * @return string */ public function replaceLiterals($string) { - return preg_replace_callback("~".$this->ldq."literal".$this->rdq."(.*?)".$this->ldq."/literal".$this->rdq."~s", array($this, 'replaceLiteralsCallback'), $string); + return preg_replace_callback("~".$this->ldq."literal".$this->rdq."(.*?)".$this->ldq."/literal".$this->rdq."~s", [$this, 'replaceLiteralsCallback'], $string); } /** @@ -1540,8 +1540,8 @@ class TemplateScriptingCompiler { * @return string */ public function replaceQuotes($string) { - $string = preg_replace_callback('~\'([^\'\\\\]+|\\\\.)*\'~', array($this, 'replaceSingleQuotesCallback'), $string); - $string = preg_replace_callback('~"([^"\\\\]+|\\\\.)*"~', array($this, 'replaceDoubleQuotesCallback'), $string); + $string = preg_replace_callback('~\'([^\'\\\\]+|\\\\.)*\'~', [$this, 'replaceSingleQuotesCallback'], $string); + $string = preg_replace_callback('~"([^"\\\\]+|\\\\.)*"~', [$this, 'replaceDoubleQuotesCallback'], $string); return $string; } @@ -1583,7 +1583,7 @@ class TemplateScriptingCompiler { * @return string */ public function replaceConstants($string) { - return preg_replace_callback('~(?<=^|'.$this->variableOperatorPattern.')(?i)((?:\-?\d+(?:\.\d+)?)|true|false|null)(?=$|'.$this->variableOperatorPattern.')~', array($this, 'replaceConstantsCallback'), $string); + return preg_replace_callback('~(?<=^|'.$this->variableOperatorPattern.')(?i)((?:\-?\d+(?:\.\d+)?)|true|false|null)(?=$|'.$this->variableOperatorPattern.')~', [$this, 'replaceConstantsCallback'], $string); } /** diff --git a/wcfsetup/install/files/lib/system/template/plugin/CounterFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/CounterFunctionTemplatePlugin.class.php index bf1f222cde..0c275b514f 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/CounterFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/CounterFunctionTemplatePlugin.class.php @@ -21,7 +21,7 @@ class CounterFunctionTemplatePlugin implements IFunctionTemplatePlugin { * counter data * @var array */ - protected $counters = array(); + protected $counters = []; /** * @see \wcf\system\template\IFunctionTemplatePlugin::execute() @@ -32,13 +32,13 @@ class CounterFunctionTemplatePlugin implements IFunctionTemplatePlugin { } if (!isset($this->counters[$tagArgs['name']])) { - $this->counters[$tagArgs['name']] = array( + $this->counters[$tagArgs['name']] = [ 'skip' => isset($tagArgs['skip']) ? $tagArgs['skip'] : 1, 'direction' => isset($tagArgs['direction']) ? $tagArgs['direction'] : 'up', 'assign' => (isset($tagArgs['assign']) && !empty($tagArgs['assign'])) ? $tagArgs['assign'] : null, 'print' => isset($tagArgs['print']) ? $tagArgs['print'] : false, 'count' => isset($tagArgs['start']) ? $tagArgs['start'] : 1 - ); + ]; } $counter =& $this->counters[$tagArgs['name']]; diff --git a/wcfsetup/install/files/lib/system/template/plugin/CycleFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/CycleFunctionTemplatePlugin.class.php index 1b0712f045..97021aec51 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/CycleFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/CycleFunctionTemplatePlugin.class.php @@ -21,7 +21,7 @@ class CycleFunctionTemplatePlugin implements IFunctionTemplatePlugin { * cycle data * @var array */ - protected $cycles = array(); + protected $cycles = []; /** * @see \wcf\system\template\IFunctionTemplatePlugin::execute() diff --git a/wcfsetup/install/files/lib/system/template/plugin/HascontentPrefilterTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HascontentPrefilterTemplatePlugin.class.php index 489ced75c2..a3ab22cec2 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/HascontentPrefilterTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/HascontentPrefilterTemplatePlugin.class.php @@ -33,7 +33,7 @@ class HascontentPrefilterTemplatePlugin implements IPrefilterTemplatePlugin { $ldq = preg_quote($compiler->getLeftDelimiter(), '~'); $rdq = preg_quote($compiler->getRightDelimiter(), '~'); - $sourceContent = preg_replace_callback("~{$ldq}hascontent( assign='(?P.*)')?{$rdq}(?P.*){$ldq}content{$rdq}(?P.*){$ldq}\/content{$rdq}(?P.*)({$ldq}hascontentelse{$rdq}(?P.*))?{$ldq}\/hascontent{$rdq}~sU", array('self', 'replaceContentCallback'), $sourceContent); + $sourceContent = preg_replace_callback("~{$ldq}hascontent( assign='(?P.*)')?{$rdq}(?P.*){$ldq}content{$rdq}(?P.*){$ldq}\/content{$rdq}(?P.*)({$ldq}hascontentelse{$rdq}(?P.*))?{$ldq}\/hascontent{$rdq}~sU", ['self', 'replaceContentCallback'], $sourceContent); return $sourceContent; } diff --git a/wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php index 1611e3126c..41225e45ee 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php @@ -58,10 +58,10 @@ class HtmlCheckboxesFunctionTemplatePlugin implements IFunctionTemplatePlugin { // get selected values if (isset($tagArgs['selected'])) { - if (!is_array($tagArgs['selected'])) $tagArgs['selected'] = array($tagArgs['selected']); + if (!is_array($tagArgs['selected'])) $tagArgs['selected'] = [$tagArgs['selected']]; } else { - $tagArgs['selected'] = array(); + $tagArgs['selected'] = []; } if (!isset($tagArgs['separator'])) { $tagArgs['separator'] = ''; diff --git a/wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php index 7de12a4961..4038418c8e 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php @@ -28,7 +28,7 @@ class HtmlOptionsFunctionTemplatePlugin extends HtmlCheckboxesFunctionTemplatePl * selected values * @var string[] */ - protected $selected = array(); + protected $selected = []; /** * @see \wcf\system\template\IFunctionTemplatePlugin::execute() @@ -44,7 +44,7 @@ class HtmlOptionsFunctionTemplatePlugin extends HtmlCheckboxesFunctionTemplatePl $tagArgs['options'] = array_combine($tagArgs['values'], $tagArgs['output']); } else { - $tagArgs['options'] = array(); + $tagArgs['options'] = []; } } else { @@ -52,7 +52,7 @@ class HtmlOptionsFunctionTemplatePlugin extends HtmlCheckboxesFunctionTemplatePl } } else { - $tagArgs['options'] = array(); + $tagArgs['options'] = []; } } @@ -68,10 +68,10 @@ class HtmlOptionsFunctionTemplatePlugin extends HtmlCheckboxesFunctionTemplatePl } // get selected values - $this->selected = array(); + $this->selected = []; if (isset($tagArgs['selected'])) { $this->selected = $tagArgs['selected']; - if (!is_array($this->selected)) $this->selected = array($this->selected); + if (!is_array($this->selected)) $this->selected = [$this->selected]; } // create option list diff --git a/wcfsetup/install/files/lib/system/template/plugin/ImplodeCompilerTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/ImplodeCompilerTemplatePlugin.class.php index 001d795fe9..9279d8b71c 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/ImplodeCompilerTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/ImplodeCompilerTemplatePlugin.class.php @@ -22,7 +22,7 @@ class ImplodeCompilerTemplatePlugin implements ICompilerTemplatePlugin { * local tag stack * @var string[] */ - protected $tagStack = array(); + protected $tagStack = []; /** * @see \wcf\system\template\ICompilerTemplatePlugin::executeStart() @@ -39,7 +39,7 @@ class ImplodeCompilerTemplatePlugin implements ICompilerTemplatePlugin { $hash = StringUtil::getRandomID(); $glue = isset($tagArgs['glue']) ? $tagArgs['glue'] : "', '"; - $this->tagStack[] = array('hash' => $hash, 'glue' => $glue); + $this->tagStack[] = ['hash' => $hash, 'glue' => $glue]; $phpCode = "getMimeType(), 'image/') == 0) { if (($imageData = @getimagesize($this->getLocation())) !== false) { - return array( + return [ 'width' => $imageData[0], 'height' => $imageData[1], 'mimeType' => $imageData['mime'], - ); + ]; } } diff --git a/wcfsetup/install/files/lib/system/upload/UploadHandler.class.php b/wcfsetup/install/files/lib/system/upload/UploadHandler.class.php index f7138ab98d..f4e8003d68 100644 --- a/wcfsetup/install/files/lib/system/upload/UploadHandler.class.php +++ b/wcfsetup/install/files/lib/system/upload/UploadHandler.class.php @@ -17,13 +17,13 @@ class UploadHandler { * list of uploaded files * @var UploadFile[] */ - protected $files = array(); + protected $files = []; /** * list of validation errors. * @var array */ - protected $erroneousFiles = array(); + protected $erroneousFiles = []; /** * Creates a new UploadHandler object. @@ -33,13 +33,13 @@ class UploadHandler { protected function __construct(array $rawFileData) { if (is_array($rawFileData['name'])) { // iOS work-around - $newRawFileData = array( - 'name' => array(), - 'type' => array(), - 'tmp_name' => array(), - 'error' => array(), - 'size' => array() - ); + $newRawFileData = [ + 'name' => [], + 'type' => [], + 'tmp_name' => [], + 'error' => [], + 'size' => [] + ]; $i = 0; foreach (array_keys($rawFileData['name']) as $internalFileID) { $newRawFileData['name'][$i] = '__wcf_' . $internalFileID . '_' . $rawFileData['name'][$internalFileID]; // __wcf_X_filename.ext diff --git a/wcfsetup/install/files/lib/system/user/GroupedUserList.class.php b/wcfsetup/install/files/lib/system/user/GroupedUserList.class.php index 291a49c7d2..4502c2c72a 100644 --- a/wcfsetup/install/files/lib/system/user/GroupedUserList.class.php +++ b/wcfsetup/install/files/lib/system/user/GroupedUserList.class.php @@ -18,7 +18,7 @@ class GroupedUserList implements \Countable, \Iterator { * list of user profiles shared across all instances of GroupedUserList * @var UserProfile[] */ - protected static $users = array(); + protected static $users = []; /** * group name @@ -42,7 +42,7 @@ class GroupedUserList implements \Countable, \Iterator { * list of user ids assigned for this group * @var integer[] */ - protected $userIDs = array(); + protected $userIDs = []; /** * Creates a new grouped list of users. @@ -103,7 +103,7 @@ class GroupedUserList implements \Countable, \Iterator { * Loads user profiles for outstanding user ids. */ public static function loadUsers() { - $userIDs = array(); + $userIDs = []; foreach (self::$users as $userID => $user) { if ($user === null) { $userIDs[] = $userID; diff --git a/wcfsetup/install/files/lib/system/user/UserBirthdayCache.class.php b/wcfsetup/install/files/lib/system/user/UserBirthdayCache.class.php index 2b3192ecc1..cdc16345ad 100644 --- a/wcfsetup/install/files/lib/system/user/UserBirthdayCache.class.php +++ b/wcfsetup/install/files/lib/system/user/UserBirthdayCache.class.php @@ -18,13 +18,13 @@ class UserBirthdayCache extends SingletonFactory { * loaded months * @var integer[] */ - protected $monthsLoaded = array(); + protected $monthsLoaded = []; /** * user birthdays * @var integer[] */ - protected $birthdays = array(); + protected $birthdays = []; /** * Loads the birthday cache. @@ -33,7 +33,7 @@ class UserBirthdayCache extends SingletonFactory { */ protected function loadMonth($month) { if (!isset($this->monthsLoaded[$month])) { - $this->birthdays = array_merge($this->birthdays, UserBirthdayCacheBuilder::getInstance()->getData(array('month' => $month))); + $this->birthdays = array_merge($this->birthdays, UserBirthdayCacheBuilder::getInstance()->getData(['month' => $month])); $this->monthsLoaded[$month] = true; } } @@ -51,6 +51,6 @@ class UserBirthdayCache extends SingletonFactory { $index = ($month < 10 ? '0' : '') . $month . '-' . ($day < 10 ? '0' : '') . $day; if (isset($this->birthdays[$index])) return $this->birthdays[$index]; - return array(); + return []; } } diff --git a/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php index 9b30d3a074..f178e16b54 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php @@ -19,7 +19,7 @@ class FollowUserActivityEvent extends SingletonFactory implements IUserActivityE * @see \wcf\system\user\activity\event\IUserActivityEvent::prepare() */ public function prepare(array $events) { - $objectIDs = array(); + $objectIDs = []; foreach ($events as $event) { $objectIDs[] = $event->objectID; } @@ -35,7 +35,7 @@ class FollowUserActivityEvent extends SingletonFactory implements IUserActivityE if (isset($users[$event->objectID])) { $event->setIsAccessible(); - $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.follow', array('user' => $users[$event->objectID])); + $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.follow', ['user' => $users[$event->objectID]]); $event->setTitle($text); } else { diff --git a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php index 82aa14fcd4..0068e7032a 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php @@ -24,7 +24,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA return; } - $commentIDs = array(); + $commentIDs = []; foreach ($events as $event) { $commentIDs[] = $event->objectID; } @@ -36,7 +36,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA $comments = $commentList->getObjects(); // fetch users - $userIDs = $users = array(); + $userIDs = $users = []; foreach ($comments as $comment) { $userIDs[] = $comment->objectID; } @@ -54,7 +54,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA $event->setIsAccessible(); $user = $users[$comment->objectID]; - $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.profileComment', array('user' => $user)); + $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.profileComment', ['user' => $user]); $event->setTitle($text); // output diff --git a/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php b/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php index 418fe691ee..343a95e2f7 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/UserActivityEventHandler.class.php @@ -24,7 +24,7 @@ class UserActivityEventHandler extends SingletonFactory { * cached object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * @see \wcf\system\SingletonFactory::init() @@ -78,7 +78,7 @@ class UserActivityEventHandler extends SingletonFactory { * @return \wcf\data\user\activity\event\UserActivityEvent * @throws SystemException */ - public function fireEvent($objectType, $objectID, $languageID = null, $userID = null, $time = TIME_NOW, $additionalData = array()) { + public function fireEvent($objectType, $objectID, $languageID = null, $userID = null, $time = TIME_NOW, $additionalData = []) { $objectTypeID = $this->getObjectTypeID($objectType); if ($objectTypeID === null) { throw new SystemException("Unknown recent activity event '".$objectType."'"); @@ -86,16 +86,16 @@ class UserActivityEventHandler extends SingletonFactory { if ($userID === null) $userID = WCF::getUser()->userID; - $eventAction = new UserActivityEventAction(array(), 'create', array( - 'data' => array( + $eventAction = new UserActivityEventAction([], 'create', [ + 'data' => [ 'objectTypeID' => $objectTypeID, 'objectID' => $objectID, 'languageID' => $languageID, 'userID' => $userID, 'time' => $time, 'additionalData' => serialize($additionalData) - ) - )); + ] + ]); $returnValues = $eventAction->executeAction(); return $returnValues['returnValues']; @@ -117,8 +117,8 @@ class UserActivityEventHandler extends SingletonFactory { } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("objectTypeID = ?", array($objectTypeID)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("objectTypeID = ?", [$objectTypeID]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "DELETE FROM wcf".WCF_N."_user_activity_event ".$conditions; @@ -141,7 +141,7 @@ class UserActivityEventHandler extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql); foreach ($eventIDs as $eventID) { - $statement->execute(array($eventID)); + $statement->execute([$eventID]); } } } diff --git a/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php b/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php index 062bf84968..b99434f4aa 100644 --- a/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/point/UserActivityPointHandler.class.php @@ -24,13 +24,13 @@ class UserActivityPointHandler extends SingletonFactory { * list of user activity point object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * maps the user activity point object type ids to their object type names * @var string[] */ - protected $objectTypeNames = array(); + protected $objectTypeNames = []; /** * @see \wcf\system\SingletonFactory::init() @@ -52,7 +52,7 @@ class UserActivityPointHandler extends SingletonFactory { * @param mixed[] $additionalData * @throws SystemException */ - public function fireEvent($objectType, $objectID, $userID = null, array $additionalData = array()) { + public function fireEvent($objectType, $objectID, $userID = null, array $additionalData = []) { $objectTypeObj = $this->getObjectTypeByName($objectType); if ($objectTypeObj === null) { throw new SystemException("Object type '".$objectType."' is not valid for object type definition 'com.woltlab.wcf.user.activityPointEvent'"); @@ -69,27 +69,27 @@ class UserActivityPointHandler extends SingletonFactory { UPDATE activityPoints = activityPoints + VALUES(activityPoints), items = items + 1"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $userID, $objectTypeObj->objectTypeID, $objectTypeObj->points - )); + ]); $sql = "UPDATE wcf".WCF_N."_user SET activityPoints = activityPoints + ? WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeObj->points, $userID - )); + ]); // update user ranks - $this->updateUserRanks(array($userID)); + $this->updateUserRanks([$userID]); // check if the user will be automatically added to new user groups // because of the new activity points - UserGroupAssignmentHandler::getInstance()->checkUsers(array($userID)); + UserGroupAssignmentHandler::getInstance()->checkUsers([$userID]); } /** @@ -117,7 +117,7 @@ class UserActivityPointHandler extends SingletonFactory { // update user_activity_point $values = ''; - $parameters = $userIDs = array(); + $parameters = $userIDs = []; foreach ($itemsToUser as $userID => $items) { if (!empty($values)) $values .= ','; $values .= '(?, ?, ?, ?)'; @@ -172,12 +172,12 @@ class UserActivityPointHandler extends SingletonFactory { AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($userToItems as $userID => $items) { - $statement->execute(array( + $statement->execute([ ($items * $objectTypeObj->points), $items, $objectTypeObj->objectTypeID, $userID - )); + ]); } // update total activity points per user @@ -193,7 +193,7 @@ class UserActivityPointHandler extends SingletonFactory { public function updateUsers(array $userIDs) { $userIDs = array_unique($userIDs); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($userIDs)); + $conditions->add("userID IN (?)", [$userIDs]); $sql = "UPDATE wcf".WCF_N."_user user_table SET activityPoints = COALESCE(( @@ -228,7 +228,7 @@ class UserActivityPointHandler extends SingletonFactory { items = 0 WHERE objectTypeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($objectTypeObj->objectTypeID)); + $statement->execute([$objectTypeObj->objectTypeID]); } /** diff --git a/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php b/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php index 193ccfa084..d0f47aa975 100644 --- a/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php +++ b/wcfsetup/install/files/lib/system/user/authentication/UserAuthenticationFactory.class.php @@ -38,7 +38,7 @@ class UserAuthenticationFactory extends SingletonFactory { throw new SystemException("'" . $this->className . "' does not implement 'wcf\system\user\authentication\IUserAuthentication'"); } - $this->userAuthentication = call_user_func(array($this->className, 'getInstance')); + $this->userAuthentication = call_user_func([$this->className, 'getInstance']); } /** diff --git a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php index 2e0d5ad4af..657bac2310 100644 --- a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php @@ -28,16 +28,16 @@ class UserCollapsibleContentHandler extends SingletonFactory { * list of collapsed object ids per object type id * @var integer[][] */ - protected $collapsedContent = array(); + protected $collapsedContent = []; /** * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $this->cache = array( - 'objectTypes' => array(), - 'objectTypeIDs' => array() - ); + $this->cache = [ + 'objectTypes' => [], + 'objectTypeIDs' => [] + ]; $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.collapsibleContent'); foreach ($objectTypes as $objectType) { @@ -86,7 +86,7 @@ class UserCollapsibleContentHandler extends SingletonFactory { */ public function getCollapsedContent($objectTypeID) { if (!isset($this->collapsedContent[$objectTypeID])) { - $this->collapsedContent[$objectTypeID] = array(); + $this->collapsedContent[$objectTypeID] = []; if (WCF::getUser()->userID) { $data = UserStorageHandler::getInstance()->getField('collapsedContent-'.$objectTypeID); @@ -98,10 +98,10 @@ class UserCollapsibleContentHandler extends SingletonFactory { WHERE objectTypeID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, WCF::getUser()->userID - )); + ]); $this->collapsedContent[$objectTypeID] = $statement->fetchAll(\PDO::FETCH_COLUMN); // update storage data @@ -138,11 +138,11 @@ class UserCollapsibleContentHandler extends SingletonFactory { AND objectID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, WCF::getUser()->userID - )); + ]); $row = $statement->fetchArray(); if (!$row) { @@ -150,24 +150,24 @@ class UserCollapsibleContentHandler extends SingletonFactory { (objectTypeID, objectID, userID) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, WCF::getUser()->userID - )); + ]); } // reset storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'collapsedContent-'.$objectTypeID); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'collapsedContent-'.$objectTypeID); } else { $collapsedContent = WCF::getSession()->getVar('collapsedContent'); if ($collapsedContent === null || !is_array($collapsedContent)) { - $collapsedContent = array(); + $collapsedContent = []; } if (!in_array($objectID, $collapsedContent)) { - $collapsedContent[$objectTypeID] = array(); + $collapsedContent[$objectTypeID] = []; } $collapsedContent[$objectTypeID][] = $objectID; @@ -188,19 +188,19 @@ class UserCollapsibleContentHandler extends SingletonFactory { AND objectID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, WCF::getUser()->userID - )); + ]); // reset storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'collapsedContent-'.$objectTypeID); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'collapsedContent-'.$objectTypeID); } else { $collapsedContent = WCF::getSession()->getVar('collapsedContent'); if ($collapsedContent === null || !is_array($collapsedContent)) { - $collapsedContent = array(); + $collapsedContent = []; } if (isset($collapsedContent[$objectTypeID])) { @@ -226,18 +226,18 @@ class UserCollapsibleContentHandler extends SingletonFactory { WHERE objectTypeID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeID, WCF::getUser()->userID - )); + ]); // reset storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'collapsedContent-'.$objectTypeID); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'collapsedContent-'.$objectTypeID); } else { $collapsedContent = WCF::getSession()->getVar('collapsedContent'); if ($collapsedContent === null || !is_array($collapsedContent)) { - $collapsedContent = array(); + $collapsedContent = []; } if (isset($collapsedContent[$objectTypeID])) { @@ -263,9 +263,9 @@ class UserCollapsibleContentHandler extends SingletonFactory { } $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('objectTypeID = ?', array($objectTypeID)); + $conditionBuilder->add('objectTypeID = ?', [$objectTypeID]); if ($objectID) { - $conditionBuilder->add('objectID = ?', array($objectID)); + $conditionBuilder->add('objectID = ?', [$objectID]); } $sql = "DELETE FROM wcf".WCF_N."_user_collapsible_content diff --git a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleSidebarHandler.class.php b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleSidebarHandler.class.php index 7b657e6c8f..b64cc1d438 100644 --- a/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleSidebarHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleSidebarHandler.class.php @@ -20,7 +20,7 @@ class UserCollapsibleSidebarHandler extends SingletonFactory implements IAJAXInv * list of methods allowed for remote invoke * @var string[] */ - public static $allowInvoke = array('toggle'); + public static $allowInvoke = ['toggle']; /** * Toggles a sidebar. diff --git a/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php b/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php index 7dee2d437b..64b3f55389 100644 --- a/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php @@ -23,7 +23,7 @@ class UserGroupAssignmentHandler extends SingletonFactory { * list of grouped user group assignment condition object types * @var array */ - protected $groupedObjectTypes = array(); + protected $groupedObjectTypes = []; /** * Checks if the users with the given ids should be assigned to new user @@ -44,7 +44,7 @@ class UserGroupAssignmentHandler extends SingletonFactory { $assignments = UserGroupAssignmentCacheBuilder::getInstance()->getData(); foreach ($userList as $user) { $groupIDs = $user->getGroupIDs(); - $newGroupIDs = array(); + $newGroupIDs = []; foreach ($assignments as $assignment) { if (in_array($assignment->groupID, $groupIDs) || in_array($assignment->groupID, $newGroupIDs)) { @@ -66,11 +66,11 @@ class UserGroupAssignmentHandler extends SingletonFactory { } if (!empty($newGroupIDs)) { - $userAction = new UserAction(array($user), 'addToGroups', array( + $userAction = new UserAction([$user], 'addToGroups', [ 'addDefaultGroups' => false, 'deleteOldGroups' => false, 'groups' => $newGroupIDs - )); + ]); $userAction->executeAction(); } } @@ -94,9 +94,9 @@ class UserGroupAssignmentHandler extends SingletonFactory { */ public function getUsers(UserGroupAssignment $assignment) { $userList = new UserList(); - $userList->getConditionBuilder()->add('user_table.userID NOT IN (SELECT userID FROM wcf'.WCF_N.'_user_to_group WHERE groupID = ?)', array( + $userList->getConditionBuilder()->add('user_table.userID NOT IN (SELECT userID FROM wcf'.WCF_N.'_user_to_group WHERE groupID = ?)', [ $assignment->groupID - )); + ]); $conditions = $assignment->getConditions(); foreach ($conditions as $condition) { @@ -116,7 +116,7 @@ class UserGroupAssignmentHandler extends SingletonFactory { if (!$objectType->conditiongroup) continue; if (!isset($this->groupedObjectTypes[$objectType->conditiongroup])) { - $this->groupedObjectTypes[$objectType->conditiongroup] = array(); + $this->groupedObjectTypes[$objectType->conditiongroup] = []; } $this->groupedObjectTypes[$objectType->conditiongroup][$objectType->objectTypeID] = $objectType; diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index e63be98347..fbc9412a93 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -38,13 +38,13 @@ class UserNotificationHandler extends SingletonFactory { * list of available object types * @var array */ - protected $availableObjectTypes = array(); + protected $availableObjectTypes = []; /** * list of available events * @var array */ - protected $availableEvents = array(); + protected $availableEvents = []; /** * number of outstanding notifications @@ -56,7 +56,7 @@ class UserNotificationHandler extends SingletonFactory { * list of object types * @var ObjectType[] */ - protected $objectTypes = array(); + protected $objectTypes = []; /** * @see \wcf\system\SingletonFactory::init() @@ -83,7 +83,7 @@ class UserNotificationHandler extends SingletonFactory { * @param integer $baseObjectID * @throws SystemException */ - public function fireEvent($eventName, $objectType, IUserNotificationObject $notificationObject, array $recipientIDs, array $additionalData = array(), $baseObjectID = 0) { + public function fireEvent($eventName, $objectType, IUserNotificationObject $notificationObject, array $recipientIDs, array $additionalData = [], $baseObjectID = 0) { // check given object type and event name if (!isset($this->availableEvents[$objectType][$eventName])) { throw new SystemException("Unknown event ".$objectType."-".$eventName." given"); @@ -104,13 +104,13 @@ class UserNotificationHandler extends SingletonFactory { } } if ($userProfile === null) { - $userProfile = new UserProfile(new User(null, array())); + $userProfile = new UserProfile(new User(null, [])); } // set object data - $event->setObject(new UserNotification(null, array()), $notificationObject, $userProfile, $additionalData); + $event->setObject(new UserNotification(null, []), $notificationObject, $userProfile, $additionalData); - $parameters = array( + $parameters = [ 'eventName' => $eventName, 'objectType' => $objectType, 'notificationObject' => $notificationObject, @@ -120,22 +120,22 @@ class UserNotificationHandler extends SingletonFactory { 'objectTypeObject' => $objectTypeObject, 'userProfile' => $userProfile, 'event' => $event - ); + ]; EventHandler::getInstance()->fireAction($this, 'fireEvent', $parameters); // find existing notifications $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($recipientIDs)); - $conditions->add("eventID = ?", array($event->eventID)); - $conditions->add("eventHash = ?", array($event->getEventHash())); - $conditions->add("confirmTime = ?", array(0)); + $conditions->add("userID IN (?)", [$recipientIDs]); + $conditions->add("eventID = ?", [$event->eventID]); + $conditions->add("eventHash = ?", [$event->getEventHash()]); + $conditions->add("confirmTime = ?", [0]); $sql = "SELECT notificationID, userID FROM wcf".WCF_N."_user_notification ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $notifications = array(); + $notifications = []; while ($row = $statement->fetchArray()) { $notifications[$row['userID']] = $row['notificationID']; } @@ -143,9 +143,9 @@ class UserNotificationHandler extends SingletonFactory { // check if event supports stacking and author should be added if (!empty($notifications) && $event->isStackable()) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("notificationID IN (?)", array(array_values($notifications))); + $conditions->add("notificationID IN (?)", [array_values($notifications)]); if ($notificationObject->getAuthorID()) { - $conditions->add("authorID = ?", array($notificationObject->getAuthorID())); + $conditions->add("authorID = ?", [$notificationObject->getAuthorID()]); } else { $conditions->add("authorID IS NULL"); @@ -176,11 +176,11 @@ class UserNotificationHandler extends SingletonFactory { WCF::getDB()->beginTransaction(); foreach ($notificationIDs as $notificationID) { - $statement->execute(array( + $statement->execute([ 1, $notificationObject->getAuthorID() ? 0 : 1, $notificationID - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -193,14 +193,14 @@ class UserNotificationHandler extends SingletonFactory { // get recipients $recipientList = new UserNotificationEventRecipientList(); - $recipientList->getConditionBuilder()->add('event_to_user.eventID = ?', array($event->eventID)); - $recipientList->getConditionBuilder()->add('event_to_user.userID IN (?)', array($recipientIDs)); + $recipientList->getConditionBuilder()->add('event_to_user.eventID = ?', [$event->eventID]); + $recipientList->getConditionBuilder()->add('event_to_user.userID IN (?)', [$recipientIDs]); $recipientList->readObjects(); $recipients = $recipientList->getObjects(); if (!empty($recipients)) { - $data = array( + $data = [ 'authorID' => ($event->getAuthorID() ?: null), - 'data' => array( + 'data' => [ 'eventID' => $event->eventID, 'authorID' => ($event->getAuthorID() ?: null), 'objectID' => $notificationObject->getObjectID(), @@ -210,18 +210,18 @@ class UserNotificationHandler extends SingletonFactory { 'mailNotified' => ($event->supportsEmailNotification() ? 0 : 1), 'time' => TIME_NOW, 'additionalData' => serialize($additionalData) - ), + ], 'recipients' => $recipients - ); + ]; if ($event->isStackable()) { $data['notifications'] = $notifications; - $action = new UserNotificationAction(array(), 'createStackable', $data); + $action = new UserNotificationAction([], 'createStackable', $data); } else { $data['data']['timesTriggered'] = 1; - $action = new UserNotificationAction(array(), 'createDefault', $data); + $action = new UserNotificationAction([], 'createDefault', $data); } $result = $action->executeAction(); @@ -263,10 +263,10 @@ class UserNotificationHandler extends SingletonFactory { WHERE userID = ? AND confirmTime = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ WCF::getUser()->userID, 0 - )); + ]); $this->notificationCount = $statement->fetchSingleColumn(); @@ -292,7 +292,7 @@ class UserNotificationHandler extends SingletonFactory { FROM wcf".WCF_N."_user_notification WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); return $statement->fetchSingleColumn(); } @@ -320,7 +320,7 @@ class UserNotificationHandler extends SingletonFactory { public function getMixedNotifications() { $notificationCount = $this->getNotificationCount(true); - $notifications = array(); + $notifications = []; if ($notificationCount > 0) { $notifications = $this->fetchNotifications(5, 0, 0); } @@ -349,16 +349,16 @@ class UserNotificationHandler extends SingletonFactory { protected function fetchNotifications($limit, $offset, $filterByConfirmed = null) { // build enormous query $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("notification.userID = ?", array(WCF::getUser()->userID)); + $conditions->add("notification.userID = ?", [WCF::getUser()->userID]); if ($filterByConfirmed !== null) { // consider only unconfirmed notifications if ($filterByConfirmed == 0) { - $conditions->add("notification.confirmTime = ?", array(0)); + $conditions->add("notification.confirmTime = ?", [0]); } else { // consider only notifications marked as confirmed in the past 48 hours (86400 = 1 day) - $conditions->add("notification.confirmTime >= ?", array(TIME_NOW - (2 * 86400))); + $conditions->add("notification.confirmTime >= ?", [TIME_NOW - (2 * 86400)]); } } @@ -373,7 +373,7 @@ class UserNotificationHandler extends SingletonFactory { $statement = WCF::getDB()->prepareStatement($sql, $limit, $offset); $statement->execute($conditions->getParameters()); - $notifications = array(); + $notifications = []; while ($notification = $statement->fetchObject('\wcf\data\user\notification\UserNotification')) { $notifications[$notification->notificationID] = $notification; } @@ -390,21 +390,21 @@ class UserNotificationHandler extends SingletonFactory { public function processNotifications(array $notificationObjects) { // return an empty set if no notifications exist if (empty($notificationObjects)) { - return array( + return [ 'count' => 0, - 'notifications' => array() - ); + 'notifications' => [] + ]; } - $eventIDs = $notificationIDs = $objectTypes = array(); + $eventIDs = $notificationIDs = $objectTypes = []; foreach ($notificationObjects as $notification) { // cache object types if (!isset($objectTypes[$notification->objectType])) { - $objectTypes[$notification->objectType] = array( + $objectTypes[$notification->objectType] = [ 'objectType' => $this->availableObjectTypes[$notification->objectType], - 'objectIDs' => array(), - 'objects' => array() - ); + 'objectIDs' => [], + 'objects' => [] + ]; } $objectTypes[$notification->objectType]['objectIDs'][] = $notification->objectID; @@ -414,21 +414,21 @@ class UserNotificationHandler extends SingletonFactory { // load authors $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("notificationID IN (?)", array($notificationIDs)); + $conditions->add("notificationID IN (?)", [$notificationIDs]); $sql = "SELECT notificationID, authorID FROM wcf".WCF_N."_user_notification_author ".$conditions." ORDER BY time ASC"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $authorIDs = $authorToNotification = array(); + $authorIDs = $authorToNotification = []; while ($row = $statement->fetchArray()) { if ($row['authorID']) { $authorIDs[] = $row['authorID']; } if (!isset($authorToNotification[$row['notificationID']])) { - $authorToNotification[$row['notificationID']] = array(); + $authorToNotification[$row['notificationID']] = []; } $authorToNotification[$row['notificationID']][] = $row['authorID']; @@ -436,7 +436,7 @@ class UserNotificationHandler extends SingletonFactory { // load authors $authors = UserProfile::getUserProfiles($authorIDs); - $unknownAuthor = new UserProfile(new User(null, array('userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')))); + $unknownAuthor = new UserProfile(new User(null, ['userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')])); // load objects associated with each object type foreach ($objectTypes as $objectType => $objectData) { @@ -445,13 +445,13 @@ class UserNotificationHandler extends SingletonFactory { // load required events $eventList = new UserNotificationEventList(); - $eventList->getConditionBuilder()->add("user_notification_event.eventID IN (?)", array($eventIDs)); + $eventList->getConditionBuilder()->add("user_notification_event.eventID IN (?)", [$eventIDs]); $eventList->readObjects(); $eventObjects = $eventList->getObjects(); // build notification data - $notifications = array(); - $deleteNotifications = array(); + $notifications = []; + $deleteNotifications = []; foreach ($notificationObjects as $notification) { $object = $objectTypes[$notification->objectType]['objects'][$notification->objectID]; if ($object->__unknownNotificationObject) { @@ -469,7 +469,7 @@ class UserNotificationHandler extends SingletonFactory { ); if (isset($authorToNotification[$notification->notificationID])) { - $eventAuthors = array(); + $eventAuthors = []; foreach ($authorToNotification[$notification->notificationID] as $userID) { if (!$userID) { $eventAuthors[0] = $unknownAuthor; @@ -483,12 +483,12 @@ class UserNotificationHandler extends SingletonFactory { } } - $data = array( + $data = [ 'authors' => count($class->getAuthors()), 'event' => $class, 'notificationID' => $notification->notificationID, 'time' => $notification->time - ); + ]; $data['confirmed'] = ($notification->confirmTime > 0); @@ -511,13 +511,13 @@ class UserNotificationHandler extends SingletonFactory { $notificationAction->executeAction(); // reset notification counter - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'userNotificationCount'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'userNotificationCount'); } - return array( + return [ 'count' => count($notifications), 'notifications' => $notifications - ); + ]; } /** @@ -540,7 +540,7 @@ class UserNotificationHandler extends SingletonFactory { * @return IUserNotificationEvent[] */ public function getEvents($objectType) { - if (!isset($this->availableEvents[$objectType])) return array(); + if (!isset($this->availableEvents[$objectType])) return []; return $this->availableEvents[$objectType]; } @@ -561,10 +561,10 @@ class UserNotificationHandler extends SingletonFactory { } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("eventID = ?", array($eventID)); - $conditions->add("objectID = ?", array($objectID)); - if ($authorID !== null) $conditions->add("authorID = ?", array($authorID)); - if ($time !== null) $conditions->add("time = ?", array($time)); + $conditions->add("eventID = ?", [$eventID]); + $conditions->add("objectID = ?", [$objectID]); + if ($authorID !== null) $conditions->add("authorID = ?", [$authorID]); + if ($time !== null) $conditions->add("time = ?", [$time]); $sql = "SELECT notificationID FROM wcf".WCF_N."_user_notification @@ -639,9 +639,9 @@ class UserNotificationHandler extends SingletonFactory { $event->setLanguage($user->getLanguage()); // add mail header - $message = $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.header', array( + $message = $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.header', [ 'user' => $user - ))."\n\n"; + ])."\n\n"; // get message $message .= $event->getEmailMessage(); @@ -650,18 +650,18 @@ class UserNotificationHandler extends SingletonFactory { $token = $user->notificationMailToken; if (!$token) { // generate token if not present - $token = mb_substr(StringUtil::getHash(serialize(array($user->userID, StringUtil::getRandomID()))), 0, 20); + $token = mb_substr(StringUtil::getHash(serialize([$user->userID, StringUtil::getRandomID()])), 0, 20); $editor = new UserEditor($user); - $editor->update(array('notificationMailToken' => $token)); + $editor->update(['notificationMailToken' => $token]); } - $message .= "\n\n".$user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.footer', array( + $message .= "\n\n".$user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.footer', [ 'user' => $user, 'token' => $token, 'notification' => $notification - )); + ]); // build mail - $mail = new Mail(array($user->username => $user->email), $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.subject', array('title' => $event->getEmailTitle())), $message); + $mail = new Mail([$user->username => $user->email], $user->getLanguage()->getDynamicVariable('wcf.user.notification.mail.subject', ['title' => $event->getEmailTitle()]), $message); $mail->setLanguage($user->getLanguage()); $mail->send(); } @@ -680,7 +680,7 @@ class UserNotificationHandler extends SingletonFactory { * @param integer[] $recipientIDs * @param integer[] $objectIDs */ - public function deleteNotifications($eventName, $objectType, array $recipientIDs, array $objectIDs = array()) { + public function deleteNotifications($eventName, $objectType, array $recipientIDs, array $objectIDs = []) { $this->markAsConfirmed($eventName, $objectType, $recipientIDs, $objectIDs); } @@ -703,15 +703,15 @@ class UserNotificationHandler extends SingletonFactory { FROM wcf".WCF_N."_user_notification_event WHERE objectTypeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectTypeObj->objectTypeID - )); + ]); $eventIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); if (!empty($eventIDs)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("eventID IN (?)", array($eventIDs)); - $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("eventID IN (?)", [$eventIDs]); + $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "SELECT userID FROM wcf".WCF_N."_user_notification @@ -742,7 +742,7 @@ class UserNotificationHandler extends SingletonFactory { * @param integer[] $objectIDs * @throws SystemException */ - public function markAsConfirmed($eventName, $objectType, array $recipientIDs, array $objectIDs = array()) { + public function markAsConfirmed($eventName, $objectType, array $recipientIDs, array $objectIDs = []) { // check given object type and event name if (!isset($this->availableEvents[$objectType][$eventName])) { throw new SystemException("Unknown event ".$objectType."-".$eventName." given"); @@ -753,9 +753,9 @@ class UserNotificationHandler extends SingletonFactory { // mark as confirmed $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("eventID = ?", array($event->eventID)); - if (!empty($recipientIDs)) $conditions->add("userID IN (?)", array($recipientIDs)); - if (!empty($objectIDs)) $conditions->add("objectID IN (?)", array($objectIDs)); + $conditions->add("eventID = ?", [$event->eventID]); + if (!empty($recipientIDs)) $conditions->add("userID IN (?)", [$recipientIDs]); + if (!empty($objectIDs)) $conditions->add("objectID IN (?)", [$objectIDs]); $sql = "UPDATE wcf".WCF_N."_user_notification SET confirmTime = ? @@ -773,7 +773,7 @@ class UserNotificationHandler extends SingletonFactory { WHERE confirmTime = ? )"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(0)); + $statement->execute([0]); // reset storage if (!empty($recipientIDs)) { @@ -790,7 +790,7 @@ class UserNotificationHandler extends SingletonFactory { * @param integer $notificationID */ public function markAsConfirmedByID($notificationID) { - $this->markAsConfirmedByIDs(array($notificationID)); + $this->markAsConfirmedByIDs([$notificationID]); } /** @@ -804,7 +804,7 @@ class UserNotificationHandler extends SingletonFactory { } $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("notificationID IN (?)", array($notificationIDs)); + $conditions->add("notificationID IN (?)", [$notificationIDs]); // mark notifications as confirmed $sql = "UPDATE wcf".WCF_N."_user_notification @@ -822,7 +822,7 @@ class UserNotificationHandler extends SingletonFactory { $statement->execute($conditions->getParameters()); // reset user storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'userNotificationCount'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'userNotificationCount'); } /** @@ -842,7 +842,7 @@ class UserNotificationHandler extends SingletonFactory { WHERE eventID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($event->eventID, WCF::getUser()->userID)); + $statement->execute([$event->eventID, WCF::getUser()->userID]); $row = $statement->fetchArray(); if ($row === false) return false; return $row['mailNotificationType']; diff --git a/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php index ca4c8c491e..72a90d37f2 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php @@ -18,7 +18,7 @@ abstract class AbstractSharedUserNotificationEvent extends AbstractUserNotificat /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::setObject() */ - public function setObject(UserNotification $notification, IUserNotificationObject $object, UserProfile $author, array $additionalData = array()) { + public function setObject(UserNotification $notification, IUserNotificationObject $object, UserProfile $author, array $additionalData = []) { parent::setObject($notification, $object, $author, $additionalData); $this->prepare(); diff --git a/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php index a42ef85ed6..e02a42e109 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php @@ -103,7 +103,7 @@ interface IUserNotificationEvent extends IDatabaseObjectProcessor { * @param \wcf\data\user\UserProfile $author * @param mixed[] $additionalData */ - public function setObject(UserNotification $notification, IUserNotificationObject $object, UserProfile $author, array $additionalData = array()); + public function setObject(UserNotification $notification, IUserNotificationObject $object, UserProfile $author, array $additionalData = []); /** * Sets the language for the event diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php index 929177e318..f0675090e2 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserFollowFollowingUserNotificationEvent.class.php @@ -24,7 +24,7 @@ class UserFollowFollowingUserNotificationEvent extends AbstractUserNotificationE public function getTitle() { $count = count($this->getAuthors()); if ($count > 1) { - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.title.stacked', array('count' => $count)); + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.title.stacked', ['count' => $count]); } return $this->getLanguage()->get('wcf.user.notification.follow.title'); @@ -38,15 +38,15 @@ class UserFollowFollowingUserNotificationEvent extends AbstractUserNotificationE $count = count($authors); if ($count > 1) { - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.message.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.message.stacked', [ 'author' => $this->author, 'authors' => $authors, 'count' => $count, 'others' => $count - 1 - )); + ]); } - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.message', array('author' => $this->author)); + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.message', ['author' => $this->author]); } /** @@ -57,23 +57,23 @@ class UserFollowFollowingUserNotificationEvent extends AbstractUserNotificationE $count = count($authors); if ($count > 1) { - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.mail.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.mail.stacked', [ 'author' => $this->author, 'authors' => $authors, 'count' => $count, 'others' => $count - 1, 'notificationType' => $notificationType - )); + ]); } - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.mail', array('author' => $this->author)); + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.follow.mail', ['author' => $this->author]); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink() */ public function getLink() { - return LinkHandler::getInstance()->getLink('User', array('object' => $this->author)); + return LinkHandler::getInstance()->getLink('User', ['object' => $this->author]); } /** diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php index 76c5646e55..a22e22a08f 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php @@ -25,10 +25,10 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv public function getTitle() { $count = count($this->getAuthors()); if ($count > 1) { - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [ 'count' => $count, 'timesTriggered' => $this->notification->timesTriggered - )); + ]); } return $this->getLanguage()->get('wcf.user.notification.comment.title'); @@ -45,18 +45,18 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv } $count = count($authors); - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', [ 'author' => $this->author, 'authors' => array_values($authors), 'count' => $count, 'others' => $count - 1, 'guestTimesTriggered' => $this->notification->guestTimesTriggered - )); + ]); } - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', [ 'author' => $this->author - )); + ]); } /** @@ -72,7 +72,7 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv } $count = count($authors); - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.stacked', [ 'author' => $this->author, 'authors' => array_values($authors), 'count' => $count, @@ -80,22 +80,22 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv 'owner' => $user, 'notificationType' => $notificationType, 'guestTimesTriggered' => $this->notification->guestTimesTriggered - )); + ]); } - return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', array( + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail', [ 'comment' => $this->userNotificationObject, 'author' => $this->author, 'owner' => $user, 'notificationType' => $notificationType - )); + ]); } /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink() */ public function getLink() { - return LinkHandler::getInstance()->getLink('User', array('id' => $this->userNotificationObject->objectID), '#wall'); + return LinkHandler::getInstance()->getLink('User', ['id' => $this->userNotificationObject->objectID], '#wall'); } /** diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php index f3190646ce..fcd221d607 100644 --- a/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php @@ -35,7 +35,7 @@ class AbstractUserNotificationObjectType extends AbstractObjectTypeProcessor imp * @see \wcf\system\user\notification\object\type\IUserNotificationObjectType::getObjectsByIDs() */ public function getObjectsByIDs(array $objectIDs) { - $indexName = call_user_func(array(static::$objectClassName, 'getDatabaseTableIndexName')); + $indexName = call_user_func([static::$objectClassName, 'getDatabaseTableIndexName']); $objectList = new static::$objectListClassName(); $objectList->setObjectIDs($objectIDs); @@ -50,10 +50,10 @@ class AbstractUserNotificationObjectType extends AbstractObjectTypeProcessor imp // '__unknownNotificationObject' tells the notification API // that the object does not exist anymore so that the related // notification can be deleted automatically - $objects[$objectID] = new static::$decoratorClassName(new static::$objectClassName(null, array( + $objects[$objectID] = new static::$decoratorClassName(new static::$objectClassName(null, [ '__unknownNotificationObject' => true, $indexName => $objectID - ))); + ])); } } diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentUserNotificationObjectType.class.php index acf0daee17..49f3328bf0 100644 --- a/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentUserNotificationObjectType.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/object/type/UserProfileCommentUserNotificationObjectType.class.php @@ -36,7 +36,7 @@ class UserProfileCommentUserNotificationObjectType extends AbstractUserNotificat FROM wcf".WCF_N."_comment WHERE commentID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($objectID)); + $statement->execute([$objectID]); $row = $statement->fetchArray(); return ($row ? $row['objectID'] : 0); diff --git a/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php b/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php index a648c512e8..2da52f388f 100644 --- a/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/object/watch/UserObjectWatchHandler.class.php @@ -39,7 +39,7 @@ class UserObjectWatchHandler extends SingletonFactory { * @see \wcf\system\user\object\watch\UserObjectWatchHandler::resetObjects(); */ public function resetObject($objectType, $objectID) { - $this->resetObjects($objectType, array($objectID)); + $this->resetObjects($objectType, [$objectID]); } /** @@ -54,8 +54,8 @@ class UserObjectWatchHandler extends SingletonFactory { // get subscriber $conditionsBuilder = new PreparedStatementConditionBuilder(); - $conditionsBuilder->add('objectTypeID = ?', array($objectTypeObj->objectTypeID)); - $conditionsBuilder->add('objectID IN (?)', array($objectIDs)); + $conditionsBuilder->add('objectTypeID = ?', [$objectTypeObj->objectTypeID]); + $conditionsBuilder->add('objectID IN (?)', [$objectIDs]); $sql = "SELECT userID FROM wcf".WCF_N."_user_object_watch ".$conditionsBuilder; @@ -76,15 +76,15 @@ class UserObjectWatchHandler extends SingletonFactory { * @param integer[] $objectIDs * @param integer[] $userIDs */ - public function deleteObjects($objectType, array $objectIDs, array $userIDs = array()) { + public function deleteObjects($objectType, array $objectIDs, array $userIDs = []) { // get object type id $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $objectType); // delete objects $conditionsBuilder = new PreparedStatementConditionBuilder(); - $conditionsBuilder->add('objectTypeID = ?', array($objectTypeObj->objectTypeID)); - $conditionsBuilder->add('objectID IN (?)', array($objectIDs)); - if (!empty($userIDs)) $conditionsBuilder->add('userID IN (?)', array($userIDs)); + $conditionsBuilder->add('objectTypeID = ?', [$objectTypeObj->objectTypeID]); + $conditionsBuilder->add('objectID IN (?)', [$objectIDs]); + if (!empty($userIDs)) $conditionsBuilder->add('userID IN (?)', [$userIDs]); $sql = "DELETE FROM wcf".WCF_N."_user_object_watch ".$conditionsBuilder; @@ -102,18 +102,18 @@ class UserObjectWatchHandler extends SingletonFactory { * @param IUserNotificationObject $notificationObject * @param array $additionalData */ - public function updateObject($objectType, $objectID, $notificationEventName, $notificationObjectType, IUserNotificationObject $notificationObject, array $additionalData = array()) { + public function updateObject($objectType, $objectID, $notificationEventName, $notificationObjectType, IUserNotificationObject $notificationObject, array $additionalData = []) { // get object type id $objectTypeObj = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.objectWatch', $objectType); // get subscriber - $userIDs = $recipientIDs = array(); + $userIDs = $recipientIDs = []; $sql = "SELECT userID, notification FROM wcf".WCF_N."_user_object_watch WHERE objectTypeID = ? AND objectID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($objectTypeObj->objectTypeID, $objectID)); + $statement->execute([$objectTypeObj->objectTypeID, $objectID]); while ($row = $statement->fetchArray()) { $userIDs[] = $row['userID']; if ($row['notification'] && $notificationObject->getAuthorID() != $row['userID']) $recipientIDs[] = $row['userID']; diff --git a/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php b/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php index f38f217d2d..e8f05bb2b6 100644 --- a/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php +++ b/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php @@ -21,7 +21,7 @@ class UserLocation implements IUserOnlineLocation { * user ids * @var integer[] */ - protected $userIDs = array(); + protected $userIDs = []; /** * list of users @@ -48,14 +48,14 @@ class UserLocation implements IUserOnlineLocation { return ''; } - return WCF::getLanguage()->getDynamicVariable($languageVariable, array('user' => $this->users[$user->objectID])); + return WCF::getLanguage()->getDynamicVariable($languageVariable, ['user' => $this->users[$user->objectID]]); } /** * Loads the users. */ protected function readUsers() { - $this->users = array(); + $this->users = []; if (empty($this->userIDs)) return; $this->userIDs = array_unique($this->userIDs); diff --git a/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php b/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php index e7d0559bbb..1894240f9c 100644 --- a/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php +++ b/wcfsetup/install/files/lib/system/user/signature/SignatureCache.class.php @@ -19,7 +19,7 @@ class SignatureCache extends SingletonFactory { * cached signatures * @var string */ - protected $signatures = array(); + protected $signatures = []; /** * Returns a parsed user signature. diff --git a/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php b/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php index d1b661fc8e..89b4d74cfc 100644 --- a/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/storage/UserStorageHandler.class.php @@ -19,19 +19,19 @@ class UserStorageHandler extends SingletonFactory { * data cache * @var mixed[][] */ - protected $cache = array(); + protected $cache = []; /** * list of outdated data records * @var mixed[][] */ - protected $resetFields = array(); + protected $resetFields = []; /** * list of updated or new data records * @var mixed[][] */ - protected $updateFields = array(); + protected $updateFields = []; /** * Loads storage for a given set of users. @@ -39,7 +39,7 @@ class UserStorageHandler extends SingletonFactory { * @param integer[] $userIDs */ public function loadStorage(array $userIDs) { - $tmp = array(); + $tmp = []; foreach ($userIDs as $userID) { if (!isset($this->cache[$userID])) $tmp[] = $userID; } @@ -48,7 +48,7 @@ class UserStorageHandler extends SingletonFactory { if (empty($tmp)) return; $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($tmp)); + $conditions->add("userID IN (?)", [$tmp]); $sql = "SELECT * FROM wcf".WCF_N."_user_storage @@ -57,7 +57,7 @@ class UserStorageHandler extends SingletonFactory { $statement->execute($conditions->getParameters()); while ($row = $statement->fetchArray()) { if (!isset($this->cache[$row['userID']])) { - $this->cache[$row['userID']] = array(); + $this->cache[$row['userID']] = []; } $this->cache[$row['userID']][$row['field']] = $row['fieldValue']; @@ -72,7 +72,7 @@ class UserStorageHandler extends SingletonFactory { * @return mixed[] */ public function getStorage(array $userIDs, $field) { - $data = array(); + $data = []; foreach ($userIDs as $userID) { if (isset($this->cache[$userID][$field])) { @@ -109,7 +109,7 @@ class UserStorageHandler extends SingletonFactory { // make sure stored data is loaded if (!isset($this->cache[$userID])) { - $this->loadStorage(array($userID)); + $this->loadStorage([$userID]); } if (isset($this->cache[$userID][$field])) { @@ -160,7 +160,7 @@ class UserStorageHandler extends SingletonFactory { $sql = "DELETE FROM wcf".WCF_N."_user_storage WHERE field = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($field)); + $statement->execute([$field]); foreach ($this->cache as $userID => $fields) { if (isset($fields[$field])) { @@ -173,18 +173,18 @@ class UserStorageHandler extends SingletonFactory { * Removes and inserts data records on shutdown. */ public function shutdown() { - $toReset = array(); + $toReset = []; // remove outdated entries foreach ($this->resetFields as $userID => $fields) { foreach ($fields as $field) { - if (!isset($toReset[$field])) $toReset[$field] = array(); + if (!isset($toReset[$field])) $toReset[$field] = []; $toReset[$field][] = $userID; } } foreach ($this->updateFields as $userID => $fieldValues) { foreach ($fieldValues as $field => $fieldValue) { - if (!isset($toReset[$field])) $toReset[$field] = array(); + if (!isset($toReset[$field])) $toReset[$field] = []; $toReset[$field][] = $userID; } } @@ -215,8 +215,8 @@ class UserStorageHandler extends SingletonFactory { foreach ($toReset as $field => $userIDs) { sort($userIDs); $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($userIDs)); - $conditions->add("field = ?", array($field)); + $conditions->add("userID IN (?)", [$userIDs]); + $conditions->add("field = ?", [$field]); $sql = "DELETE FROM wcf".WCF_N."_user_storage ".$conditions; @@ -235,11 +235,11 @@ class UserStorageHandler extends SingletonFactory { ksort($fieldValues); foreach ($fieldValues as $field => $fieldValue) { - $statement->execute(array( + $statement->execute([ $userID, $field, $fieldValue - )); + ]); } } } @@ -259,14 +259,14 @@ class UserStorageHandler extends SingletonFactory { usleep(mt_rand(0, .1e6)); // 0 to .1 seconds } } - $this->resetFields = $this->updateFields = array(); + $this->resetFields = $this->updateFields = []; } /** * Removes the entire user storage data. */ public function clear() { - $this->resetFields = $this->updateFields = array(); + $this->resetFields = $this->updateFields = []; $sql = "DELETE FROM wcf".WCF_N."_user_storage"; $statement = WCF::getDB()->prepareStatement($sql); diff --git a/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php b/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php index 7c1a9a2c5f..f11f695c46 100644 --- a/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php +++ b/wcfsetup/install/files/lib/system/visitTracker/VisitTracker.class.php @@ -27,7 +27,7 @@ class VisitTracker extends SingletonFactory { * list of available object types * @var array */ - protected $availableObjectTypes = array(); + protected $availableObjectTypes = []; /** * user visits @@ -73,12 +73,12 @@ class VisitTracker extends SingletonFactory { // cache does not exist or is outdated if ($data === null) { - $this->userVisits = array(); + $this->userVisits = []; $sql = "SELECT objectTypeID, visitTime FROM wcf".WCF_N."_tracked_visit_type WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array(WCF::getUser()->userID)); + $statement->execute([WCF::getUser()->userID]); while ($row = $statement->fetchArray()) { $this->userVisits[$row['objectTypeID']] = $row['visitTime']; } @@ -95,7 +95,7 @@ class VisitTracker extends SingletonFactory { } if (!$this->userVisits) { - $this->userVisits = array(); + $this->userVisits = []; } } @@ -125,7 +125,7 @@ class VisitTracker extends SingletonFactory { AND objectID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), $objectID, WCF::getUser()->userID)); + $statement->execute([$this->getObjectTypeID($objectType), $objectID, WCF::getUser()->userID]); $row = $statement->fetchArray(); if ($row) return $row['visitTime']; } @@ -149,7 +149,7 @@ class VisitTracker extends SingletonFactory { WHERE objectTypeID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), WCF::getUser()->userID)); + $statement->execute([$this->getObjectTypeID($objectType), WCF::getUser()->userID]); } } @@ -167,7 +167,7 @@ class VisitTracker extends SingletonFactory { (objectTypeID, objectID, userID, visitTime) VALUES (?, ?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), $objectID, WCF::getUser()->userID, $time)); + $statement->execute([$this->getObjectTypeID($objectType), $objectID, WCF::getUser()->userID, $time]); } else { WCF::getSession()->register('trackedUserVisit_'.$this->getObjectTypeID($objectType).'_'.$objectID, $time); @@ -187,7 +187,7 @@ class VisitTracker extends SingletonFactory { (objectTypeID, userID, visitTime) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), WCF::getUser()->userID, $time)); + $statement->execute([$this->getObjectTypeID($objectType), WCF::getUser()->userID, $time]); // delete obsolete object visits $sql = "DELETE FROM wcf".WCF_N."_tracked_visit @@ -195,10 +195,10 @@ class VisitTracker extends SingletonFactory { AND userID = ? AND visitTime <= ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->getObjectTypeID($objectType), WCF::getUser()->userID, $time)); + $statement->execute([$this->getObjectTypeID($objectType), WCF::getUser()->userID, $time]); // reset storage - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'trackedUserVisits'); + UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'trackedUserVisits'); } else { $this->getVisitTime($objectType); diff --git a/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php index 5cf882a94a..849fcf8d05 100644 --- a/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AbstractRebuildDataWorker.class.php @@ -49,7 +49,7 @@ abstract class AbstractRebuildDataWorker extends AbstractWorker implements IRebu * @see \wcf\system\worker\IWorker::validate() */ public function validate() { - WCF::getSession()->checkPermissions(array('admin.management.canRebuildData')); + WCF::getSession()->checkPermissions(['admin.management.canRebuildData']); } /** diff --git a/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php b/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php index d52fe8bea9..bedfb3fe80 100644 --- a/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AbstractWorker.class.php @@ -34,7 +34,7 @@ abstract class AbstractWorker implements IWorker { * list of additional parameters * @var array */ - protected $parameters = array(); + protected $parameters = []; /** * @see \wcf\system\worker\IWorker::__construct() diff --git a/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php index c3d9d64518..b2bd118391 100644 --- a/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/AttachmentRebuildDataWorker.class.php @@ -31,7 +31,7 @@ class AttachmentRebuildDataWorker extends AbstractRebuildDataWorker { parent::initObjectList(); $this->objectList->sqlOrderBy = 'attachment.attachmentID'; - $this->objectList->getConditionBuilder()->add('attachment.isImage = ?', array(1)); + $this->objectList->getConditionBuilder()->add('attachment.isImage = ?', [1]); } /** @@ -42,7 +42,7 @@ class AttachmentRebuildDataWorker extends AbstractRebuildDataWorker { foreach ($this->objectList as $attachment) { try { - $action = new AttachmentAction(array($attachment), 'generateThumbnails'); + $action = new AttachmentAction([$attachment], 'generateThumbnails'); $action->executeAction(); } catch (SystemException $e) {} diff --git a/wcfsetup/install/files/lib/system/worker/ImportWorker.class.php b/wcfsetup/install/files/lib/system/worker/ImportWorker.class.php index 4d77245995..cfc7cabfb6 100644 --- a/wcfsetup/install/files/lib/system/worker/ImportWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/ImportWorker.class.php @@ -33,7 +33,7 @@ class ImportWorker extends AbstractWorker { * @see \wcf\system\worker\IWorker::validate() */ public function validate() { - WCF::getSession()->checkPermissions(array('admin.management.canImportData')); + WCF::getSession()->checkPermissions(['admin.management.canImportData']); if (!isset($this->parameters['objectType'])) { throw new SystemException("parameter 'objectType' missing"); diff --git a/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php index 1ec63265b0..71a2b68a20 100644 --- a/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/LikeRebuildDataWorker.class.php @@ -53,8 +53,8 @@ class LikeRebuildDataWorker extends AbstractRebuildDataWorker { $statement->execute(); } - $itemsToUser = array(); - $likeObjectData = array(); + $itemsToUser = []; + $likeObjectData = []; foreach ($this->objectList as $like) { if ($like->objectUserID && $like->likeValue == Like::LIKE) { if (!isset($itemsToUser[$like->objectUserID])) { @@ -65,15 +65,15 @@ class LikeRebuildDataWorker extends AbstractRebuildDataWorker { } if (!isset($likeObjectData[$like->objectTypeID])) { - $likeObjectData[$like->objectTypeID] = array(); + $likeObjectData[$like->objectTypeID] = []; } if (!isset($likeObjectData[$like->objectTypeID][$like->objectID])) { - $likeObjectData[$like->objectTypeID][$like->objectID] = array( + $likeObjectData[$like->objectTypeID][$like->objectID] = [ 'likes' => 0, 'dislikes' => 0, 'cumulativeLikes' => 0, 'objectUserID' => $like->objectUserID - ); + ]; } if ($like->likeValue == Like::LIKE) { @@ -99,14 +99,14 @@ class LikeRebuildDataWorker extends AbstractRebuildDataWorker { WCF::getDB()->beginTransaction(); foreach ($likeObjectData as $objectTypeID => $objects) { foreach ($objects as $objectID => $data) { - $statement->execute(array( + $statement->execute([ $objectTypeID, $objectID, $data['objectUserID'], $data['likes'], $data['dislikes'], $data['cumulativeLikes'] - )); + ]); } } WCF::getDB()->commitTransaction(); diff --git a/wcfsetup/install/files/lib/system/worker/LikeUserRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/LikeUserRebuildDataWorker.class.php index ccc354ed65..29a78dffb6 100644 --- a/wcfsetup/install/files/lib/system/worker/LikeUserRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/LikeUserRebuildDataWorker.class.php @@ -55,15 +55,15 @@ class LikeUserRebuildDataWorker extends AbstractRebuildDataWorker { AND likeValue = ? ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 3); - $userData = $userIDs = array(); + $userData = $userIDs = []; foreach ($this->objectList as $likeObject) { - $userData[$likeObject->likeObjectID] = array(); + $userData[$likeObject->likeObjectID] = []; - $statement->execute(array( + $statement->execute([ $likeObject->objectID, $likeObject->objectTypeID, Like::LIKE - )); + ]); while ($row = $statement->fetchArray()) { $userData[$likeObject->likeObjectID][] = $row['userID']; $userIDs[] = $row['userID']; @@ -76,13 +76,13 @@ class LikeUserRebuildDataWorker extends AbstractRebuildDataWorker { // fetch usernames $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array($userIDs)); + $conditions->add("userID IN (?)", [$userIDs]); $sql = "SELECT userID, username FROM wcf".WCF_N."_user ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $usernames = array(); + $usernames = []; while ($row = $statement->fetchArray()) { $usernames[$row['userID']] = $row['username']; } @@ -96,17 +96,17 @@ class LikeUserRebuildDataWorker extends AbstractRebuildDataWorker { WCF::getDB()->beginTransaction(); foreach ($userData as $likeObjectID => $data) { foreach ($data as &$value) { - $value = array( + $value = [ 'userID' => $value, 'username' => $usernames[$value] - ); + ]; } unset($value); - $statement->execute(array( + $statement->execute([ serialize($data), $likeObjectID - )); + ]); } WCF::getDB()->commitTransaction(); } diff --git a/wcfsetup/install/files/lib/system/worker/MailWorker.class.php b/wcfsetup/install/files/lib/system/worker/MailWorker.class.php index 6bf09369d5..f1e517de56 100644 --- a/wcfsetup/install/files/lib/system/worker/MailWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/MailWorker.class.php @@ -40,7 +40,7 @@ class MailWorker extends AbstractWorker { * @see \wcf\system\worker\IWorker::validate() */ public function validate() { - WCF::getSession()->checkPermissions(array('admin.user.canMailUser')); + WCF::getSession()->checkPermissions(['admin.user.canMailUser']); if (!isset($this->parameters['mailID'])) { throw new SystemException("mailID missing"); @@ -60,14 +60,14 @@ class MailWorker extends AbstractWorker { public function countObjects() { $this->conditions = new PreparedStatementConditionBuilder(); if ($this->mailData['action'] == '') { - $this->conditions->add("user.userID IN (?)", array($this->mailData['userIDs'])); + $this->conditions->add("user.userID IN (?)", [$this->mailData['userIDs']]); } else { - $this->conditions->add("user.activationCode = ?", array(0)); - $this->conditions->add("user.banned = ?", array(0)); + $this->conditions->add("user.activationCode = ?", [0]); + $this->conditions->add("user.banned = ?", [0]); if ($this->mailData['action'] == 'group') { - $this->conditions->add("user.userID IN (SELECT userID FROM wcf".WCF_N."_user_to_group WHERE groupID IN (?))", array($this->mailData['groupIDs'])); + $this->conditions->add("user.userID IN (SELECT userID FROM wcf".WCF_N."_user_to_group WHERE groupID IN (?))", [$this->mailData['groupIDs']]); } } @@ -129,7 +129,7 @@ class MailWorker extends AbstractWorker { */ protected function sendMail(User $user) { try { - $mail = new Mail(array($user->username => $user->email), $this->mailData['subject'], str_replace('{$username}', $user->username, $this->mailData['text']), $this->mailData['from']); + $mail = new Mail([$user->username => $user->email], $this->mailData['subject'], str_replace('{$username}', $user->username, $this->mailData['text']), $this->mailData['from']); if ($this->mailData['enableHTML']) $mail->setContentType('text/html'); $mail->setLanguage($user->getLanguage()); $mail->send(); diff --git a/wcfsetup/install/files/lib/system/worker/SendNewPasswordWorker.class.php b/wcfsetup/install/files/lib/system/worker/SendNewPasswordWorker.class.php index 77c90fbbcf..ebc8726b8a 100644 --- a/wcfsetup/install/files/lib/system/worker/SendNewPasswordWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/SendNewPasswordWorker.class.php @@ -31,7 +31,7 @@ class SendNewPasswordWorker extends AbstractWorker { */ public function countObjects() { $userList = new UserList(); - $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($this->parameters['userIDs'])); + $userList->getConditionBuilder()->add('user_table.userID IN (?)', [$this->parameters['userIDs']]); return $userList->countObjects(); } @@ -42,7 +42,7 @@ class SendNewPasswordWorker extends AbstractWorker { public function execute() { $userList = new UserList(); $userList->decoratorClassName = 'wcf\data\user\UserEditor'; - $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($this->parameters['userIDs'])); + $userList->getConditionBuilder()->add('user_table.userID IN (?)', [$this->parameters['userIDs']]); $userList->sqlLimit = $this->limit; $userList->sqlOffset = $this->limit * $this->loopCount; $userList->readObjects(); @@ -81,18 +81,18 @@ class SendNewPasswordWorker extends AbstractWorker { protected function sendNewPassword(UserEditor $userEditor) { $newPassword = PasswordUtil::getRandomPassword((REGISTER_PASSWORD_MIN_LENGTH > 12 ? REGISTER_PASSWORD_MIN_LENGTH : 12)); - $userAction = new UserAction(array($userEditor), 'update', array( - 'data' => array( + $userAction = new UserAction([$userEditor], 'update', [ + 'data' => [ 'password' => $newPassword - ) - )); + ] + ]); $userAction->executeAction(); // send mail - $mail = new Mail(array($userEditor->username => $userEditor->email), $userEditor->getLanguage()->getDynamicVariable('wcf.acp.user.sendNewPassword.mail.subject'), $userEditor->getLanguage()->getDynamicVariable('wcf.acp.user.sendNewPassword.mail', array( + $mail = new Mail([$userEditor->username => $userEditor->email], $userEditor->getLanguage()->getDynamicVariable('wcf.acp.user.sendNewPassword.mail.subject'), $userEditor->getLanguage()->getDynamicVariable('wcf.acp.user.sendNewPassword.mail', [ 'password' => $newPassword, 'username' => $userEditor->username, - ))); + ])); $mail->send(); } @@ -100,7 +100,7 @@ class SendNewPasswordWorker extends AbstractWorker { * @see \wcf\system\worker\IWorker::validate() */ public function validate() { - WCF::getSession()->checkPermissions(array('admin.user.canEditPassword')); + WCF::getSession()->checkPermissions(['admin.user.canEditPassword']); if (!isset($this->parameters['userIDs']) || !is_array($this->parameters['userIDs']) || empty($this->parameters['userIDs'])) { throw new SystemException("'userIDs' parameter is missing or invalid"); diff --git a/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php index da7f7deca1..f6b1e688fc 100644 --- a/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/StatDailyRebuildDataWorker.class.php @@ -73,7 +73,7 @@ class StatDailyRebuildDataWorker extends AbstractRebuildDataWorker { // get object types foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.statDailyHandler') as $objectType) { $data = $objectType->getProcessor()->getData($d->getTimestamp()); - $statement->execute(array($objectType->objectTypeID, $d->format('Y-m-d'), $data['counter'], $data['total'])); + $statement->execute([$objectType->objectTypeID, $d->format('Y-m-d'), $data['counter'], $data['total']]); } $d->add(new \DateInterval('P1D')); diff --git a/wcfsetup/install/files/lib/system/worker/UserActivityPointUpdateEventsWorker.class.php b/wcfsetup/install/files/lib/system/worker/UserActivityPointUpdateEventsWorker.class.php index 59bd96553e..c2433c8087 100644 --- a/wcfsetup/install/files/lib/system/worker/UserActivityPointUpdateEventsWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/UserActivityPointUpdateEventsWorker.class.php @@ -25,7 +25,7 @@ class UserActivityPointUpdateEventsWorker extends AbstractWorker { * object types * @var ObjectType[] */ - public $objectTypes = array(); + public $objectTypes = []; /** * @see \wcf\system\worker\IWorker @@ -40,7 +40,7 @@ class UserActivityPointUpdateEventsWorker extends AbstractWorker { * @see \wcf\system\worker\IWorker::validate() */ public function validate() { - WCF::getSession()->checkPermissions(array('admin.user.canEditActivityPoints')); + WCF::getSession()->checkPermissions(['admin.user.canEditActivityPoints']); } /** @@ -61,10 +61,10 @@ class UserActivityPointUpdateEventsWorker extends AbstractWorker { SET activityPoints = items * ? WHERE objectTypeID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ $objectType->points, $objectType->objectTypeID - )); + ]); } $i++; diff --git a/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php b/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php index 64b4ec0536..bbca454cd0 100644 --- a/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php @@ -43,7 +43,7 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker { public function execute() { parent::execute(); - $users = $userIDs = array(); + $users = $userIDs = []; foreach ($this->getObjectList() as $user) { $users[] = new UserEditor($user); $userIDs[] = $user->userID; @@ -62,7 +62,7 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker { // update like counter if (MODULE_LIKE) { $conditionBuilder = new PreparedStatementConditionBuilder(); - $conditionBuilder->add('user_table.userID IN (?)', array($userIDs)); + $conditionBuilder->add('user_table.userID IN (?)', [$userIDs]); $sql = "UPDATE wcf".WCF_N."_user user_table SET likesReceived = ( SELECT COUNT(*) diff --git a/wcfsetup/install/files/lib/util/ArrayUtil.class.php b/wcfsetup/install/files/lib/util/ArrayUtil.class.php index 81e2fbd281..31f9f043a1 100644 --- a/wcfsetup/install/files/lib/util/ArrayUtil.class.php +++ b/wcfsetup/install/files/lib/util/ArrayUtil.class.php @@ -208,8 +208,8 @@ final class ArrayUtil { } // get parameters - $params1 = array($array1, $array2); - $params2 = array($array2, $array1); + $params1 = [$array1, $array2]; + $params2 = [$array2, $array1]; if ($callback !== null) { $params1[] = $callback; $params2[] = $callback; diff --git a/wcfsetup/install/files/lib/util/CLIUtil.class.php b/wcfsetup/install/files/lib/util/CLIUtil.class.php index 8bd49f3f9c..e1447355fa 100644 --- a/wcfsetup/install/files/lib/util/CLIUtil.class.php +++ b/wcfsetup/install/files/lib/util/CLIUtil.class.php @@ -21,7 +21,7 @@ final class CLIUtil { * @return string */ public static function generateTable(array $table) { - $columnSize = array(); + $columnSize = []; foreach ($table as $row) { $i = 0; foreach ($row as $column) { diff --git a/wcfsetup/install/files/lib/util/CronjobUtil.class.php b/wcfsetup/install/files/lib/util/CronjobUtil.class.php index 86c99ff0eb..4f04c2a1a9 100644 --- a/wcfsetup/install/files/lib/util/CronjobUtil.class.php +++ b/wcfsetup/install/files/lib/util/CronjobUtil.class.php @@ -31,7 +31,7 @@ final class CronjobUtil { * result date * @var integer[] */ - protected static $result = array(); + protected static $result = []; /** * time base used as reference for finding the next execution time @@ -44,13 +44,13 @@ final class CronjobUtil { * since it varies from month to month) * @var integer[] */ - public static $ranges = array( - 'minute' => array(0, 59), - 'hour' => array(0, 23), - 'dom' => array(1, 31), - 'month' => array(1, 12), - 'dow' => array(0, 6) - ); + public static $ranges = [ + 'minute' => [0, 59], + 'hour' => [0, 23], + 'dom' => [1, 31], + 'month' => [1, 12], + 'dow' => [0, 6] + ]; /** * Calculates timestamp for next execution based on cron-like expressions and a given time base. @@ -66,30 +66,30 @@ final class CronjobUtil { public static function calculateNextExec($minute, $hour, $dom, $month, $dow, $timeBase = TIME_NOW) { // initialize fields self::$timeBase = $timeBase; - self::$result = array( + self::$result = [ 'minute' => 0, 'hour' => 0, 'day' => 0, 'month' => 0, 'year' => 0 - ); + ]; - $fields = array( + $fields = [ 'minute' => $minute, 'hour' => $hour, 'dom' => $dom, 'month' => $month, 'dow' => $dow - ); + ]; self::$domRestricted = ($dom != '*') ? true : false; self::$dowRestricted = ($dow != '*') ? true : false; - $dayNames = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); - $monthNames = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'); + $dayNames = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; + $monthNames = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; // calculate values based upon each expression - $values = array(); + $values = []; foreach ($fields as $fieldName => $fieldValue) { $fieldValue = mb_strtolower($fieldValue); @@ -239,11 +239,11 @@ final class CronjobUtil { $dow = gmdate('w', gmmktime(0, 0, 1, $month, $i, $year)); if (in_array($dow, $values['dow'])) { - return array( + return [ 'day' => $i, 'month' => $month, 'year' => $year - ); + ]; } } @@ -265,11 +265,11 @@ final class CronjobUtil { for ($i = $day; $i <= $days; $i++) { if (in_array($i, $values['dom'])) { - return array( + return [ 'day' => $i, 'month' => $month, 'year' => $year - ); + ]; } } @@ -386,7 +386,7 @@ final class CronjobUtil { * @return array */ protected static function calculateValue($fieldName, $fieldValue) { - $values = array(); + $values = []; // examinate first char $char = mb_substr($fieldValue, 0, 1); @@ -427,7 +427,7 @@ final class CronjobUtil { return explode(',', $fieldValue); } - return array($fieldValue); + return [$fieldValue]; } /** @@ -439,7 +439,7 @@ final class CronjobUtil { protected static function getRanges($value) { // this is a single value if (mb_strpos($value, '-') === false) { - return array($value); + return [$value]; } $step = 1; @@ -463,7 +463,7 @@ final class CronjobUtil { * @return array */ protected static function calculateRange($startValue, $endValue, $step = 1) { - $values = array(); + $values = []; for ($i = $startValue; $i <= $endValue; $i = $i + $step) { $values[] = $i; @@ -505,7 +505,7 @@ final class CronjobUtil { $step = '[1-9]?[0-9]'; $months = 'jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec'; $days = 'mon|tue|wed|thu|fri|sat|sun'; - $namesArr = array(); + $namesArr = []; switch ($name) { // check if startMinute is a valid minute or a list of valid minutes. diff --git a/wcfsetup/install/files/lib/util/DateUtil.class.php b/wcfsetup/install/files/lib/util/DateUtil.class.php index 1005b2c42e..0d3314177a 100644 --- a/wcfsetup/install/files/lib/util/DateUtil.class.php +++ b/wcfsetup/install/files/lib/util/DateUtil.class.php @@ -32,7 +32,7 @@ final class DateUtil { * list of available time zones * @var string[] */ - protected static $availableTimezones = array( + protected static $availableTimezones = [ // there is not support for UTC-12:00 in php // '...', // (UTC-12:00) International Date Line West 'Pacific/Samoa', // (UTC-11:00) Midway Island, American Samoa @@ -128,7 +128,7 @@ final class DateUtil { 'Pacific/Fiji', // (UTC+12:00) Fiji 'Pacific/Tongatapu', // (UTC+13:00) Nukualofa 'Pacific/Apia', // (UTC+13:00) Samoa - ); + ]; /** * first day of the week @@ -203,7 +203,7 @@ final class DateUtil { } if ($fullInterval) { - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.full.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.full.'.$direction, [ 'days' => $days - 7 * $weeks, 'firstElement' => $years ? 'years' : ($months ? 'months' : ($weeks ? 'weeks' : ($days ? 'days' : ($hours ? 'hours' : 'minutes')))), 'hours' => $hours, @@ -212,42 +212,42 @@ final class DateUtil { 'months' => $months, 'weeks' => $weeks, 'years' => $years - )); + ]); } if ($years) { - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.years.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.years.'.$direction, [ 'years' => $years - )); + ]); } if ($months) { - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.months.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.months.'.$direction, [ 'months' => $months - )); + ]); } if ($weeks) { - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.weeks.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.weeks.'.$direction, [ 'weeks' => $weeks - )); + ]); } if ($days) { - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.days.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.days.'.$direction, [ 'days' => $days - )); + ]); } if ($hours) { - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.hours.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.hours.'.$direction, [ 'hours' => $hours - )); + ]); } - return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.minutes.'.$direction, array( + return WCF::getLanguage()->getDynamicVariable('wcf.date.interval.minutes.'.$direction, [ 'minutes' => $minutes - )); + ]); } /** @@ -262,7 +262,7 @@ final class DateUtil { if ($language->languageCode != 'en') { // full textual representation of the day of the week (l) if (strpos($format, 'l') !== false) { - $date = str_replace(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), array( + $date = str_replace(['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], [ $language->get('wcf.date.day.sunday'), $language->get('wcf.date.day.monday'), $language->get('wcf.date.day.tuesday'), @@ -270,12 +270,12 @@ final class DateUtil { $language->get('wcf.date.day.thursday'), $language->get('wcf.date.day.friday'), $language->get('wcf.date.day.saturday') - ), $date); + ], $date); } // textual representation of a day, three letters (D) if (strpos($format, 'D') !== false) { - $date = str_replace(array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'), array( + $date = str_replace(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], [ $language->get('wcf.date.day.sun'), $language->get('wcf.date.day.mon'), $language->get('wcf.date.day.tue'), @@ -283,12 +283,12 @@ final class DateUtil { $language->get('wcf.date.day.thu'), $language->get('wcf.date.day.fri'), $language->get('wcf.date.day.sat') - ), $date); + ], $date); } // full textual representation of a month (F) if (strpos($format, 'F') !== false) { - $date = str_replace(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), array( + $date = str_replace(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], [ $language->get('wcf.date.month.january'), $language->get('wcf.date.month.february'), $language->get('wcf.date.month.march'), @@ -301,12 +301,12 @@ final class DateUtil { $language->get('wcf.date.month.october'), $language->get('wcf.date.month.november'), $language->get('wcf.date.month.december') - ), $date); + ], $date); } // short textual representation of a month (M) if (strpos($format, 'M') !== false) { - $date = str_replace(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), array( + $date = str_replace(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], [ $language->get('wcf.date.month.short.jan'), $language->get('wcf.date.month.short.feb'), $language->get('wcf.date.month.short.mar'), @@ -319,7 +319,7 @@ final class DateUtil { $language->get('wcf.date.month.short.oct'), $language->get('wcf.date.month.short.nov'), $language->get('wcf.date.month.short.dec') - ), $date); + ], $date); } } @@ -409,7 +409,7 @@ final class DateUtil { public static function getWeekDays() { if (self::$weekDays === null) { if (self::getFirstDayOfTheWeek() == 1) { - self::$weekDays = array( + self::$weekDays = [ 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', @@ -417,10 +417,10 @@ final class DateUtil { 5 => 'friday', 6 => 'saturday', 0 => 'sunday' - ); + ]; } else { - self::$weekDays = array( + self::$weekDays = [ 0 => 'sunday', 1 => 'monday', 2 => 'tuesday', @@ -428,7 +428,7 @@ final class DateUtil { 4 => 'thursday', 5 => 'friday', 6 => 'saturday' - ); + ]; } } @@ -443,7 +443,7 @@ final class DateUtil { public static function getShortWeekDays() { if (self::$shortWeekDays === null) { if (self::getFirstDayOfTheWeek() == 1) { - self::$shortWeekDays = array( + self::$shortWeekDays = [ 1 => 'mon', 2 => 'tue', 3 => 'wed', @@ -451,10 +451,10 @@ final class DateUtil { 5 => 'fri', 6 => 'sat', 0 => 'sun' - ); + ]; } else { - self::$shortWeekDays = array( + self::$shortWeekDays = [ 0 => 'sun', 1 => 'mon', 2 => 'tue', @@ -462,7 +462,7 @@ final class DateUtil { 4 => 'thu', 5 => 'fri', 6 => 'sat' - ); + ]; } } diff --git a/wcfsetup/install/files/lib/util/Diff.class.php b/wcfsetup/install/files/lib/util/Diff.class.php index df3451662f..ca25ce052e 100644 --- a/wcfsetup/install/files/lib/util/Diff.class.php +++ b/wcfsetup/install/files/lib/util/Diff.class.php @@ -36,13 +36,13 @@ class Diff { * original array, as given by the user * @var array */ - protected $a = array(); + protected $a = []; /** * modified array, as given by the user * @var array */ - protected $b = array(); + protected $b = []; /** * size of a @@ -192,32 +192,32 @@ class Diff { if ($this->d !== null) return; $lcs = $this->getLCS(); - $this->d = array(); + $this->d = []; $positionA = 0; $positionB = 0; foreach ($lcs as $item) { // find next matching item in a, every item in between must be removed while ($positionA < $this->sizeA && $this->a[$positionA] !== $item) { - $this->d[] = array(self::REMOVED, $this->a[$positionA++]); + $this->d[] = [self::REMOVED, $this->a[$positionA++]]; } // find next matching item in b, every item in between must be removed while ($positionB < $this->sizeB && $this->b[$positionB] !== $item) { - $this->d[] = array(self::ADDED, $this->b[$positionB++]); + $this->d[] = [self::ADDED, $this->b[$positionB++]]; } // we are back in our longest common subsequence - $this->d[] = array(self::SAME, $item); + $this->d[] = [self::SAME, $item]; $positionA++; $positionB++; } // append remaining items of `a` and `b` while ($positionA < $this->sizeA) { - $this->d[] = array(self::REMOVED, $this->a[$positionA++]); + $this->d[] = [self::REMOVED, $this->a[$positionA++]]; } while ($positionB < $this->sizeB) { - $this->d[] = array(self::ADDED, $this->b[$positionB++]); + $this->d[] = [self::ADDED, $this->b[$positionB++]]; } } @@ -240,7 +240,7 @@ class Diff { public function getUnixDiff($context = 2) { $d = $this->getRawDiff(); - $result = array(); + $result = []; $result[] = "--- a"; $result[] = "+++ b"; diff --git a/wcfsetup/install/files/lib/util/DirectoryUtil.class.php b/wcfsetup/install/files/lib/util/DirectoryUtil.class.php index f0765aafec..b9bda42484 100644 --- a/wcfsetup/install/files/lib/util/DirectoryUtil.class.php +++ b/wcfsetup/install/files/lib/util/DirectoryUtil.class.php @@ -24,13 +24,13 @@ final class DirectoryUtil { * all files with full path * @var string[] */ - protected $files = array(); + protected $files = []; /** * all files with filename as key and DirectoryIterator object as value * @var \DirectoryIterator[] */ - protected $fileObjects = array(); + protected $fileObjects = []; /** * directory size in bytes @@ -60,10 +60,10 @@ final class DirectoryUtil { * all recursive and non-recursive instances of DirectoryUtil * @var DirectoryUtil[][] */ - protected static $instances = array( - true => array(), // recursive instances - false => array() // non-recursive instances - ); + protected static $instances = [ + true => [], // recursive instances + false => [] // non-recursive instances + ]; /** * Creates a new instance of DirectoryUtil. @@ -330,8 +330,8 @@ final class DirectoryUtil { */ public function clearCaches() { // clear cached list of files - $this->files = array(); - $this->fileObjects = array(); + $this->files = []; + $this->fileObjects = []; // clear cached size $this->size = 0; diff --git a/wcfsetup/install/files/lib/util/ExifUtil.class.php b/wcfsetup/install/files/lib/util/ExifUtil.class.php index b4b48e89b4..f0ff13d565 100644 --- a/wcfsetup/install/files/lib/util/ExifUtil.class.php +++ b/wcfsetup/install/files/lib/util/ExifUtil.class.php @@ -85,7 +85,7 @@ final class ExifUtil { } } - return array(); + return []; } /** @@ -188,7 +188,7 @@ final class ExifUtil { * @return array */ public static function getFormattedExifData(array $rawExifData) { - $exifData = array(); + $exifData = []; // unit is second (unsigned rational) if (isset($rawExifData['ExposureTime']) && is_string($rawExifData['ExposureTime'])) { diff --git a/wcfsetup/install/files/lib/util/FileReader.class.php b/wcfsetup/install/files/lib/util/FileReader.class.php index de8e1fa834..dec1eb1d75 100644 --- a/wcfsetup/install/files/lib/util/FileReader.class.php +++ b/wcfsetup/install/files/lib/util/FileReader.class.php @@ -19,7 +19,7 @@ class FileReader { * http options * @var array */ - protected $options = array( + protected $options = [ 'filename' => '', 'mimeType' => 'application/octet-stream', 'filesize' => 0, @@ -28,13 +28,13 @@ class FileReader { 'lastModificationTime' => 0, 'expirationDate' => 0, 'maxAge' => 0 - ); + ]; /** * list of header items * @var array */ - protected $headers = array(); + protected $headers = []; /** * start byte diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index ff557ee0f2..688070c115 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -24,19 +24,19 @@ final class HTTPRequest { * given options * @var array */ - private $options = array(); + private $options = []; /** * given post parameters * @var array */ - private $postParameters = array(); + private $postParameters = []; /** * given files * @var array */ - private $files = array(); + private $files = []; /** * indicates if request will be made via SSL @@ -96,13 +96,13 @@ final class HTTPRequest { * request headers * @var string[][] */ - private $headers = array(); + private $headers = []; /** * legacy headers * @var string[] */ - private $legacyHeaders = array(); + private $legacyHeaders = []; /** * request body @@ -114,7 +114,7 @@ final class HTTPRequest { * reply headers * @var string[] */ - private $replyHeaders = array(); + private $replyHeaders = []; /** * reply body @@ -136,7 +136,7 @@ final class HTTPRequest { * @param mixed $postParameters Parameters to send via POST * @param array $files Files to attach to the request */ - public function __construct($url, array $options = array(), $postParameters = array(), array $files = array()) { + public function __construct($url, array $options = [], $postParameters = [], array $files = []) { $this->setURL($url); $this->postParameters = $postParameters; @@ -254,11 +254,11 @@ final class HTTPRequest { */ public function execute() { // connect - $remoteFile = new RemoteFile(($this->useSSL ? 'ssl://' : '').$this->host, $this->port, $this->options['timeout'], array( - 'ssl' => array( + $remoteFile = new RemoteFile(($this->useSSL ? 'ssl://' : '').$this->host, $this->port, $this->options['timeout'], [ + 'ssl' => [ 'peer_name' => $this->originHost - ) - )); + ] + ]); if ($this->originUseSSL && PROXY_SERVER_HTTP) { if ($this->useSSL) throw new SystemException("Unable to proxy HTTPS when using TLS for proxy connection"); @@ -270,7 +270,7 @@ final class HTTPRequest { $request .= "Host: ".$this->originHost.":".$this->originPort."\r\n"; $request .= "\r\n"; $remoteFile->puts($request); - $this->replyHeaders = array(); + $this->replyHeaders = []; while (!$remoteFile->eof()) { $line = $remoteFile->gets(); if (rtrim($line) === '') { @@ -300,7 +300,7 @@ final class HTTPRequest { $remoteFile->puts($request); $inHeader = true; - $this->replyHeaders = array(); + $this->replyHeaders = []; $this->replyBody = ''; $chunkLength = 0; $bodyLength = 0; @@ -388,11 +388,11 @@ final class HTTPRequest { * Parses the reply headers. */ private function parseReplyHeaders() { - $headers = array(); + $headers = []; $lastKey = ''; foreach ($this->replyHeaders as $header) { if (strpos($header, ':') === false) { - $headers[trim($header)] = array(trim($header)); + $headers[trim($header)] = [trim($header)]; continue; } @@ -406,13 +406,13 @@ final class HTTPRequest { list($key, $value) = explode(':', $header, 2); $lastKey = $key; - if (!isset($headers[$key])) $headers[$key] = array(); + if (!isset($headers[$key])) $headers[$key] = []; $headers[$key][] = trim($value); } } // 4.2 Field names are case-insensitive. $this->replyHeaders = array_change_key_case($headers); - if (isset($this->replyHeaders['transfer-encoding'])) $this->replyHeaders['transfer-encoding'] = array(implode(',', $this->replyHeaders['transfer-encoding'])); + if (isset($this->replyHeaders['transfer-encoding'])) $this->replyHeaders['transfer-encoding'] = [implode(',', $this->replyHeaders['transfer-encoding'])]; $this->legacyHeaders = array_map('end', $headers); // get status code @@ -452,7 +452,7 @@ final class HTTPRequest { // be retrieved using a GET method on that resource. if ($this->statusCode == '303') { $newRequest->options['method'] = 'GET'; - $newRequest->postParameters = array(); + $newRequest->postParameters = []; $newRequest->addHeader('content-length', ''); $newRequest->addHeader('content-type', ''); } @@ -537,13 +537,13 @@ final class HTTPRequest { * @return array */ public function getReply() { - return array( + return [ 'statusCode' => $this->statusCode, 'headers' => $this->legacyHeaders, 'httpHeaders' => $this->replyHeaders, 'body' => $this->replyBody, 'url' => $this->url - ); + ]; } /** @@ -599,7 +599,7 @@ final class HTTPRequest { $this->headers[$name][] = $value; } else { - $this->headers[$name] = array($value); + $this->headers[$name] = [$value]; } } @@ -607,7 +607,7 @@ final class HTTPRequest { * Resets reply data when cloning. */ private function __clone() { - $this->replyHeaders = array(); + $this->replyHeaders = []; $this->replyBody = ''; $this->statusCode = 0; } diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index 01498ce4c2..7566881687 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -81,7 +81,7 @@ final class HeaderUtil { @header('X-Frame-Options: SAMEORIGIN'); } - ob_start(array('wcf\util\HeaderUtil', 'parseOutput')); + ob_start(['wcf\util\HeaderUtil', 'parseOutput']); } /** @@ -104,7 +104,7 @@ final class HeaderUtil { self::$output = $output; // move script tags to the bottom of the page - $javascript = array(); + $javascript = []; self::$output = preg_replace_callback('~(?P\s*)?~s', function($matches) use (&$javascript) { $match = ''; if (isset($matches['conditionBefore'])) $match .= $matches['conditionBefore']; @@ -159,14 +159,14 @@ final class HeaderUtil { * @param string $status */ public static function delayedRedirect($location, $message, $delay = 5, $status = 'success') { - WCF::getTPL()->assign(array( + WCF::getTPL()->assign([ 'url' => $location, 'message' => $message, 'wait' => $delay, 'templateName' => 'redirect', 'templateNameApplication' => 'wcf', 'status' => $status - )); + ]); WCF::getTPL()->display('redirect'); } diff --git a/wcfsetup/install/files/lib/util/MathUtil.class.php b/wcfsetup/install/files/lib/util/MathUtil.class.php index b5b6f55f95..2d9646b8d9 100644 --- a/wcfsetup/install/files/lib/util/MathUtil.class.php +++ b/wcfsetup/install/files/lib/util/MathUtil.class.php @@ -36,11 +36,11 @@ final class MathUtil { $lambda = $longitude * pi() / 180; $phi = $latitude * pi() / 180; - return array( + return [ 6371 * cos($phi) * cos($lambda), // x 6371 * cos($phi) * sin($lambda), // y 6371 * sin($phi) // z - ); + ]; } private function __construct() { } diff --git a/wcfsetup/install/files/lib/util/MessageUtil.class.php b/wcfsetup/install/files/lib/util/MessageUtil.class.php index d5d5f98281..23e4a1d2c5 100644 --- a/wcfsetup/install/files/lib/util/MessageUtil.class.php +++ b/wcfsetup/install/files/lib/util/MessageUtil.class.php @@ -77,7 +77,7 @@ class MessageUtil { return $matches[1]; } - return array(); + return []; } /** @@ -87,7 +87,7 @@ class MessageUtil { * @return string[] */ public static function getQuotedUsers($text) { - $usernames = array(); + $usernames = []; if (preg_match_all("~(?:\[(quote)=(?:')?(.+?)(?:')?(?:,[^\]]*)?\]|\[/quote\])~i", $text, $matches)) { $level = 0; diff --git a/wcfsetup/install/files/lib/util/OptionUtil.class.php b/wcfsetup/install/files/lib/util/OptionUtil.class.php index 090c631095..150ebbcd50 100644 --- a/wcfsetup/install/files/lib/util/OptionUtil.class.php +++ b/wcfsetup/install/files/lib/util/OptionUtil.class.php @@ -19,7 +19,7 @@ final class OptionUtil { * @return array */ public static function parseSelectOptions($selectOptions) { - $result = array(); + $result = []; $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($selectOptions))); foreach ($options as $option) { $key = $value = $option; @@ -42,7 +42,7 @@ final class OptionUtil { * @return array */ public static function parseMultipleEnableOptions($enableOptions) { - $result = array(); + $result = []; if (!empty($enableOptions)) { $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($enableOptions))); $key = -1; diff --git a/wcfsetup/install/files/lib/util/PasswordUtil.class.php b/wcfsetup/install/files/lib/util/PasswordUtil.class.php index d9ea8ee2c7..abb9c6c159 100644 --- a/wcfsetup/install/files/lib/util/PasswordUtil.class.php +++ b/wcfsetup/install/files/lib/util/PasswordUtil.class.php @@ -30,7 +30,7 @@ final class PasswordUtil { * list of supported encryption type by software identifier * @var string[] */ - private static $supportedEncryptionTypes = array( + private static $supportedEncryptionTypes = [ 'ipb2', // Invision Power Board 2.x 'ipb3', // Invision Power Board 3.x 'mybb1', // MyBB 1.x @@ -51,7 +51,7 @@ final class PasswordUtil { 'joomla3', // Joomla 3.x 'cryptMD5', 'invalid', // Never going to match anything - ); + ]; /** * blowfish cost factor diff --git a/wcfsetup/install/files/lib/util/StringStack.class.php b/wcfsetup/install/files/lib/util/StringStack.class.php index 60280cbe25..7b35b4a884 100644 --- a/wcfsetup/install/files/lib/util/StringStack.class.php +++ b/wcfsetup/install/files/lib/util/StringStack.class.php @@ -22,7 +22,7 @@ final class StringStack { * local string stack * @var string[][] */ - protected static $stringStack = array(); + protected static $stringStack = []; /** * Replaces a string with an unique hash value. @@ -36,7 +36,7 @@ final class StringStack { $hash = $delimiter.StringUtil::getHash(self::$i.uniqid(microtime()).$string).$delimiter; if (!isset(self::$stringStack[$type])) { - self::$stringStack[$type] = array(); + self::$stringStack[$type] = []; } self::$stringStack[$type][$hash] = $string; @@ -75,7 +75,7 @@ final class StringStack { return self::$stringStack[$type]; } - return array(); + return []; } private function __construct() { } diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index 6d0029f330..e2746febd2 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -380,7 +380,7 @@ final class StringUtil { * @return string[] */ public static function split($string, $length = 1) { - $result = array(); + $result = []; for ($i = 0, $max = mb_strlen($string); $i < $max; $i += $length) { $result[] = mb_substr($string, $i, $length); } @@ -648,7 +648,7 @@ final class StringUtil { if (mb_strlen(self::stripHTML($string)) <= $length) { return $string; } - $openTags = array(); + $openTags = []; $truncatedString = ''; // initalize length counter with the ending length diff --git a/wcfsetup/install/files/lib/util/UserUtil.class.php b/wcfsetup/install/files/lib/util/UserUtil.class.php index 2709f68f23..3651f326b3 100644 --- a/wcfsetup/install/files/lib/util/UserUtil.class.php +++ b/wcfsetup/install/files/lib/util/UserUtil.class.php @@ -55,7 +55,7 @@ final class UserUtil { FROM wcf".WCF_N."_user WHERE username = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($name)); + $statement->execute([$name]); return $statement->fetchSingleColumn() == 0; } @@ -94,7 +94,7 @@ final class UserUtil { FROM wcf".WCF_N."_user WHERE email = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($email)); + $statement->execute([$email]); return $statement->fetchSingleColumn() == 0; } @@ -205,12 +205,12 @@ final class UserUtil { if (substr($ip, 0, 7) == '::ffff:') { $ip = substr($ip, 7); if (preg_match('~^([a-f0-9]{1,4}):([a-f0-9]{1,4})$~', $ip, $matches)) { - $ip = array( + $ip = [ base_convert($matches[1], 16, 10), base_convert($matches[2], 16, 10) - ); + ]; - $ipParts = array(); + $ipParts = []; $tmp = $ip[0] % 256; $ipParts[] = ($ip[0] - $tmp) / 256; $ipParts[] = $tmp; diff --git a/wcfsetup/install/files/lib/util/XML.class.php b/wcfsetup/install/files/lib/util/XML.class.php index de4a9f8bb2..3d87c4d003 100644 --- a/wcfsetup/install/files/lib/util/XML.class.php +++ b/wcfsetup/install/files/lib/util/XML.class.php @@ -152,15 +152,15 @@ class XML { * @return string[][] */ protected function pollErrors() { - $errors = array(); + $errors = []; $errorList = libxml_get_errors(); foreach ($errorList as $error) { - $errors[] = array( + $errors[] = [ 'message' => $error->message, 'line' => $error->line, 'file' => $this->path - ); + ]; } libxml_clear_errors(); @@ -175,7 +175,7 @@ class XML { * @param array $errors * @throws SystemException */ - protected function throwException($message, array $errors = array()) { + protected function throwException($message, array $errors = []) { if (!empty($errors)) { $description = 'LibXML output:
';
 			foreach ($errors as $error) {
diff --git a/wcfsetup/install/files/lib/util/XMLWriter.class.php b/wcfsetup/install/files/lib/util/XMLWriter.class.php
index 85ddf868c2..769b4d6b80 100644
--- a/wcfsetup/install/files/lib/util/XMLWriter.class.php
+++ b/wcfsetup/install/files/lib/util/XMLWriter.class.php
@@ -40,7 +40,7 @@ class XMLWriter {
 	 * @param	string[]	$attributes
 	 * @throws	SystemException
 	 */
-	public function beginDocument($rootElement, $namespace, $schemaLocation, array $attributes = array()) {
+	public function beginDocument($rootElement, $namespace, $schemaLocation, array $attributes = []) {
 		if ($this->activeDocument) {
 			throw new SystemException("Could not begin a new document unless the previous is finished");
 		}
@@ -54,11 +54,11 @@ class XMLWriter {
 		
 		$this->xml->startDocument('1.0', 'UTF-8');
 		$this->startElement($rootElement);
-		$attributes = array_merge($attributes, array(
+		$attributes = array_merge($attributes, [
 			'xmlns' => $namespace,
 			'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
 			'xsi:schemaLocation' => $namespace . ' ' . $schemaLocation
-		));
+		]);
 		$this->writeAttributes($attributes);
 		
 		$this->activeDocument = true;
@@ -96,7 +96,7 @@ class XMLWriter {
 	 * @param	string		$element
 	 * @param	string[]	$attributes
 	 */
-	public function startElement($element, array $attributes = array()) {
+	public function startElement($element, array $attributes = []) {
 		$this->xml->startElement($element);
 		$this->openElements++;
 		
@@ -122,7 +122,7 @@ class XMLWriter {
 	 * @param	string		$cdata
 	 * @param	string[]	$attributes
 	 */
-	public function writeElement($element, $cdata, array $attributes = array()) {
+	public function writeElement($element, $cdata, array $attributes = []) {
 		$this->startElement($element);
 		
 		// write attributes
@@ -143,7 +143,7 @@ class XMLWriter {
 	 * @param	string		$value
 	 */
 	public function writeAttribute($attribute, $value) {
-		$this->writeAttributes(array($attribute => $value));
+		$this->writeAttributes([$attribute => $value]);
 	}
 	
 	/**