foreach ($conditionObjectTypes as $objectType) {
if ($objectType->conditiongroup) {
if (!isset($this->conditions[$objectType->conditiongroup])) {
- $this->conditions[$objectType->conditiongroup] = [ ];
+ $this->conditions[$objectType->conditiongroup] = [];
}
$this->conditions[$objectType->conditiongroup][$objectType->objectTypeID] = $objectType;
if (!$objectType->conditiongroup) continue;
if (!isset($this->conditions[$objectType->conditiongroup])) {
- $this->conditions[$objectType->conditiongroup] = [ ];
+ $this->conditions[$objectType->conditiongroup] = [];
}
$this->conditions[$objectType->conditiongroup][$objectType->objectTypeID] = $objectType;
use wcf\system\WCF;
// set exception handler
- set_exception_handler([ WCF::class, 'handleException' ]);
+ set_exception_handler([WCF::class, 'handleException']);
// set php error handler
- set_error_handler([ WCF::class, 'handleError' ], E_ALL);
+ set_error_handler([WCF::class, 'handleError'], E_ALL);
// set shutdown function
- register_shutdown_function([ WCF::class, 'destruct' ]);
+ register_shutdown_function([WCF::class, 'destruct']);
// set autoload function
- spl_autoload_register([ WCF::class, 'autoload' ]);
+ spl_autoload_register([WCF::class, 'autoload']);
// define escape string shortcut
function escapeString($string) {
public function unmarkAll() {
ClipboardHandler::getInstance()->unmarkAll($this->objectTypeID);
- return [ 'objectType' => $this->parameters['objectType'] ];
+ return ['objectType' => $this->parameters['objectType']];
}
/**
'actionName' => $item->getName(),
'internalData' => $item->getInternalData(),
'parameters' => $item->getParameters(),
- 'label' => WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.' . $item->getName(), [ 'count' => $item->getCount() ]),
+ 'label' => WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.' . $item->getName(), ['count' => $item->getCount()]),
'url' => $item->getURL()
];
}
$sql = "DELETE FROM wcf".WCF_N."_language_item
WHERE languageItem = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([ 'wcf.acp.cronjob.description.cronjob'.$this->cronjobID ]);
+ $statement->execute(['wcf.acp.cronjob.description.cronjob'.$this->cronjobID]);
}
// save new descriptions
* @since 2.2
*/
public function validateSetAsSynonyms() {
- WCF::getSession()->checkPermissions([ 'admin.content.tag.canManageTag' ]);
+ WCF::getSession()->checkPermissions(['admin.content.tag.canManageTag']);
if (empty($this->objects)) {
$this->readObjects();
if ($time < TIME_NOW) {
throw new SystemException("You may not schedule a job in the past (".$time." is smaller than the current timestamp ".TIME_NOW.").");
}
- if (!is_array($jobs)) $jobs = [ $jobs ];
+ if (!is_array($jobs)) $jobs = [$jobs];
foreach ($jobs as $job) {
if (!($job instanceof AbstractBackgroundJob)) {
throw new SystemException('$jobs contains an item that does not extend \wcf\system\background\job\AbstractBackgroundJob.');
$sql = "DELETE FROM wcf".WCF_N."_background_job
WHERE jobID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([ $row['jobID'] ]);
+ $statement->execute([$row['jobID']]);
}
}
WHERE status = ?
AND time <= ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([ 'ready', TIME_NOW ]);
+ $statement->execute(['ready', TIME_NOW]);
return $statement->fetchSingleColumn();
}
protected function getAccessibleUsers(UserList $userList) {
// fetch user group ids of all users
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add('userID IN (?)', [ $userList->getObjectIDs() ]);
+ $conditionBuilder->add('userID IN (?)', [$userList->getObjectIDs()]);
$sql = "SELECT userID, groupID
FROM wcf".WCF_N."_user_to_group
* list of available user groups
* @var UserGroup[]
*/
- public $availableUserGroups = [ ];
+ public $availableUserGroups = [];
/**
* name of the inputs used to store the selected user group ids
* ids of selected user groups
* @var integer[]
*/
- public $userGroupIDs = [ ];
+ public $userGroupIDs = [];
/**
* @see \wcf\data\DatabaseObjectDecorator::__construct()
public function __construct(DatabaseObject $object) {
parent::__construct($object);
- $this->availableUserGroups = UserGroup::getAccessibleGroups([ ], [ UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS ]);
+ $this->availableUserGroups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]);
uasort($this->availableUserGroups, function(UserGroup $groupA, UserGroup $groupB) {
return strcmp($groupA->getName(), $groupB->getName());
* @see \wcf\system\bulk\processing\IBulkProcessingAction::reset()
*/
public function reset() {
- $this->userGroupIDs = [ ];
+ $this->userGroupIDs = [];
}
/**
if ($templateListener->options || $templateListener->permissions) {
$templateCode = '{if ';
- $options = $permissions = [ ];
+ $options = $permissions = [];
if ($templateListener->options) {
$options = explode(',', strtoupper($templateListener->options));
// get option values
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("option_value.groupID IN (?)", [ $parameters ]);
+ $conditions->add("option_value.groupID IN (?)", [$parameters]);
$sql = "SELECT option_table.optionName, option_table.optionType, option_value.optionValue
FROM wcf".WCF_N."_user_group_option_value option_value
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!isset($data[$row['optionName']])) {
- $data[$row['optionName']] = [ 'type' => $row['optionType'], 'values' => [] ];
+ $data[$row['optionName']] = ['type' => $row['optionType'], 'values' => []];
}
$data[$row['optionName']]['values'][] = $row['optionValue'];
/**
* @inheritdoc
*/
- protected $actionClassActions = [ 'delete' ];
+ protected $actionClassActions = ['delete'];
/**
* @inheritdoc
*/
protected function validateDelete() {
if (!WCF::getSession()->getPermission('admin.content.tag.canManageTag')) {
- return [ ];
+ return [];
}
return array_keys($this->objects);
*/
protected function validateSetAsSynonyms() {
if (!WCF::getSession()->getPermission('admin.content.tag.canManageTag')) {
- return [ ];
+ return [];
}
if (count($this->objects) < 2) {
- return [ ];
+ return [];
}
return array_keys($this->objects);
if (!($objectList instanceof $className)) return;
if ($this->supportsMultipleValues) {
- $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' IN (?)', [ $conditionData[$this->fieldName] ]);
+ $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' IN (?)', [$conditionData[$this->fieldName]]);
}
else {
- $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' = ?', [ $conditionData[$this->fieldName] ]);
+ $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' = ?', [$conditionData[$this->fieldName]]);
}
}
$className = $this->getListClassName();
if (!($objectList instanceof $className)) return;
- $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' <> ?', [ 0 ]);
+ $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' <> ?', [0]);
if (isset($conditionData['endTime'])) {
- $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' < ?', [ strtotime($conditionData['endTime']) + 86400 ]);
+ $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' < ?', [strtotime($conditionData['endTime']) + 86400]);
}
if (isset($conditionData['startTime'])) {
- $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' >= ?', [ strtotime($conditionData['startTime']) ]);
+ $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' >= ?', [strtotime($conditionData['startTime'])]);
}
}
TIME_NOW - 600 // running longer than 10 minutes
]);
- $jobIDs = [ ];
+ $jobIDs = [];
while ($row = $statement->fetchArray()) {
$jobIDs[] = $row['jobID'];
// delete jobs
$condition = new PreparedStatementConditionBuilder();
- $condition->add('jobID IN (?)', [ $jobIDs ]);
+ $condition->add('jobID IN (?)', [$jobIDs]);
$sql = "DELETE FROM wcf".WCF_N."_background_job ".$condition;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($condition->getParameters());
public function getExtraInformation() {
return array_map(function ($val) {
static $i = 0;
- return [ 'Query Parameter '.(++$i), $val ];
+ return ['Query Parameter '.(++$i), $val];
}, $this->getParameters());
}
}
* Recipients of this email.
* @var array
*/
- protected $recipients = [ ];
+ protected $recipients = [];
/**
* Message-Id header
* References header
* @var Mailbox[]
*/
- protected $references = [ ];
+ protected $references = [];
/**
* In-Reply-To header
* @var Mailbox[]
*/
- protected $inReplyTo = [ ];
+ protected $inReplyTo = [];
/**
* Date header
* User specified X-* headers
* @var array
*/
- protected $extraHeaders = [ ];
+ protected $extraHeaders = [];
/**
* Text parts of this email
* @var array
*/
- protected $text = [ ];
+ protected $text = [];
/**
* Attachments of this email
* @var array
*/
- protected $attachments = [ ];
+ protected $attachments = [];
/**
* Boundary between the 'Text' parts of this email
throw new SystemException("The given type '".$type."' is invalid. Must be one of 'to', 'cc', 'bcc'.");
}
- $this->recipients[$recipient->getAddress()] = [ $type, $recipient ];
+ $this->recipients[$recipient->getAddress()] = [$type, $recipient];
}
/**
throw new SystemException("The header '".$header."' may not be set. You may only set user defined headers (starting with 'X-').");
}
- $this->extraHeaders[] = [ $header, EmailGrammar::encodeQuotedPrintableHeader($value) ];
+ $this->extraHeaders[] = [$header, EmailGrammar::encodeQuotedPrintableHeader($value)];
}
/**
}
if ($part instanceof TextMimePart) {
- $this->text[] = [ $priority, $part ];
+ $this->text[] = [$priority, $part];
}
else {
- $this->attachments[] = [ $priority, $part ];
+ $this->attachments[] = [$priority, $part];
}
}
* @throws SystemException
*/
public function getHeaders() {
- $headers = [ ];
- $to = [ ];
- $cc = [ ];
+ $headers = [];
+ $to = [];
+ $cc = [];
foreach ($this->getRecipients() as $recipient) {
if ($recipient[0] == 'to') $to[] = $recipient[1];
else if ($recipient[0] == 'cc') $cc[] = $recipient[1];
}
- $headers[] = [ 'from', (string) $this->getSender() ];
+ $headers[] = ['from', (string) $this->getSender()];
if ($this->getReplyTo()->getAddress() !== $this->getSender()->getAddress()) {
- $headers[] = [ 'reply-to', (string) $this->getReplyTo() ];
+ $headers[] = ['reply-to', (string) $this->getReplyTo()];
}
if ($to) {
- $headers[] = [ 'to', implode(",\r\n ", $to) ];
+ $headers[] = ['to', implode(",\r\n ", $to)];
}
else {
throw new SystemException("Cannot generate message headers, you must specify a recipient.");
}
if ($cc) {
- $headers[] = [ 'cc', implode(",\r\n ", $cc) ];
+ $headers[] = ['cc', implode(",\r\n ", $cc)];
}
if ($this->getSubject()) {
- $headers[] = [ 'subject', EmailGrammar::encodeQuotedPrintableHeader($this->getSubject()) ];
+ $headers[] = ['subject', EmailGrammar::encodeQuotedPrintableHeader($this->getSubject())];
}
else {
throw new SystemException("Cannot generate message headers, you must specify a subject.");
}
- $headers[] = [ 'date', $this->getDate()->format(\DateTime::RFC2822) ];
- $headers[] = [ 'message-id', $this->getMessageID() ];
+ $headers[] = ['date', $this->getDate()->format(\DateTime::RFC2822)];
+ $headers[] = ['message-id', $this->getMessageID()];
if ($this->getReferences()) {
- $headers[] = [ 'references', implode(' ', $this->getReferences()) ];
+ $headers[] = ['references', implode(' ', $this->getReferences())];
}
if ($this->getInReplyTo()) {
- $headers[] = [ 'in-reply-to', implode(' ', $this->getInReplyTo()) ];
+ $headers[] = ['in-reply-to', implode(' ', $this->getInReplyTo())];
}
- $headers[] = [ 'mime-version', '1.0' ];
+ $headers[] = ['mime-version', '1.0'];
if (!$this->text) {
throw new SystemException("Cannot generate message headers, you must specify at least one 'Text' part.");
}
if ($this->attachments) {
- $headers[] = [ 'content-type', "multipart/mixed;\r\n boundary=\"".$this->mimeBoundary."\"" ];
+ $headers[] = ['content-type', "multipart/mixed;\r\n boundary=\"".$this->mimeBoundary."\""];
}
else {
if (count($this->text) > 1) {
- $headers[] = [ 'content-type', "multipart/alternative;\r\n boundary=\"".$this->textBoundary."\"" ];
+ $headers[] = ['content-type', "multipart/alternative;\r\n boundary=\"".$this->textBoundary."\""];
}
else {
- $headers[] = [ 'content-type', $this->text[0][1]->getContentType() ];
- $headers[] = [ 'content-transfer-encoding', $this->text[0][1]->getContentTransferEncoding() ];
+ $headers[] = ['content-type', $this->text[0][1]->getContentType()];
+ $headers[] = ['content-transfer-encoding', $this->text[0][1]->getContentTransferEncoding()];
$headers = array_merge($headers, $this->text[0][1]->getAdditionalHeaders());
}
}
* @return AbstractBackgroundJob[]
*/
public function getJobs() {
- $jobs = [ ];
+ $jobs = [];
// ensure every header is filled in
$this->getHeaders();
if ($mimePart[1] instanceof IRecipientAwareMimePart) $mimePart[1]->setRecipient($recipient[1]);
}
- $data = [ 'mail' => $mail, 'recipient' => $recipient, 'skip' => false ];
+ $data = ['mail' => $mail, 'recipient' => $recipient, 'skip' => false];
EventHandler::getInstance()->fireAction($this, 'getJobs', $data);
// an event decided that this email should be skipped
* @return array
*/
public function getAdditionalHeaders() {
- return [ ];
+ return [];
}
/**
*/
public function getAdditionalHeaders() {
return [
- [ 'Content-Disposition', 'attachment; filename='.EmailGrammar::encodeHeader($this->filename) ]
+ ['Content-Disposition', 'attachment; filename='.EmailGrammar::encodeHeader($this->filename)]
];
}
* ESMTP features advertised by the server
* @var string[]
*/
- protected $features = [ ];
+ protected $features = [];
/**
* if this property is an instance of \Exception email delivery will be locked
}
while (true);
- return [ $code, $reply ];
+ return [$code, $reply];
}
/**
*/
protected function connect() {
$this->connection = new RemoteFile($this->host, $this->port);
- $this->read([ 220 ]);
+ $this->read([220]);
try {
$this->write('EHLO '.Email::getHost());
- $this->features = array_map('strtolower', explode("\n", StringUtil::unifyNewlines($this->read([ 250 ])[1])));
+ $this->features = array_map('strtolower', explode("\n", StringUtil::unifyNewlines($this->read([250])[1])));
}
catch (SystemException $e) {
if ($this->starttls == 'encrypt') {
}
$this->write('HELO '.Email::getHost());
- $this->features = [ ];
+ $this->features = [];
}
switch ($this->starttls) {
$this->starttls();
$this->write('EHLO '.Email::getHost());
- $this->features = array_map('strtolower', explode("\n", StringUtil::unifyNewlines($this->read([ 250 ])[1])));
+ $this->features = array_map('strtolower', explode("\n", StringUtil::unifyNewlines($this->read([250])[1])));
break;
case 'may':
if (in_array('starttls', $this->features)) {
catch (SystemException $e) { }
$this->write('EHLO '.Email::getHost());
- $this->features = array_map('strtolower', explode("\n", StringUtil::unifyNewlines($this->read([ 250 ])[1])));
+ $this->features = array_map('strtolower', explode("\n", StringUtil::unifyNewlines($this->read([250])[1])));
}
break;
case 'none':
*/
protected function starttls() {
$this->write("STARTTLS");
- $this->read([ 220 ]);
+ $this->read([220]);
if (!$this->connection->setTLS(true)) {
throw new TransientFailure('enabling TLS failed');
if ($parameters[0] == 'auth') {
// try mechanisms in order of preference
- foreach ([ 'login', 'plain' ] as $method) {
+ foreach (['login', 'plain'] as $method) {
if (in_array($method, $parameters)) {
switch ($method) {
case 'login':
try {
$this->write('AUTH LOGIN');
- $this->read([ 334 ]);
+ $this->read([334]);
}
catch (SystemException $e) {
// try next authentication method
}
$this->write(base64_encode($this->username));
$this->lastWrite = '*redacted*';
- $this->read([ 334 ]);
+ $this->read([334]);
$this->write(base64_encode($this->password));
$this->lastWrite = '*redacted*';
- $this->read([ 235 ]);
+ $this->read([235]);
return;
break;
case 'plain':
// RFC 4616
try {
$this->write('AUTH PLAIN');
- $this->read([ 334 ]);
+ $this->read([334]);
}
catch (SystemException $e) {
// try next authentication method
}
$this->write(base64_encode("\0".$this->username."\0".$this->password));
$this->lastWrite = '*redacted*';
- $this->read([ 235 ]);
+ $this->read([235]);
return;
}
}
}
$this->write('RSET');
- $this->read([ 250 ]);
+ $this->read([250]);
$this->write('MAIL FROM:<'.$email->getSender()->getAddress().'>');
- $this->read([ 250 ]);
+ $this->read([250]);
$this->write('RCPT TO:<'.$envelopeTo->getAddress().'>');
- $this->read([ 250, 251 ]);
+ $this->read([250, 251]);
$this->write('DATA');
- $this->read([ 354 ]);
+ $this->read([354]);
$this->connection->write(implode("\r\n", array_map(function ($item) {
// 4.5.2 Transparency
// o Before sending a line of mail text, the SMTP client checks the
return $item;
}, explode("\r\n", $email))));
$this->write(".");
- $this->read([ 250 ]);
+ $this->read([250]);
}
}
* @param array $data
* @throws SystemException
*/
- public function __construct($actionClassName, array $options = [ ], array $data = [ ]) {
+ public function __construct($actionClassName, array $options = [], array $data = []) {
$this->actionClassName = $actionClassName;
$this->options = $options;
$this->data = $data;
throw new SystemException("'".$this->actionClassName."' does not extend '".AbstractDatabaseObjectAction::class."'");
}
- $this->editorClassName = (new $this->actionClassName([ ], ''))->getClassName();
- $baseClass = call_user_func([ $this->editorClassName, 'getBaseClass' ]);
+ $this->editorClassName = (new $this->actionClassName([], ''))->getClassName();
+ $baseClass = call_user_func([$this->editorClassName, 'getBaseClass']);
if (!is_subclass_of($baseClass, IFile::class)) {
throw new SystemException("'".$this->editorClassName."' does not implement '".IFile::class."'");
}
if (is_subclass_of($baseClass, IThumbnailFile::class)) {
- $this->options['thumbnailSizes'] = call_user_func([ $baseClass, 'getThumbnailSizes' ]);
+ $this->options['thumbnailSizes'] = call_user_func([$baseClass, 'getThumbnailSizes']);
}
}
}
}
- $action = new $this->actionClassName([ ], 'create', [
+ $action = new $this->actionClassName([], 'create', [
'data' => $data
]);
$object = $action->executeAction()['returnValues'];
$adapter = ImageHandler::getInstance()->getAdapter();
$adapter->loadFile($file->getLocation());
- $updateData = [ ];
+ $updateData = [];
foreach ($this->options['thumbnailSizes'] as $type => $sizeData) {
$prefix = 'thumbnail';
if (!empty($type)) {