/**
* Sets object type relations.
+ *
+ * @param array|null $data
*/
protected function setObjectTypeRelations($data = null) {
if (!empty($_POST)) {
/**
* Reads the information of cached files
*
- * @param string $cacheType
- * @param string $cacheDir
- * @param \wcf\system\Regex $ignore
+ * @param string $cacheType
+ * @param string $cacheDir
+ * @param Regex $ignore
+ * @param string $extension
*/
protected function readCacheFiles($cacheType, $cacheDir, Regex $ignore = null, $extension = 'php') {
if (!isset($this->cacheData[$cacheType])) {
/**
* This function can be overridden in children to perform custom initialization
* of a DBOAction before the 'initializeAction' event is fired.
+ *
+ * @param string $baseClass
+ * @param string $indexName
*/
- protected function __init($baseClass, $indexName) { }
+ protected function __init($baseClass, $indexName) {
+ // does nothing
+ }
/**
* @inheritDoc
* @param DatabaseObject[] $objects
* @param mixed $sortBy
* @param string $sortOrder
+ * @param boolean $maintainIndexAssociation
*/
public static function sort(&$objects, $sortBy, $sortOrder = 'ASC', $maintainIndexAssociation = true) {
$sortArray = $objects2 = [];
*/
trait TLegacyUserPropertyAccess {
/**
+ * Returns the value of a object data variable with the given name.
+ *
* @see \wcf\data\IStorableObject::__get()
+ *
+ * @param string $name
+ * @return mixed
*/
public function __get($name) {
$value = parent::__get($name);
/**
* Returns the objects of the list.
*
+ * @param integer $objectID
* @return Attachment[]
*/
public function getGroupedObjects($objectID) {
* This is a heavily modified constructor which behaves differently from other DBOActions,
* primarily because this class just masquerades as a regular DBOAction.
*
- * @see \wcf\data\AbstractDatabaseObjectAction
+ * @inheritDoc
*/
public function __construct(array $objects, $action, array $parameters = []) {
$this->action = $action;
/**
* Exports this language.
+ *
+ * @param integer[] $packageIDArray
+ * @param boolean $exportCustomValues
*/
public function export($packageIDArray = [], $exportCustomValues = false) {
$conditions = new PreparedStatementConditionBuilder();
* Sets like/dislike for an object, executing this method again with the same parameters
* will revert the status (removing like/dislike).
*
+ * @param integer $likeValue
* @return array
*/
protected function updateLike($likeValue) {
/**
* TODO: add documentation
+ *
+ * @param string $variables
+ * @return array
* @since 2.2
*/
public static function splitLessVariables($variables) {
/**
* TODO: add documentation
+ *
+ * @param string $preset
+ * @param string $custom
+ * @return string
* @since 2.2
*/
public static function joinLessVariables($preset, $custom) {
*
* @param integer $userID
* @param string $gravatar
+ * @param string $fileExtension
*/
public function __construct($userID, $gravatar, $fileExtension = 'png') {
$this->userID = $userID;
/**
* Returns all available ad location object types.
*
+ * @param string|null $categoryName
* @return ObjectType[]
*/
public function getLocationObjectTypes($categoryName = null) {
* @param string $objectType
* @param integer $objectID
* @param string $tmpHash
+ * @param integer $parentObjectID
* @throws SystemException
*/
public function __construct($objectType, $objectID, $tmpHash = '', $parentObjectID = 0) {
*
* @param string $code
* @param integer $start
+ * @param string $split
* @return string
*/
protected static function makeLineNumbers($code, $start, $split = "\n") {
* Parses smiley codes.
*
* @param string $text
- * @return string text
+ * @param boolean $enableHtml
+ * @return string
*/
protected function parseSmilies($text, $enableHtml = false) {
foreach ($this->smilies as $code => $html) {
/**
* Caches comments.
+ *
+ * @param string $string
+ * @return string
*/
protected function cacheComments($string) {
if ($this->cacheCommentsRegEx !== null) {
/**
* Caches quotes.
+ *
+ * @param string $string
+ * @return string
*/
protected function cacheQuotes($string) {
if ($this->quotesRegEx !== null) {
/**
* Highlights operators.
+ *
+ * @param string $string
+ * @return string
*/
protected function highlightOperators($string) {
if (!empty($this->operators)) {
/**
* Highlights keywords.
+ *
+ * @param string $string
+ * @return string
*/
protected function highlightKeywords($string) {
$_this = $this;
/**
* Highlights numbers.
+ *
+ * @param string $string
+ * @return string
*/
protected function highlightNumbers($string) {
$string = preg_replace('!(?<='.$this->separatorsRegEx.')(-?\d+)(?='.$this->separatorsRegEx.')!i', '<span class="hlNumbers">\\0</span>', $string);
/**
* Highlights quotes.
+ *
+ * @param string $string
+ * @return string
*/
protected function highlightQuotes($string) {
return StringStack::reinsertStrings($string, 'highlighterQuotes');
/**
* Highlights comments.
+ *
+ * @param string $string
+ * @return string
*/
protected function highlightComments($string) {
return StringStack::reinsertStrings($string, 'highlighterComments');
* Returns true if the given category or one of its child categories contains
* options.
*
+ * @param OptionCategory $topCategory
* @return boolean
*/
protected function containsOptions(OptionCategory $topCategory) {
* newParentCategoryID => 2
* ],
* ]
+ *
+ * @param array $categoryData
*/
public function changedParentCategories(array $categoryData);
interface ICLICommand {
/**
* Executes the command.
+ *
+ * @param array $parameters
*/
public function execute(array $parameters);
/**
* Validates accessible groups.
*
+ * @param integer[] $userIDs
+ * @param boolean $ignoreOwnUser
* @return integer[]
*/
protected function __validateAccessibleGroups(array $userIDs, $ignoreOwnUser = true) {
* @param string $password SQL database server password
* @param string $database SQL database server database name
* @param integer $port SQL database server port
+ * @param boolean $failsafeTest
*/
public function __construct($host, $user, $password, $database, $port, $failsafeTest = false) {
$this->host = $host;
}
/**
- * Callback function used in fixQuery()
+ * Callback function used in fixQuery().
+ *
+ * @param string[] $matches
+ * @return string
*/
private static function replaceQuotesCallback($matches) {
return StringStack::pushToStringStack($matches[0], 'postgresQuotes');
* Adds a folder to the Zip archive.
*
* @param string $name dirname
+ * @param integer $date
*/
public function addDir($name, $date = TIME_NOW) {
// replace backward slashes with forward slashes in the dirname
/**
* Returns true if given element has enabled i18n functionality.
*
+ * @param string $elementID
* @return boolean
*/
public function hasI18nValues($elementID) {
/**
* Returns an object type from cache.
*
- * @return \wcf\data\object\type\ObjectType
+ * @param string $objectName
+ * @return ObjectType
*/
public function getObjectType($objectName) {
if (isset($this->cache[$objectName])) {
/**
* Gets a like object.
*
- * @param \wcf\data\object\type\ObjectType $objectType
- * @param integer $objectID
- * @return \wcf\data\like\object\LikeObject
+ * @param ObjectType $objectType
+ * @param integer $objectID
+ * @return LikeObject
*/
public function getLikeObject(ObjectType $objectType, $objectID) {
if (isset($this->likeObjectCache[$objectType->objectTypeID][$objectID])) {
/**
* Gets the like objects of a specific object type.
*
- * @param \wcf\data\object\type\ObjectType $objectType
+ * @param ObjectType $objectType
* @return LikeObject[]
*/
public function getLikeObjects(ObjectType $objectType) {
* Loads the like data for a set of objects and returns the number of loaded
* like objects
*
- * @param \wcf\data\object\type\ObjectType $objectType
- * @param array $objectIDs
+ * @param ObjectType $objectType
+ * @param array $objectIDs
* @return integer
*/
public function loadLikeObjects(ObjectType $objectType, array $objectIDs) {
/**
* Saves the like of an object.
*
- * @param \wcf\data\like\object\ILikeObject $likeable
- * @param \wcf\data\user\User $user
- * @param integer $likeValue
- * @param integer $time
+ * @param ILikeObject $likeable
+ * @param User $user
+ * @param integer $likeValue
+ * @param integer $time
* @return array
*/
public function like(ILikeObject $likeable, User $user, $likeValue, $time = TIME_NOW) {
/**
* Reverts the like of an object.
*
- * @param \wcf\data\like\Like $like
- * @param \wcf\data\like\object\ILikeObject $likeable
- * @param \wcf\data\like\object\LikeObject $likeObject
- * @param \wcf\data\user\User $user
+ * @param Like $like
+ * @param ILikeObject $likeable
+ * @param LikeObject $likeObject
+ * @param User $user
* @return array
*/
public function revertLike(Like $like, ILikeObject $likeable, LikeObject $likeObject, User $user) {
/**
* Removes all likes for given objects.
*
- * @param string $objectType
- * @param integer[] $objectIDs
- * @param string[] $notificationObjectTypes
+ * @param string $objectType
+ * @param integer[] $objectIDs
+ * @param string[] $notificationObjectTypes
*/
public function removeLikes($objectType, array $objectIDs, array $notificationObjectTypes = []) {
$objectTypeObj = $this->getObjectType($objectType);
/**
* Returns current like object status.
*
- * @param \wcf\data\like\object\LikeObject $likeObject
- * @param \wcf\data\user\User $user
+ * @param LikeObject $likeObject
+ * @param User $user
* @return array
*/
protected function loadLikeStatus(LikeObject $likeObject, User $user) {
* @param string $cc
* @param string $bcc
* @param array $attachments
- * @param integer $priority
+ * @param integer|string $priority
* @param string $header
*/
public function __construct($to = '', $subject = '', $message = '', $from = '', $cc = '', $bcc = '', $attachments = [], $priority = '', $header = '') {
/**
* Encodes string for MIME header.
+ *
+ * @param string $string
+ * @return string
*/
public static function encodeMIMEHeader($string) {
if (function_exists('mb_encode_mimeheader')) {
/**
* Returns a specific menu item.
*
+ * @param string $menuItem
* @return UserProfileMenuItem
*/
public function getMenuItem($menuItem) {
/**
* Returns true if the affected content may be removed.
*
+ * @param ModerationQueue $queue
* @return boolean
*/
public function canRemoveContent(ModerationQueue $queue);
* Adds the condition to the given user list to fetch the users which have
* the given value for the given option.
*
- * @param \wcf\data\user\UserList $userList
- * @param \wcf\data\option\Option $option
- * @param mixed $value
+ * @param UserList $userList
+ * @param Option $option
+ * @param mixed $value
*/
public function addCondition(UserList $userList, Option $option, $value);
* Returns true if given the user option of the given user matches a certain
* value.
*
- * @param \wcf\data\user\User $user
- * @param \wcf\data\option\Option $option
- * @param mixed $value
+ * @param User $user
+ * @param Option $option
+ * @param mixed $value
* @return boolean
*/
public function checkUser(User $user, Option $option, $value);
/**
* Returns the data of the condition or null if the option should be igored.
*
+ * @param Option $option
+ * @param mixed $newValue
* @return mixed
*/
public function getConditionData(Option $option, $newValue);
/**
* Shows empty options.
+ *
+ * @param boolean $show
*/
public function showEmptyOptions($show = true) {
$this->removeEmptyOptions = !$show;
/**
* Prompts a selection of optional packages.
*
+ * @param string[][] $packages
* @return mixed
*/
protected function promptOptionalPackages(array $packages) {
abstract class PackageInstallationFileHandler implements IFileHandler {
/**
* abbrevation of the application the files belong to
- * @var string[]
+ * @var string
*/
protected $application = '';
/**
* active package installation dispatcher
- * @var \wcf\system\package\PackageInstallationDispatcher
+ * @var PackageInstallationDispatcher
*/
protected $packageInstallation;
/**
* Creates a new PackageInstallationFileHandler object.
*
- * @param \wcf\system\package\PackageInstallationDispatcher $packageInstallation
+ * @param PackageInstallationDispatcher $packageInstallation
+ * @param string $application
*/
public function __construct(PackageInstallationDispatcher $packageInstallation, $application) {
$this->packageInstallation = $packageInstallation;
* mode will toggle between different checks.
*
* @param integer $validationMode
+ * @param string $requiredVersion
* @return boolean
*/
public function validate($validationMode, $requiredVersion = '') {
*
* @deprecated
*/
- public function hasTemplateListeners($templateName, $application = 'wcf') {
+ public function hasTemplateListeners() {
return false;
}
* Compiles a variable tag and returns the compiled PHP code.
*
* @param string $tag
+ * @param boolean $replaceQuotes
* @return string
* @throws SystemException
*/
/**
* Callback function used in replaceLiterals()
+ *
+ * @param string[] $matches
+ * @return string
*/
private function replaceLiteralsCallback($matches) {
return StringStack::pushToStringStack($matches[1], 'literal');
/**
* Callback function used in replaceQuotes()
+ *
+ * @param string[] $matches
+ * @return string
*/
private function replaceSingleQuotesCallback($matches) {
return StringStack::pushToStringStack($matches[0], 'singleQuote');
/**
* Callback function used in replaceQuotes()
+ *
+ * @param string[] $matches
+ * @return string
*/
private function replaceDoubleQuotesCallback($matches) {
// parse unescaped simple vars in double quotes
/**
* Callback function used in replaceConstants()
+ *
+ * @param string[] $matches
+ * @return string
*/
private function replaceConstantsCallback($matches) {
return StringStack::pushToStringStack($matches[1], 'constants');
/**
* Executes StringUtil::encodeHTML on the given text if disableEncoding is false.
* @see \wcf\util\StringUtil::encodeHTML()
+ *
+ * @param string $text
+ * @return string
*/
protected function encodeHTML($text) {
if (!$this->disableEncoding) {
*
* @param string $link
* @param integer $pageNo
+ * @param integer $pages
* @return string
*/
protected function makeNextLink($link, $pageNo, $pages) {
*
* @param array $values
* @param integer $timeBase
+ * @param boolean $addAnDay
* @return boolean
*/
protected static function calculateMinute(array &$values, &$timeBase, $addAnDay) {
/**
* Returns a string like the one generated by unix diff.
*
+ * @param integer $context
* @return string
*/
public function getUnixDiff($context = 2) {
/**
* Alias to php setcookie() function.
+ *
+ * @param string $name
+ * @param string $value
+ * @param integer $expire
*/
public static function setCookie($name, $value = '', $expire = 0) {
$application = ApplicationHandler::getInstance()->getActiveApplication();
* Checks the content of an image for bad sections, e.g. the use of javascript
* and returns false if any bad stuff was found.
*
+ * @param string $file
* @return boolean
*/
public static function checkImageContent($file) {
public static function getRandomPassword($length = 12) {
$charset = self::PASSWORD_CHARSET;
$password = '';
-
+
for ($i = 0, $maxIndex = (strlen($charset) - 1); $i < $length; $i++) {
$password .= $charset[self::secureRandomNumber(0, $maxIndex)];
}
-
+
return $password;
}
/**
- * @see \wcf\util\CryptoUtil::secureCompare()
+ * Compares two strings in a constant time manner.
+ * This function effectively is a polyfill for the PHP 5.6 `hash_equals`.
+ *
+ * @param string $hash1
+ * @param string $hash2
+ * @return boolean
* @deprecated Use \wcf\util\CryptoUtil::secureCompare()
*/
public static function secureCompare($hash1, $hash2) {
* @param string $string
* @param string $type
* @return string $hash
+ * @param string $delimiter
*/
public static function pushToStringStack($string, $type = 'default', $delimiter = '@@') {
self::$i++;
*
* This function is considered to be slow, if $search contains
* only ASCII characters, please use str_ireplace() instead.
+ *
+ * @param string $search
+ * @param string $replace
+ * @param string $subject
+ * @param integer $count
+ * @return string
*/
public static function replaceIgnoreCase($search, $replace, $subject, &$count = 0) {
$startPos = mb_strpos(mb_strtolower($subject), mb_strtolower($search));
/**
* Alias to php str_pad function with multibyte support.
+ *
+ * @param string $input
+ * @param integer $padLength
+ * @param string $padString
+ * @param integer $padType
+ * @return string
*/
public static function pad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT) {
$additionalPadding = strlen($input) - mb_strlen($input);
/**
* Returns false if the given name is a forbidden username.
*
+ * @param string $name
* @return boolean
*/
public static function checkForbiddenUsernames($name) {
/**
* Returns false if the given email is a forbidden email.
*
+ * @param string $email
* @return boolean
*/
public static function checkForbiddenEmails($email) {