use wcf\data\user\group\UserGroupEditor;
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
+use wcf\system\option\user\group\UserGroupOptionHandler;
use wcf\system\WCF;
use wcf\system\WCFACP;
use wcf\util\StringUtil;
* Shows the group add form.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage acp.form
*/
class UserGroupAddForm extends AbstractOptionListForm {
/**
- * @see \wcf\page\AbstractPage::$activeMenuItem
+ * @inheritDoc
*/
public $activeMenuItem = 'wcf.acp.menu.link.group.add';
/**
- * @see \wcf\page\AbstractPage::$neededPermissions
+ * @inheritDoc
*/
- public $neededPermissions = array('admin.user.canAddGroup');
+ public $neededPermissions = ['admin.user.canAddGroup'];
/**
* option tree
* @var array
*/
- public $optionTree = array();
+ public $optionTree = [];
/**
- * @see \wcf\acp\form\AbstractOptionListForm::$optionHandlerClassName
+ * @inheritDoc
*/
- public $optionHandlerClassName = 'wcf\system\option\user\group\UserGroupOptionHandler';
+ public $optionHandlerClassName = UserGroupOptionHandler::class;
/**
- * @see \wcf\acp\form\AbstractOptionListForm::$supportI18n
+ * @inheritDoc
*/
public $supportI18n = false;
* list of values of group 'Anyone'
* @var array
*/
- public $defaultValues = array();
+ public $defaultValues = [];
/**
* group priority
protected $showOnTeamPage = 0;
/**
- * @see \wcf\page\IPage::readParameters()
+ * @inheritDoc
*/
public function readParameters() {
parent::readParameters();
}
/**
- * @see \wcf\form\IForm::readFormParameters()
+ * @inheritDoc
*/
public function readFormParameters() {
parent::readFormParameters();
}
/**
- * @see \wcf\form\IForm::validate()
+ * @inheritDoc
*/
public function validate() {
// validate dynamic options
}
/**
- * @see \wcf\form\IForm::save()
+ * @inheritDoc
*/
public function save() {
parent::save();
$optionValues = $this->optionHandler->save();
- $data = array(
- 'data' => array_merge($this->additionalFields, array(
+ $data = [
+ 'data' => array_merge($this->additionalFields, [
'groupName' => $this->groupName,
'groupDescription' => $this->groupDescription,
'priority' => $this->priority,
'userOnlineMarking' => $this->userOnlineMarking,
'showOnTeamPage' => $this->showOnTeamPage
- )),
+ ]),
'options' => $optionValues
- );
- $this->objectAction = new UserGroupAction(array(), 'create', $data);
+ ];
+ $this->objectAction = new UserGroupAction([], 'create', $data);
$this->objectAction->executeAction();
$returnValues = $this->objectAction->getReturnValues();
$groupID = $returnValues['returnValues']->groupID;
// update group name
$groupEditor = new UserGroupEditor($returnValues['returnValues']);
- $groupEditor->update(array(
+ $groupEditor->update([
'groupName' => 'wcf.acp.group.group'.$groupID
- ));
+ ]);
}
if (!I18nHandler::getInstance()->isPlainValue('groupDescription')) {
I18nHandler::getInstance()->save('groupDescription', 'wcf.acp.group.groupDescription'.$groupID, 'wcf.acp.group', 1);
// update group name
$groupEditor = new UserGroupEditor($returnValues['returnValues']);
- $groupEditor->update(array(
+ $groupEditor->update([
'groupDescription' => 'wcf.acp.group.groupDescription'.$groupID
- ));
+ ]);
}
$this->saved();
// show success message
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'success' => true
- ));
+ ]);
// reset values
$this->groupName = '';
- $this->optionValues = array();
I18nHandler::getInstance()->reset();
}
/**
- * @see \wcf\page\IPage::readData()
+ * @inheritDoc
*/
public function readData() {
parent::readData();
}
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
I18nHandler::getInstance()->assignVariables();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'groupName' => $this->groupName,
'groupDescription' => $this->groupDescription,
'optionTree' => $this->optionTree,
'priority' => $this->priority,
'userOnlineMarking' => $this->userOnlineMarking,
'showOnTeamPage' => $this->showOnTeamPage
- ));
+ ]);
}
/**
- * @see \wcf\form\IForm::show()
+ * @inheritDoc
*/
public function show() {
// check master password
* @category Community Framework
*/
class CategoryNodeTree implements \IteratorAggregate {
+ /**
+ * list of ids of categories which will not be inluded in the node tree
+ * @var integer[]
+ */
+ protected $excludedCategoryIDs = [];
+
+ /**
+ * if true, disabled categories are also included in the node tree
+ * @var boolean
+ */
+ protected $includeDisabledCategories = false;
+
/**
* maximum depth considered when building the node tree
* @var integer
$likeObjectIDs = array_merge($likeObjectIDs, $objectIDs);
// delete notifications
- $objectType = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID);
+ $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID);
if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.notification')) {
UserNotificationHandler::getInstance()->removeNotifications($objectType->objectType.'.notification', $objectIDs);
}
if (!empty($this->parameters['fileType'])) {
$mediaList->addDefaultFileTypeFilter($this->parameters['fileType']);
}
- $mediaList->getConditionBuilder()->add($searchConditionBuilder->__toString(), $searchConditionBuilder->getParameters());
if (!empty($this->parameters['fileTypeFilters'])) {
$mediaList->addFileTypeFilters($this->parameters['fileTypeFilters']);
}
* Executes user notification-related actions.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data.user.notification
class UserNotificationAction extends AbstractDatabaseObjectAction {
/**
* notification editor object
- * @var \wcf\data\user\notification\UserNotificationEditor
+ * @var UserNotificationEditor
*/
public $notificationEditor = null;
/**
- * @see \wcf\data\AbstractDatabaseObjectAction::create()
+ * @inheritDoc
*/
public function create() {
$notification = parent::create();
(notificationID, userID)
VALUES (?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
$notification->notificationID,
$notification->userID
- ));
+ ]);
return $notification;
}
* @return array<array>
*/
public function createDefault() {
+ $notifications = [];
foreach ($this->parameters['recipients'] as $recipient) {
$this->parameters['data']['userID'] = $recipient->userID;
$this->parameters['data']['mailNotified'] = (($recipient->mailNotificationType == 'none' || $recipient->mailNotificationType == 'instant') ? 1 : 0);
$notification = $this->create();
- $notifications[$recipient->userID] = array(
+ $notifications[$recipient->userID] = [
'isNew' => true,
'object' => $notification
- );
+ ];
}
// insert author
WCF::getDB()->beginTransaction();
foreach ($notifications as $notificationData) {
- $statement->execute(array(
+ $statement->execute([
$notificationData['object']->notificationID,
$this->parameters['authorID'] ?: null,
TIME_NOW
- ));
+ ]);
}
WCF::getDB()->commitTransaction();
public function createStackable() {
// get existing notifications
$notificationList = new UserNotificationList();
- $notificationList->getConditionBuilder()->add("eventID = ?", array($this->parameters['data']['eventID']));
- $notificationList->getConditionBuilder()->add("eventHash = ?", array($this->parameters['data']['eventHash']));
- $notificationList->getConditionBuilder()->add("userID IN (?)", array(array_keys($this->parameters['recipients'])));
- $notificationList->getConditionBuilder()->add("confirmTime = ?", array(0));
+ $notificationList->getConditionBuilder()->add("eventID = ?", [$this->parameters['data']['eventID']]);
+ $notificationList->getConditionBuilder()->add("eventHash = ?", [$this->parameters['data']['eventHash']]);
+ $notificationList->getConditionBuilder()->add("userID IN (?)", [array_keys($this->parameters['recipients'])]);
+ $notificationList->getConditionBuilder()->add("confirmTime = ?", [0]);
$notificationList->readObjects();
- $existingNotifications = array();
+ $existingNotifications = [];
foreach ($notificationList as $notification) {
$existingNotifications[$notification->userID] = $notification;
}
- $notifications = array();
+ $notifications = [];
foreach ($this->parameters['recipients'] as $recipient) {
$notification = (isset($existingNotifications[$recipient->userID]) ? $existingNotifications[$recipient->userID] : null);
$isNew = ($notification === null);
$notification = $this->create();
}
- $notifications[$recipient->userID] = array(
+ $notifications[$recipient->userID] = [
'isNew' => $isNew,
'object' => $notification
- );
+ ];
}
uasort($notifications, function ($a, $b) {
WCF::getDB()->beginTransaction();
foreach ($notifications as $notificationData) {
- $statement->execute(array(
+ $statement->execute([
$notificationData['object']->notificationID,
$this->parameters['authorID'] ?: null,
TIME_NOW
- ));
+ ]);
}
WCF::getDB()->commitTransaction();
WCF::getDB()->beginTransaction();
foreach ($notifications as $notificationData) {
- $statement->execute(array(
+ $statement->execute([
1,
$this->parameters['authorID'] ? 0 : 1,
$notificationData['object']->notificationID
- ));
+ ]);
}
WCF::getDB()->commitTransaction();
*/
public function getOutstandingNotifications() {
$notifications = UserNotificationHandler::getInstance()->getMixedNotifications();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'notifications' => $notifications
- ));
+ ]);
- return array(
+ return [
'template' => WCF::getTPL()->fetch('notificationListUserPanel'),
'totalCount' => $notifications['notificationCount']
- );
+ ];
}
/**
public function markAsConfirmed() {
UserNotificationHandler::getInstance()->markAsConfirmedByID($this->notificationEditor->notificationID);
- return array(
+ return [
'markAsRead' => $this->notificationEditor->notificationID,
'totalCount' => UserNotificationHandler::getInstance()->getNotificationCount(true)
- );
+ ];
}
/**
* Validates parameters to mark all notifications of current user as confirmed.
*/
- public function validateMarkAllAsConfirmed() { /* does nothing */ }
+ public function validateMarkAllAsConfirmed() {
+ // does nothing
+ }
/**
* Marks all notifications of current user as confirmed.
+ *
+ * @return boolean[]
*/
public function markAllAsConfirmed() {
// remove notifications for this user
SET confirmTime = ?
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
TIME_NOW,
WCF::getUser()->userID
- ));
+ ]);
// delete notification_to_user assignments (mimic legacy notification system)
$sql = "DELETE FROM wcf".WCF_N."_user_notification_to_user
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(WCF::getUser()->userID));
+ $statement->execute([WCF::getUser()->userID]);
// reset notification count
- UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'userNotificationCount');
+ UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'userNotificationCount');
- return array(
+ return [
'markAllAsRead' => true
- );
+ ];
}
}
<?php
namespace wcf\form;
+use wcf\data\comment\StructuredCommentList;
use wcf\data\moderation\queue\ModerationQueueAction;
use wcf\data\moderation\queue\ViewableModerationQueue;
use wcf\system\breadcrumb\Breadcrumb;
+use wcf\system\comment\manager\ICommentManager;
use wcf\system\comment\CommentHandler;
use wcf\system\event\EventHandler;
use wcf\system\exception\IllegalLinkException;
* Shows the user search form.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage form
*/
class UserSearchForm extends UserOptionListForm {
/**
- * @see \wcf\page\AbstractPage::$activeMenuItem
+ * @inheritDoc
*/
public $activeMenuItem = 'wcf.user.search';
/**
- * @see \wcf\page\AbstractPage::$neededModules
+ * @inheritDoc
*/
- public $neededModules = array('MODULE_MEMBERS_LIST');
+ public $neededModules = ['MODULE_MEMBERS_LIST'];
/**
* username
/**
* matches
- * @var array<integer>
+ * @var integer[]
*/
- public $matches = array();
+ public $matches = [];
/**
* condition builder object
public $maxResults = 1000;
/**
- * @see \wcf\form\IForm::readFormParameters()
+ * option tree
+ * @var array
+ */
+ public $optionTree = [];
+
+ /**
+ * @inheritDoc
*/
public function readFormParameters() {
parent::readFormParameters();
}
/**
- * @see \wcf\acp\form\AbstractOptionListForm::initOptionHandler()
+ * @inheritDoc
*/
protected function initOptionHandler() {
$this->optionHandler->enableSearchMode();
}
/**
- * @see \wcf\page\IPage::readData()
+ * @inheritDoc
*/
public function readData() {
parent::readData();
}
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
DashboardHandler::getInstance()->loadBoxes('com.woltlab.wcf.user.MembersListPage', $this);
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'username' => $this->username,
'optionTree' => $this->optionTree,
'sidebarCollapsed' => UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'com.woltlab.wcf.user.MembersListPage'),
'sidebarName' => 'com.woltlab.wcf.user.MembersListPage'
- ));
+ ]);
}
/**
- * @see \wcf\form\IForm::save()
+ * @inheritDoc
*/
public function save() {
parent::save();
// store search result in database
- $search = SearchEditor::create(array(
+ $search = SearchEditor::create([
'userID' => WCF::getUser()->userID ?: null,
- 'searchData' => serialize(array('matches' => $this->matches)),
+ 'searchData' => serialize(['matches' => $this->matches]),
'searchTime' => TIME_NOW,
'searchType' => 'users'
- ));
+ ]);
// get new search id
$this->searchID = $search->searchID;
$this->saved();
// forward to result page
- $url = LinkHandler::getInstance()->getLink('MembersList', array('id' => $this->searchID));
+ $url = LinkHandler::getInstance()->getLink('MembersList', ['id' => $this->searchID]);
HeaderUtil::redirect($url);
exit;
}
/**
- * @see \wcf\form\IForm::validate()
+ * @inheritDoc
*/
public function validate() {
AbstractForm::validate();
* Search for users which fit to the search values.
*/
protected function search() {
- $this->matches = array();
+ $this->matches = [];
$sql = "SELECT user_table.userID
FROM wcf".WCF_N."_user user_table
LEFT JOIN wcf".WCF_N."_user_option_value option_value
*/
protected function buildStaticConditions() {
if (!empty($this->username)) {
- $this->conditions->add("user_table.username LIKE ?", array('%'.addcslashes($this->username, '_%').'%'));
+ $this->conditions->add("user_table.username LIKE ?", ['%'.addcslashes($this->username, '_%').'%']);
}
}
* @since 2.2
*/
class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction {
- /**
- * email text
- * @var string
- */
- public $email = '';
-
/**
* is 1 if HTML for the email is enabled
* @var integer
*/
public $mailID = '';
+ /**
+ * email subject
+ * @var string
+ */
+ public $subject = '';
+
/**
* email text
* @var string
* Provides methods for comment object handling.
*
* @author Alexander Ebert
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.comment
protected $cache = null;
/**
- * @see \wcf\system\SingletonFactory::init()
+ * @inheritDoc
*/
protected function init() {
- $this->cache = array(
- 'objectTypes' => array(),
- 'objectTypeIDs' => array()
- );
+ $this->cache = [
+ 'objectTypes' => [],
+ 'objectTypeIDs' => []
+ ];
$cache = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.comment.commentableContent');
foreach ($cache as $objectType) {
* Returns the object type for a given object type id.
*
* @param integer $objectTypeID
- * @return \wcf\data\object\type\ObjectType
+ * @return ObjectType
*/
public function getObjectType($objectTypeID) {
if (isset($this->cache['objectTypes'][$objectTypeID])) {
* Returns comment manager object for given object type.
*
* @param string $objectType
- * @return \wcf\system\comment\manager\ICommentManager
+ * @return ICommentManager
*/
public function getCommentManager($objectType) {
$objectTypeID = $this->getObjectTypeID($objectType);
/**
* Returns a comment list for a given object type and object id.
*
- * @param \wcf\data\comment\manager\ICommentManager $commentManager
- * @param integer $objectTypeID
- * @param integer $objectID
- * @param boolean $readObjects
- * @return \wcf\data\comment\StructuredCommentList
+ * @param ICommentManager $commentManager
+ * @param integer $objectTypeID
+ * @param integer $objectID
+ * @param boolean $readObjects
+ * @return StructuredCommentList
*/
public function getCommentList(ICommentManager $commentManager, $objectTypeID, $objectID, $readObjects = true) {
$commentList = new StructuredCommentList($commentManager, $objectTypeID, $objectID);
* Removes all comments for given objects.
*
* @param string $objectType
- * @param array<integer> $objectIDs
+ * @param integer[] $objectIDs
*/
public function deleteObjects($objectType, array $objectIDs) {
$objectTypeID = $this->getObjectTypeID($objectType);
// get comment ids
$commentList = new CommentList();
- $commentList->getConditionBuilder()->add('comment.objectTypeID = ?', array($objectTypeID));
- $commentList->getConditionBuilder()->add('comment.objectID IN (?)', array($objectIDs));
+ $commentList->getConditionBuilder()->add('comment.objectTypeID = ?', [$objectTypeID]);
+ $commentList->getConditionBuilder()->add('comment.objectID IN (?)', [$objectIDs]);
$commentList->readObjectIDs();
$commentIDs = $commentList->getObjectIDs();
// get response ids
$responseList = new CommentResponseList();
- $responseList->getConditionBuilder()->add('comment_response.commentID IN (?)', array($commentIDs));
+ $responseList->getConditionBuilder()->add('comment_response.commentID IN (?)', [$commentIDs]);
$responseList->readObjectIDs();
$responseIDs = $responseList->getObjectIDs();
// delete likes
- $notificationObjectTypes = array();
+ $notificationObjectTypes = [];
if (UserNotificationHandler::getInstance()->getObjectTypeID($objectTypeObj->objectType.'.like.notification')) {
$notificationObjectTypes[] = $objectTypeObj->objectType.'.like.notification';
}
if (!empty($responseIDs)) {
// delete likes (for responses)
- $notificationObjectTypes = array();
+ $notificationObjectTypes = [];
if (UserNotificationHandler::getInstance()->getObjectTypeID($objectTypeObj->objectType.'.response.like.notification')) {
$notificationObjectTypes[] = $objectTypeObj->objectType.'.response.like.notification';
}
$lastCommentTime = WCF::getSession()->getVar('lastCommentTime');
if ($lastCommentTime && $lastCommentTime + WCF::getSession()->getPermission('user.comment.floodControlTime') > TIME_NOW) {
- throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', array(
+ throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', [
'lastCommentTime' => $lastCommentTime
- )));
+ ]));
}
return;
AND time > ?
ORDER BY time DESC";
$statement = WCF::getDB()->prepareStatement($sql, 1);
- $statement->execute(array(
+ $statement->execute([
WCF::getUser()->userID,
(TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime'))
- ));
+ ]);
if (($row = $statement->fetchArray()) !== false) {
- throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', array('lastCommentTime' => $row['time'])));
+ throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', ['lastCommentTime' => $row['time']]));
}
else {
// check for comment response
AND time > ?
ORDER BY time DESC";
$statement = WCF::getDB()->prepareStatement($sql, 1);
- $statement->execute(array(
+ $statement->execute([
WCF::getUser()->userID,
(TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime'))
- ));
+ ]);
if (($row = $statement->fetchArray()) !== false) {
- throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', array('lastCommentTime' => $row['time'])));
+ throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', ['lastCommentTime' => $row['time']]));
}
}
}
if (ENABLE_CENSORSHIP) {
$result = Censorship::getInstance()->test($text);
if ($result) {
- throw new UserInputException('text', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', array('censoredWords' => $result)));
+ throw new UserInputException('text', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', ['censoredWords' => $result]));
}
}
}
throw new SystemException("The given message id '".$messageID."' is invalid. Note: You must not specify the part right of the at sign (@).");
}
if (strlen($messageID) > 50) {
- throw new SystemException("The given message id '".$message."' is not allowed. The maximum allowed length is 50 bytes.");
+ throw new SystemException("The given message id '".$messageID."' is not allowed. The maximum allowed length is 50 bytes.");
}
$this->messageID = $messageID;
<?php
namespace wcf\system\language;
+use wcf\data\language\Language;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\SystemException;
use wcf\system\Regex;
* Provides internationalization support for input fields.
*
* @author Alexander Ebert
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.language
class I18nHandler extends SingletonFactory {
/**
* list of available languages
- * @var array<\wcf\data\language\Language>
+ * @var Language[]
*/
- protected $availableLanguages = array();
+ protected $availableLanguages = [];
/**
* list of element ids
- * @var array<string>
+ * @var string[]
*/
- protected $elementIDs = array();
+ protected $elementIDs = [];
/**
* list of plain values for elements
- * @var array<string>
+ * @var string[]
*/
- protected $plainValues = array();
+ protected $plainValues = [];
/**
* i18n values for elements
- * @var array<array>
+ * @var string[][]
*/
- protected $i18nValues = array();
+ protected $i18nValues = [];
/**
* element options
* @var array<array>
*/
- protected $elementOptions = array();
+ protected $elementOptions = [];
/**
* language variable regex object
- * @var \wcf\system\Regex
+ * @var Regex
*/
protected $regex = null;
/**
- * @see \wcf\system\SingletonFactory::init()
+ * @inheritDoc
*/
protected function init() {
$this->availableLanguages = LanguageFactory::getInstance()->getLanguages();
/**
* Registers a new element id, returns false if element id is already set.
*
- * @param string elementID
+ * @param string $elementID
* @return boolean
*/
public function register($elementID) {
$i18nElementID = $elementID . '_i18n';
if (isset($_POST[$i18nElementID]) && is_array($_POST[$i18nElementID])) {
- $this->i18nValues[$elementID] = array();
+ $this->i18nValues[$elementID] = [];
foreach ($_POST[$i18nElementID] as $languageID => $value) {
$this->i18nValues[$elementID][$languageID] = StringUtil::unifyNewlines(StringUtil::trim($value));
/**
* Returns true if given element has disabled i18n functionality.
*
- * @param string elementID
+ * @param string $elementID
* @return boolean
*/
public function isPlainValue($elementID) {
/**
* Returns true if given element has enabled i18n functionality.
+ *
+ * @return boolean
*/
public function hasI18nValues($elementID) {
if (isset($this->i18nValues[$elementID])) {
/**
* Returns the plain value for the given element.
*
- * @param string elementID
+ * @param string $elementID
* @return string
* @see \wcf\system\language\I18nHandler::isPlainValue()
*/
* the multilingual values are returned, otherweise the plain value is
* returned for each language id.
*
- * @param string elementID
- * @return array<string>
+ * @param string $elementID
+ * @return string[]
*/
public function getValues($elementID) {
if ($this->hasI18nValues($elementID)) {
$plainValue = $this->getValue($elementID);
- $values = array();
+ $values = [];
foreach ($this->availableLanguages as $language) {
$values[$language->languageID] = $plainValue;
}
throw new SystemException('Invalid argument for parameter $plainValue', 0, 'Expected string. '.ucfirst(gettype($plainValue)).' given.');
}
if (!$this->isPlainValue($elementID)) {
- $i18nValues = array();
+ $i18nValues = [];
foreach ($this->availableLanguages as $language) {
$i18nValues[$language->languageID] = StringUtil::trim($plainValue);
}
FROM wcf".WCF_N."_language_category
WHERE languageCategory = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($languageCategory));
+ $statement->execute([$languageCategory]);
$row = $statement->fetchArray();
$languageCategoryID = $row['languageCategoryID'];
}
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("languageID IN (?)", array($languageIDs));
- $conditions->add("languageItem = ?", array($languageVariable));
+ $conditions->add("languageID IN (?)", [$languageIDs]);
+ $conditions->add("languageItem = ?", [$languageVariable]);
$sql = "SELECT languageItemID, languageID
FROM wcf".WCF_N."_language_item
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- $languageItemIDs = array();
+ $languageItemIDs = [];
while ($row = $statement->fetchArray()) {
$languageItemIDs[$row['languageID']] = $row['languageItemID'];
}
- $insertLanguageIDs = $updateLanguageIDs = array();
+ $insertLanguageIDs = $updateLanguageIDs = [];
foreach ($languageIDs as $languageID) {
if (isset($languageItemIDs[$languageID])) {
$updateLanguageIDs[] = $languageID;
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($insertLanguageIDs as $languageID) {
- $statement->execute(array(
+ $statement->execute([
$languageID,
$languageVariable,
(isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID]),
0,
$languageCategoryID,
$packageID
- ));
+ ]);
}
}
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($updateLanguageIDs as $languageID) {
- $statement->execute(array(
+ $statement->execute([
(isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID]),
0,
$languageItemIDs[$languageID]
- ));
+ ]);
}
}
$sql = "DELETE FROM wcf".WCF_N."_language_item
WHERE languageItem = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($languageVariable));
+ $statement->execute([$languageVariable]);
// reset language cache
LanguageFactory::getInstance()->deleteLanguageCache();
* Sets additional options for elements, required if updating values.
*
* @param integer $elementID
+ * @param integer $pckageID
* @param string $value
* @param string $pattern
*/
public function setOptions($elementID, $packageID, $value, $pattern) {
- $this->elementOptions[$elementID] = array(
+ $this->elementOptions[$elementID] = [
'packageID' => $packageID,
'pattern' => $pattern,
'value' => $value
- );
+ ];
}
/**
* @param boolean $useRequestData
*/
public function assignVariables($useRequestData = true) {
- $elementValues = array();
- $elementValuesI18n = array();
+ $elementValues = [];
+ $elementValuesI18n = [];
foreach ($this->elementIDs as $elementID) {
$value = '';
- $i18nValues = array();
+ $i18nValues = [];
// use POST values instead of querying database
if ($useRequestData) {
}
}
else {
- $i18nValues = array();
+ $i18nValues = [];
}
}
}
FROM wcf".WCF_N."_language_item
WHERE languageItem = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
$this->elementOptions[$elementID]['value']
- ));
+ ]);
while ($row = $statement->fetchArray()) {
$languageItemValue = StringUtil::unifyNewlines($row['languageItemValue']);
$i18nValues[$row['languageID']] = StringUtil::encodeJS($languageItemValue);
$elementValuesI18n[$elementID] = $i18nValues;
}
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'availableLanguages' => $this->availableLanguages,
'i18nPlainValues' => $elementValues,
'i18nValues' => $elementValuesI18n
- ));
+ ]);
}
/**
* Resets internally stored data after creating a new object through a form.
*/
public function reset() {
- $this->i18nValues = $this->plainValues = array();
+ $this->i18nValues = $this->plainValues = [];
}
/**
* Any searchable option type should implement this interface.
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.option
/**
* Returns the html code for the search form element of this option.
*
- * @param \wcf\data\option\Option $option
- * @param string $value
- * @return string html
+ * @param Option $option
+ * @param string $value
+ * @return string html
*/
public function getSearchFormElement(Option $option, $value);
/**
* Returns a condition for search sql query.
*
- * @param \wcf\system\database\condition\PreparedStatementConditionBuilder $conditions
- * @param \wcf\data\option\Option $option
- * @param mixed $value
+ * @param PreparedStatementConditionBuilder $conditions
+ * @param Option $option
+ * @param mixed $value
* @return boolean
*/
public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value);
* @param string $targetDir
* @param string $files
* @param boolean $deleteEmptyDirectories
- * @param booelan $deleteEmptyTargetDir
+ * @param boolean $deleteEmptyTargetDir
*/
public function deleteFiles($targetDir, $files, $deleteEmptyTargetDir = false, $deleteEmptyDirectories = true) {
new Uninstaller($targetDir, $files, $deleteEmptyTargetDir, $deleteEmptyDirectories);
* {pages page=8 pages=10 link='page-%d.html' assign='output' print=true}
*
* @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.template.plugin
protected function makeLink($link, $pageNo, $activePage, $pages) {
// first page
if ($activePage != $pageNo) {
- return '<li><a href="'.$this->insertPageNumber($link, $pageNo).'" title="'.WCF::getLanguage()->getDynamicVariable('wcf.page.pageNo', array('pageNo' => $pageNo)).'">'.StringUtil::formatInteger($pageNo).'</a></li>'."\n";
+ return '<li><a href="'.$this->insertPageNumber($link, $pageNo).'" title="'.WCF::getLanguage()->getDynamicVariable('wcf.page.pageNo', ['pageNo' => $pageNo]).'">'.StringUtil::formatInteger($pageNo).'</a></li>'."\n";
}
else {
- return '<li class="active"><span>'.StringUtil::formatInteger($pageNo).'</span><span class="invisible">'.WCF::getLanguage()->getDynamicVariable('wcf.page.pagePosition', array('pageNo' => $pageNo, 'pages' => $pages)).'</span></li>'."\n";
+ return '<li class="active"><span>'.StringUtil::formatInteger($pageNo).'</span><span class="invisible">'.WCF::getLanguage()->getDynamicVariable('wcf.page.pagePosition', ['pageNo' => $pageNo, 'pages' => $pages]).'</span></li>'."\n";
}
}
/**
* Generates HTML code for 'previous' link.
*
- * @param type $link
- * @param type $pageNo
+ * @param string $link
+ * @param integer $pageNo
* @return string
*/
protected function makePreviousLink($link, $pageNo) {
/**
* Generates HTML code for 'next' link.
*
- * @param type $link
- * @param type $pageNo
+ * @param string $link
+ * @param integer $pageNo
* @return string
*/
protected function makeNextLink($link, $pageNo, $pages) {
}
/**
- * @see \wcf\system\template\IFunctionTemplatePlugin::execute()
+ * @inheritDoc
*/
public function execute($tagArgs, TemplateEngine $tplObj) {
// needed params: controller, link, page, pages
if ($tagArgs['pages'] > 1) {
// create and encode route link
- $parameters = array();
+ $parameters = [];
if (isset($tagArgs['id'])) $parameters['id'] = $tagArgs['id'];
if (isset($tagArgs['title'])) $parameters['title'] = $tagArgs['title'];
if (isset($tagArgs['object'])) $parameters['object'] = $tagArgs['object'];