/**
* Date for the HTTP header Last-modified
- * @var string|false $mLastModified
+ * @var string|bool $mLastModified
*/
private $mLastModified;
private $mText;
/**
- * @param $text string|null
+ * @param string|null $text
*/
function __construct( $text = null ) {
$this->mCacheDuration = null;
/**
* Set the number of seconds to get the response cached by a proxy
- * @param $duration int
+ * @param int $duration
*/
function setCacheDuration( $duration ) {
$this->mCacheDuration = $duration;
/**
* Set the HTTP Vary header
- * @param $vary string
+ * @param string $vary
*/
function setVary( $vary ) {
$this->mVary = $vary;
/**
* Set the HTTP response code
- * @param $code string
+ * @param string $code
*/
function setResponseCode( $code ) {
$this->mResponseCode = $code;
/**
* Set the HTTP header Content-Type
- * @param $type string
+ * @param string $type
*/
function setContentType( $type ) {
$this->mContentType = $type;
/**
* Add content to the response
- * @param $text string
+ * @param string $text
*/
function addText( $text ) {
if ( ! $this->mDisabled && $text ) {
* possible. If successful, the AjaxResponse is disabled so that
* any future call to AjaxResponse::printText() have no effect.
*
- * @param $timestamp string
+ * @param string $timestamp
* @return bool Returns true if the response code was set to 304 Not Modified.
*/
function checkLastModified( $timestamp ) {
}
/**
- * @param $mckey string
- * @param $touched int
+ * @param string $mckey
+ * @param int $touched
* @return bool
*/
function loadFromMemcached( $mckey, $touched ) {
}
/**
- * @param $mckey string
- * @param $expiry int
+ * @param string $mckey
+ * @param int $expiry
* @return bool
*/
function storeInMemcached( $mckey, $expiry = 86400 ) {
* Update user information in the external authentication database.
* Return true if successful.
*
- * @param $user User object.
- * @return Boolean
+ * @param User $user User object.
+ * @return bool
*/
public function updateExternalDB( $user ) {
return true;
# languages
'ConverterRule' => 'languages/ConverterRule.php',
- 'FakeConverter' => 'languages/Language.php',
+ 'FakeConverter' => 'languages/FakeConverter.php',
'Language' => 'languages/Language.php',
'LanguageConverter' => 'languages/LanguageConverter.php',
'CLDRPluralRuleConverter' => 'languages/utils/CLDRPluralRuleConverter.php',
* Sanitizer that have define()s outside of their class definition. Of course
* this wouldn't be necessary if everything in MediaWiki was class-based. Sigh.
*
- * @param $class string
- * @return Boolean Return the results of class_exists() so we know if we were successful
+ * @param string $class
+ * @return bool Return the results of class_exists() so we know if we were successful
*/
static function loadClass( $class ) {
return class_exists( $class );
/**
* Get the groups for the given user based on $wgAutopromote.
*
- * @param $user User The user to get the groups for
+ * @param User $user The user to get the groups for
* @return array Array of groups to promote to.
*/
public static function getAutopromoteGroups( User $user ) {
*
* Does not return groups the user already belongs to or has once belonged.
*
- * @param $user User The user to get the groups for
- * @param string $event key in $wgAutopromoteOnce (each one has groups/criteria)
+ * @param User $user The user to get the groups for
+ * @param string $event Key in $wgAutopromoteOnce (each one has groups/criteria)
*
* @return array Groups the user should be promoted to.
*
* This function evaluates the former type recursively, and passes off to
* self::checkCondition for evaluation of the latter type.
*
- * @param $cond Mixed: a condition, possibly containing other conditions
- * @param $user User The user to check the conditions against
+ * @param mixed $cond A condition, possibly containing other conditions
+ * @param User $user The user to check the conditions against
* @return bool Whether the condition is true
*/
private static function recCheckCondition( $cond, User $user ) {
* APCOND_AGE. Other types will throw an exception if no extension evaluates them.
*
* @param array $cond A condition, which must not contain other conditions
- * @param $user User The user to check the condition against
+ * @param User $user The user to check the condition against
* @throws MWException
* @return bool Whether the condition is true for the user
*/
* Sets if the cache should be enabled or not.
*
* @since 1.20
- * @param boolean $cacheEnabled
+ * @param bool $cacheEnabled
*/
function setCacheEnabled( $cacheEnabled );
*
* @since 1.20
*
- * @param integer|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp.
- * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not.
+ * @param int|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp.
+ * @param bool|null $cacheEnabled Sets if the cache should be enabled or not.
*/
function startCache( $cacheExpiry = null, $cacheEnabled = null );
*
* @since 1.20
*
- * @param integer $cacheExpiry
+ * @param int $cacheExpiry
*/
function setExpiry( $cacheExpiry );
}
* The time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.
*
* @since 1.20
- * @var integer
+ * @var int
*/
protected $cacheExpiry = 3600;
* Null if this information is not available yet.
*
* @since 1.20
- * @var boolean|null
+ * @var bool|null
*/
protected $hasCached = null;
* If the cache is enabled or not.
*
* @since 1.20
- * @var boolean
+ * @var bool
*/
protected $cacheEnabled = true;
* Sets if the cache should be enabled or not.
*
* @since 1.20
- * @param boolean $cacheEnabled
+ * @param bool $cacheEnabled
*/
public function setCacheEnabled( $cacheEnabled ) {
$this->cacheEnabled = $cacheEnabled;
*
* @since 1.20
*
- * @param integer|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp.
- * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not.
+ * @param int|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp.
+ * @param bool|null $cacheEnabled Sets if the cache should be enabled or not.
*/
public function startCache( $cacheExpiry = null, $cacheEnabled = null ) {
if ( is_null( $this->hasCached ) ) {
* @since 1.20
*
* @param IContextSource $context
- * @param boolean $includePurgeLink
+ * @param bool $includePurgeLink
*
* @return string
*/
*
* @since 1.20
*
- * @param integer $cacheExpiry
+ * @param int $cacheExpiry
*/
public function setExpiry( $cacheExpiry ) {
$this->cacheExpiry = $cacheExpiry;
*
* @since 1.20
*
- * @param $handlerFunction
+ * @param callable $handlerFunction
*/
public function setOnInitializedHandler( $handlerFunction ) {
$this->onInitHandler = $handlerFunction;
/**
* Factory function.
*
- * @param $title Title for the category page
- * @return Category|bool on a totally invalid name
+ * @param Title $title Title for the category page
+ * @return Category|bool On a totally invalid name
*/
public static function newFromTitle( $title ) {
$cat = new self();
/**
* Factory function.
*
- * @param $id Integer: a category id
+ * @param int $id A category id
* @return Category
*/
public static function newFromID( $id ) {
/**
* Factory function, for constructing a Category object from a result set
*
- * @param $row Result set row, must contain the cat_xxx fields. If the
+ * @param object $row Result set row, must contain the cat_xxx fields. If the
* fields are null, the resulting Category object will represent an empty
* category if a title object was given. If the fields are null and no
* title was given, this method fails and returns false.
- * @param Title $title optional title object for the category represented by
+ * @param Title $title Optional title object for the category represented by
* the given row. May be provided if it is already known, to avoid having
* to re-create a title object later.
* @return Category
/**
* Fetch a TitleArray of up to $limit category members, beginning after the
* category sort key $offset.
- * @param $limit integer
- * @param $offset string
- * @return TitleArray object for category members.
+ * @param int $limit
+ * @param string $offset
+ * @return TitleArray TitleArray object for category members.
*/
public function getMembers( $limit = false, $offset = '' ) {
wfProfileIn( __METHOD__ );
$imgsNoGallery;
/**
- * @var Array
+ * @var array
*/
var $nextPage;
/**
- * @var Array
+ * @var array
*/
var $flip;
* Constructor
*
* @since 1.19 $context is a second, required parameter
- * @param $title Title
- * @param $context IContextSource
+ * @param Title $title
+ * @param IContextSource $context
* @param array $from An array with keys page, subcat,
* and file for offset of results of each section (since 1.17)
* @param array $until An array with 3 keys for until of each section (since 1.17)
- * @param $query Array
+ * @param array $query
*/
function __construct( $title, IContextSource $context, $from = array(),
$until = array(), $query = array()
/**
* Add a subcategory to the internal lists, using a Category object
- * @param $cat Category
- * @param $sortkey
- * @param $pageLength
+ * @param Category $cat
+ * @param string $sortkey
+ * @param int $pageLength
*/
function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
// Subcategory; strip the 'Category' namespace from the link text.
/**
* Add a page in the image namespace
- * @param $title Title
- * @param $sortkey
- * @param $pageLength
- * @param $isRedirect bool
+ * @param Title $title
+ * @param string $sortkey
+ * @param int $pageLength
+ * @param bool $isRedirect
*/
function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) {
global $wgContLang;
/**
* Add a miscellaneous page
- * @param $title
- * @param $sortkey
- * @param $pageLength
- * @param $isRedirect bool
+ * @param Title $title
+ * @param string $sortkey
+ * @param int $pageLength
+ * @param bool $isRedirect
*/
function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
global $wgContLang;
* Format a list of articles chunked by letter, either as a
* bullet list or a columnar format, depending on the length.
*
- * @param $articles Array
- * @param $articles_start_char Array
- * @param $cutoff Int
- * @return String
+ * @param array $articles
+ * @param array $articles_start_char
+ * @param int $cutoff
+ * @return string
* @private
*/
function formatList( $articles, $articles_start_char, $cutoff = 6 ) {
* More distant TODO: Scrap this and use CSS columns, whenever IE finally
* supports those.
*
- * @param $articles Array
- * @param $articles_start_char Array
- * @return String
+ * @param array $articles
+ * @param array $articles_start_char
+ * @return string
* @private
*/
static function columnList( $articles, $articles_start_char ) {
/**
* Format a list of articles chunked by letter in a bullet list.
- * @param $articles Array
- * @param $articles_start_char Array
- * @return String
+ * @param array $articles
+ * @param array $articles_start_char
+ * @return string
* @private
*/
static function shortList( $articles, $articles_start_char ) {
* @param string $last The 'from' parameter for the generated URL
* @param string $type A prefix for parameters, 'page' or 'subcat' or
* 'file'
- * @return String HTML
+ * @return string HTML
*/
private function pagingLinks( $first, $last, $type = '' ) {
$prevLink = $this->msg( 'prevn' )->numParams( $this->limit )->escaped();
/**
* Initializes the instance. Do this prior to calling run().
- * @param $article_ids Array of article IDs
- * @param $categories FIXME
+ * @param array $article_ids Array of article IDs
+ * @param array $categories FIXME
* @param string $mode FIXME, default 'AND'.
* @todo FIXME: $categories/$mode
*/
* This functions recurses through the parent representation, trying to match the conditions
* @param int $id The article/category to check
* @param array $conds The array of categories to match
- * @param array $path used to check for recursion loops
+ * @param array $path Used to check for recursion loops
* @return bool Does this match the conditions?
*/
function check( $id, &$conds, $path = array() ) {
*
* @param string $tag tag
*
- * @return String: Short description of the tag from "mediawiki:tag-$tag" if this message exists,
- * html-escaped version of $tag otherwise
+ * @return string Short description of the tag from "mediawiki:tag-$tag" if this message exists,
+ * html-escaped version of $tag otherwise
*/
public static function tagDescription( $tag ) {
$msg = wfMessage( "tag-$tag" );
* Add tags to a change given its rc_id, rev_id and/or log_id
*
* @param string|array $tags Tags to add to the change
- * @param $rc_id int: rc_id of the change to add the tags to
- * @param $rev_id int: rev_id of the change to add the tags to
- * @param $log_id int: log_id of the change to add the tags to
+ * @param int $rc_id rc_id of the change to add the tags to
+ * @param int $rev_id rev_id of the change to add the tags to
+ * @param int $log_id Log_id of the change to add the tags to
* @param string $params params to put in the ct_params field of table 'change_tag'
*
* @throws MWException
- * @return bool: false if no changes are made, otherwise true
+ * @return bool false if no changes are made, otherwise true
*
* @exception MWException when $rc_id, $rev_id and $log_id are all null
*/
*
* @param string|array $tables Table names, see DatabaseBase::select
* @param string|array $fields Fields used in query, see DatabaseBase::select
- * @param string|array $conds conditions used in query, see DatabaseBase::select
- * @param $join_conds Array: join conditions, see DatabaseBase::select
- * @param array $options options, see Database::select
+ * @param string|array $conds Conditions used in query, see DatabaseBase::select
+ * @param array $join_conds Join conditions, see DatabaseBase::select
+ * @param array $options Options, see Database::select
* @param bool|string $filter_tag Tag to select on
*
* @throws MWException When unable to determine appropriate JOIN condition for tagging
* Build a text box to select a change tag
*
* @param string $selected tag to select by default
- * @param $fullForm Boolean:
+ * @param bool $fullForm
* - if false, then it returns an array of (label, form).
* - if true, it returns an entire form around the selector.
- * @param $title Title object to send the form to.
+ * @param Title $title Title object to send the form to.
* Used when, and only when $fullForm is true.
- * @return String or array:
+ * @return string|array
* - if $fullForm is false: Array with
* - if $fullForm is true: String, html fragment
*/
*
* Tries memcached first.
*
- * @return Array of strings: tags
+ * @return array Array of strings: tags
*/
public static function listDefinedTags() {
// Caching...
/**
* Constructor
*
- * @param string $format feed's format (either 'rss' or 'atom')
- * @param string $type type of feed (for cache keys)
+ * @param string $format Feed's format (either 'rss' or 'atom')
+ * @param string $type Type of feed (for cache keys)
*/
public function __construct( $format, $type ) {
$this->format = $format;
/**
* Get a ChannelFeed subclass object to use
*
- * @param string $title feed's title
- * @param string $description feed's description
- * @param string $url url of origin page
- * @return ChannelFeed subclass or false on failure
+ * @param string $title Feed's title
+ * @param string $description Feed's description
+ * @param string $url Url of origin page
+ * @return ChannelFeed|bool ChannelFeed subclass or false on failure
*/
public function getFeedObject( $title, $description, $url ) {
global $wgSitename, $wgLanguageCode, $wgFeedClasses;
/**
* Save to feed result to $messageMemc
*
- * @param string $feed feed's content
- * @param string $timekey memcached key of the last modification
- * @param string $key memcached key of the content
+ * @param string $feed Feed's content
+ * @param string $timekey Memcached key of the last modification
+ * @param string $key Memcached key of the content
*/
public function saveToCache( $feed, $timekey, $key ) {
global $messageMemc;
/**
* Try to load the feed result from $messageMemc
*
- * @param $lastmod Integer: timestamp of the last item in the recentchanges table
- * @param string $timekey memcached key of the last modification
- * @param string $key memcached key of the content
- * @return string|bool feed's content on cache hit or false on cache miss
+ * @param int $lastmod Timestamp of the last item in the recentchanges table
+ * @param string $timekey Memcached key of the last modification
+ * @param string $key Memcached key of the content
+ * @return string|bool Feed's content on cache hit or false on cache miss
*/
public function loadFromCache( $lastmod, $timekey, $key ) {
global $wgFeedCacheTimeout, $wgOut, $messageMemc;
/**
* Generate the feed items given a row from the database, printing the feed.
- * @param $rows DatabaseBase resource with recentchanges rows
- * @param $feed Feed object
+ * @param object $rows DatabaseBase resource with recentchanges rows
+ * @param Feed $feed
*/
public static function generateFeed( $rows, &$feed ) {
wfProfileIn( __METHOD__ );
/**
* Generate the feed items given a row from the database.
- * @param $rows DatabaseBase resource with recentchanges rows
+ * @param object $rows DatabaseBase resource with recentchanges rows
*/
public static function buildItems( $rows ) {
wfProfileIn( __METHOD__ );
* cookies. Used internally after a request to parse the
* Set-Cookie headers.
*
- * @param string $value the value of the cookie
- * @param array $attr possible key/values:
+ * @param string $value The value of the cookie
+ * @param array $attr Possible key/values:
* expires A date string
* path The path this cookie is used on
* domain Domain this cookie is used on
* @todo fixme fails to detect 2-letter top-level domains for single-domain use (probably
* not a big problem in practice, but there are test cases)
*
- * @param string $domain the domain to validate
+ * @param string $domain The domain to validate
* @param string $originDomain (optional) the domain the cookie originates from
- * @return Boolean
+ * @return bool
*/
public static function validateCookieDomain( $domain, $originDomain = null ) {
// Don't allow a trailing dot
/**
* Serialize the cookie jar into a format useful for HTTP Request headers.
*
- * @param string $path the path that will be used. Required.
- * @param string $domain the domain that will be used. Required.
- * @return String
+ * @param string $path The path that will be used. Required.
+ * @param string $domain The domain that will be used. Required.
+ * @return string
*/
public function serializeToHttpRequest( $path, $domain ) {
$ret = '';
}
/**
- * @param $domain
+ * @param string $domain
* @return bool
*/
protected function canServeDomain( $domain ) {
}
/**
- * @param $path
+ * @param string $path
* @return bool
*/
protected function canServePath( $path ) {
/**
* Set a cookie in the cookie jar. Make sure only one cookie per-name exists.
* @see Cookie::set()
+ * @param string $name
+ * @param string $value
+ * @param array $attr
*/
public function setCookie( $name, $value, $attr ) {
/* cookies: case insensitive, so this should work.
/**
* @see Cookie::serializeToHttpRequest
+ * @param string $path
+ * @param string $domain
* @return string
*/
public function serializeToHttpRequest( $path, $domain ) {
/**
* Parse the content of an Set-Cookie HTTP Response header.
*
- * @param $cookie String
- * @param string $domain cookie's domain
+ * @param string $cookie
+ * @param string $domain Cookie's domain
* @return null
*/
public function parseCookieResponseHeader( $cookie, $domain ) {
/**
* Has a summary been preset using GET parameter &summary= ?
- * @var Bool
+ * @var bool
*/
var $hasPresetSummary = false;
public $allowNonTextContent = false;
/**
- * @param $article Article
+ * @param Article $article
*/
public function __construct( Article $article ) {
$this->mArticle = $article;
/**
* Set the context Title object
*
- * @param $title Title object or null
+ * @param Title|null $title Title object or null
*/
public function setContextTitle( $title ) {
$this->mContextTitle = $title;
* If not set, $wgTitle will be returned. This behavior might change in
* the future to return $this->mTitle instead.
*
- * @return Title object
+ * @return Title
*/
public function getContextTitle() {
if ( is_null( $this->mContextTitle ) ) {
* "View source for ..." page displaying the source code after the error message.
*
* @since 1.19
- * @param array $permErrors of permissions errors, as returned by
- * Title::getUserPermissionsErrors().
+ * @param array $permErrors Array of permissions errors, as returned by
+ * Title::getUserPermissionsErrors().
* @throws PermissionsError
*/
protected function displayPermissionsError( array $permErrors ) {
/**
* This function collects the form data and uses it to populate various member variables.
- * @param $request WebRequest
+ * @param WebRequest $request
* @throws ErrorPageError
*/
function importFormData( &$request ) {
* this method should be overridden and return the page text that will be used
* for saving, preview parsing and so on...
*
- * @param $request WebRequest
+ * @param WebRequest $request
*/
protected function importContentFormData( &$request ) {
return; // Don't do anything, EditPage already extracted wpTextbox1
/**
* Initialise form fields in the object
* Called on the first invocation, e.g. when a user clicks an edit link
- * @return bool -- if the requested section is valid
+ * @return bool If the requested section is valid
*/
function initialiseForm() {
global $wgUser;
/**
* Fetch initial editing page content.
*
- * @param $def_text string|bool
- * @return mixed string on success, $def_text for invalid sections
+ * @param string|bool $def_text
+ * @return string|bool string on success, $def_text for invalid sections
* @private
* @deprecated since 1.21, get WikiPage::getContent() instead.
*/
/**
* @param Content|null $def_content The default value to return
*
- * @return mixed Content on success, $def_content for invalid sections
+ * @return Content|null Content on success, $def_content for invalid sections
*
* @since 1.21
*/
/**
* Use this method before edit() to preload some text into the edit box
*
- * @param $text string
+ * @param string $text
* @deprecated since 1.21, use setPreloadedContent() instead.
*/
public function setPreloadedText( $text ) {
/**
* Use this method before edit() to preload some content into the edit box
*
- * @param $content Content
+ * @param Content $content
*
* @since 1.21
*/
*
* @param string $preload representing the title to preload from.
*
- * @return String
+ * @return string
*
* @deprecated since 1.21, use getPreloadedContent() instead
*/
* Get the contents to be preloaded into the box, either set by
* an earlier setPreloadText() or by loading the given page.
*
- * @param string $preload representing the title to preload from.
- * @param Array $params Parameters to use (interface-message style) in the preloaded text
+ * @param string $preload Representing the title to preload from.
+ * @param array $params Parameters to use (interface-message style) in the preloaded text
*
* @return Content
*
/**
* Make sure the form isn't faking a user's credentials.
*
- * @param $request WebRequest
+ * @param WebRequest $request
* @return bool
* @private
*/
/**
* Run hooks that can filter edits just before they get saved.
*
- * @param Content $content the Content to filter.
+ * @param Content $content The Content to filter.
* @param Status $status For reporting the outcome to the caller
* @param User $user The user performing the edit
*
/**
* Attempt submission (no UI)
*
- * @param array $result array to add statuses to, currently with the possible keys:
+ * @param array $result Array to add statuses to, currently with the possible keys:
* spam - string - Spam string from content if any spam is detected by matchSpamRegex
* sectionanchor - string - Section anchor for a section save
* nullEdit - boolean - Set if doEditContent is OK. True if null edit, false otherwise.
* redirect - boolean - Set if doEditContent is OK. True if resulting revision is a redirect
* @param bool $bot True if edit is being made under the bot right.
*
- * @return Status object, possibly with a message, but always with one of the AS_* constants in $status->value,
+ * @return Status Status object, possibly with a message, but always with one of the AS_* constants in $status->value,
*
* FIXME: This interface is TERRIBLE, but hard to get rid of due to various error display idiosyncrasies. There are
* also lots of cases where error metadata is set in the object and retrieved later instead of being returned, e.g.
/**
* Attempts to merge text content with base and current revisions
*
- * @param $editText string
+ * @param string $editText
*
* @return bool
* @deprecated since 1.21, use mergeChangesIntoContent() instead
*
* @since 1.21
*
- * @param $editContent
+ * @param Content $editContent
*
* @return bool
*/
/**
* Check given input text against $wgSpamRegex, and return the text of the first match.
*
- * @param $text string
+ * @param string $text
*
- * @return string|bool matching string or false
+ * @return string|bool Matching string or false
*/
public static function matchSpamRegex( $text ) {
global $wgSpamRegex;
/**
* Check given input text against $wgSummarySpamRegex, and return the text of the first match.
*
- * @param $text string
+ * @param string $text
*
- * @return string|bool matching string or false
+ * @return string|bool Matching string or false
*/
public static function matchSummarySpamRegex( $text ) {
global $wgSummarySpamRegex;
}
/**
- * @param $text string
- * @param $regexes array
+ * @param string $text
+ * @param array $regexes
* @return bool|string
*/
protected static function matchSpamRegexInternal( $text, $regexes ) {
* content.
*
* @param Content|null|bool|string $content
- * @return String the editable text form of the content.
+ * @return string The editable text form of the content.
*
* @throws MWException if $content is not an instance of TextContent and $this->allowNonTextContent is not true.
*/
/**
* Send the edit form and related headers to $wgOut
- * @param $formCallback Callback|null that takes an OutputPage parameter; will be called
+ * @param callable|null $formCallback That takes an OutputPage parameter; will be called
* during form output near the top, for captchas and the like.
*/
function showEditForm( $formCallback = null ) {
* Extract the section title from current section text, if any.
*
* @param string $text
- * @return Mixed|string or false
+ * @return string|bool string or false
*/
public static function extractSectionTitle( $text ) {
preg_match( "/^(=+)(.+)\\1\\s*(\n|$)/i", $text, $matches );
*
* @param string $summary The value of the summary input
* @param string $labelText The html to place inside the label
- * @param array $inputAttrs of attrs to use on the input
- * @param array $spanLabelAttrs of attrs to use on the span inside the label
+ * @param array $inputAttrs Array of attrs to use on the input
+ * @param array $spanLabelAttrs Array of attrs to use on the span inside the label
*
* @return array An array in the format array( $label, $input )
*/
* @param bool $isSubjectPreview true if this is the section subject/title
* up top, or false if this is the comment summary
* down below the textarea
- * @param string $summary the text of the summary to display
+ * @param string $summary The text of the summary to display
* @return string
*/
protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
* The $textoverride method can be used by subclasses overriding showContentForm
* to pass back to this method.
*
- * @param array $customAttribs of html attributes to use in the textarea
- * @param string $textoverride optional text to override $this->textarea1 with
+ * @param array $customAttribs Array of html attributes to use in the textarea
+ * @param string $textoverride Optional text to override $this->textarea1 with
*/
protected function showTextbox1( $customAttribs = null, $textoverride = null ) {
if ( $this->wasDeletedSinceLastEdit() && $this->formtype == 'save' ) {
* Append preview output to $wgOut.
* Includes category rendering if this is a category page.
*
- * @param string $text the HTML to be output for the preview.
+ * @param string $text The HTML to be output for the preview.
*/
protected function showPreview( $text ) {
global $wgOut;
* Get the copyright warning, by default returns wikitext
*
* @param Title $title
- * @param string $format output format, valid values are any function of
- * a Message object
+ * @param string $format Output format, valid values are any function of a Message object
* @return string
*/
public static function getCopyrightWarning( $title, $format = 'plain' ) {
* variable in the constructor is not enough. This can be used when the
* EditPage lives inside of a Special page rather than a custom page action.
*
- * @param $title Title object for which is being edited (where we go to for &action= links)
+ * @param Title $title Title object for which is being edited (where we go to for &action= links)
* @return string
*/
protected function getActionURL( Title $title ) {
* Note that we rely on the logging table, which hasn't been always there,
* but that doesn't matter, because this only applies to brand new
* deletes.
+ * @return bool
*/
protected function wasDeletedSinceLastEdit() {
if ( $this->deletedSinceEdit !== null ) {
}
/**
- * @return Array
+ * @return array
*/
function getTemplates() {
if ( $this->preview || $this->section != '' ) {
* minor and watch
*
* @param int $tabindex Current tabindex
- * @param array $checked of checkbox => bool, where bool indicates the checked
+ * @param array $checked Array of checkbox => bool, where bool indicates the checked
* status of the checkbox
*
* @return array
/**
* Show "your edit contains spam" page with your diff and text
*
- * @param $match string|Array|bool Text (or array of texts) which triggered one or more filters
+ * @param string|array|bool $match Text (or array of texts) which triggered one or more filters
*/
public function spamPageWithContent( $match = false ) {
global $wgOut, $wgLang;
class Fallback {
/**
- * @param $from
- * @param $to
- * @param $string
+ * @param string $from
+ * @param string $to
+ * @param string $string
* @return string
*/
public static function iconv( $from, $to, $string ) {
* can be up to 100x slower than native if the text is heavily
* multibyte and we have to slog through a few hundred kb.
*
- * @param $str
- * @param $start
- * @param $count string
+ * @param string $str
+ * @param int $start
+ * @param string $count
*
* @return string
*/
}
/**
- * @param $str
- * @param $splitPos
+ * @param string $str
+ * @param int $splitPos
* @return int
*/
public static function mb_substr_split_unicode( $str, $splitPos ) {
/**
* Fallback implementation of mb_strlen, hardcoded to UTF-8.
* @param string $str
- * @param string $enc optional encoding; ignored
+ * @param string $enc Optional encoding; ignored
* @return int
*/
public static function mb_strlen( $str, $enc = '' ) {
/**
* Fallback implementation of mb_strpos, hardcoded to UTF-8.
- * @param $haystack String
- * @param $needle String
- * @param string $offset optional start position
- * @param string $encoding optional encoding; ignored
+ * @param string $haystack
+ * @param string $needle
+ * @param string $offset Optional start position
+ * @param string $encoding Optional encoding; ignored
* @return int
*/
public static function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
/**
* Fallback implementation of mb_strrpos, hardcoded to UTF-8.
- * @param $haystack String
- * @param $needle String
+ * @param string $haystack
+ * @param string $needle
* @param string $offset optional start position
* @param string $encoding optional encoding; ignored
* @return int
* Constructor
*
* @param string|Title $title Item's title
- * @param $description String
+ * @param string $description
* @param string $url URL uniquely designating the item.
* @param string $date Item's date
* @param string $author Author's user name
- * @param $comments String
+ * @param string $comments
*/
function __construct( $title, $description, $url, $date = '', $author = '', $comments = '' ) {
$this->title = $title;
/**
* Encode $string so that it can be safely embedded in a XML document
*
- * @param string $string string to encode
- * @return String
+ * @param string $string String to encode
+ * @return string
*/
public function xmlEncode( $string ) {
$string = str_replace( "\r\n", "\n", $string );
/**
* Get the unique id of this item
*
- * @return String
+ * @return string
*/
public function getUniqueId() {
if ( $this->uniqueId ) {
/**
* set the unique id of an item
*
- * @param string $uniqueId unique id for the item
- * @param $rssIsPermalink Boolean: set to true if the guid (unique id) is a permalink (RSS feeds only)
+ * @param string $uniqueId Unique id for the item
+ * @param bool $rssIsPermalink Set to true if the guid (unique id) is a permalink (RSS feeds only)
*/
public function setUniqueId( $uniqueId, $rssIsPermalink = false ) {
$this->uniqueId = $uniqueId;
/**
* Get the title of this item; already xml-encoded
*
- * @return String
+ * @return string
*/
public function getTitle() {
return $this->xmlEncode( $this->title );
/**
* Get the URL of this item; already xml-encoded
*
- * @return String
+ * @return string
*/
public function getUrl() {
return $this->xmlEncode( $this->url );
/**
* Get the description of this item; already xml-encoded
*
- * @return String
+ * @return string
*/
public function getDescription() {
return $this->xmlEncode( $this->description );
/**
* Get the language of this item
*
- * @return String
+ * @return string
*/
public function getLanguage() {
global $wgLanguageCode;
/**
* Get the title of this item
*
- * @return String
+ * @return string
*/
public function getDate() {
return $this->date;
/**
* Get the author of this item; already xml-encoded
*
- * @return String
+ * @return string
*/
public function getAuthor() {
return $this->xmlEncode( $this->author );
/**
* Get the comment of this item; already xml-encoded
*
- * @return String
+ * @return string
*/
public function getComments() {
return $this->xmlEncode( $this->comments );
* Quickie hack... strip out wikilinks to more legible form from the comment.
*
* @param string $text wikitext
- * @return String
+ * @return string
*/
public static function stripComment( $text ) {
return preg_replace( '/\[\[([^]]*\|)?([^]]+)\]\]/', '\2', $text );
* @code
* print "<feed>";
* @endcode
- * @param $item
*/
abstract public function outHeader();
* @code
* print "<item>...</item>";
* @endcode
- * @param $item
+ * @param FeedItem $item
*/
abstract public function outItem( $item );
/**
* Format a date given a timestamp
*
- * @param $ts Integer: timestamp
- * @return String: date string
+ * @param int $ts Timestamp
+ * @return string Date string
*/
function formatTime( $ts ) {
return gmdate( 'D, d M Y H:i:s \G\M\T', wfTimestamp( TS_UNIX, $ts ) );
/**
* Output an RSS 2.0 item
- * @param $item FeedItem: item to be output
+ * @param FeedItem $item Item to be output
*/
function outItem( $item ) {
?>
/**
* Output a given item.
- * @param $item
+ * @param FeedItem $item
*/
function outItem( $item ) {
global $wgMimeType;
* If the feed should be purged; $timekey and $key will be removed from
* $messageMemc
*
- * @param string $timekey cache key of the timestamp of the last item
- * @param string $key cache key of feed's content
+ * @param string $timekey Cache key of the timestamp of the last item
+ * @param string $key Cache key of feed's content
*/
public static function checkPurge( $timekey, $key ) {
global $wgRequest, $wgUser, $messageMemc;
* Check whether feeds can be used and that $type is a valid feed type
*
* @param string $type feed type, as requested by the user
- * @return Boolean
+ * @return bool
*/
public static function checkFeedOutput( $type ) {
global $wgOut, $wgFeed, $wgFeedClasses;
/**
* Format a diff for the newsfeed
*
- * @param $row Object: row from the recentchanges table
- * @return String
+ * @param object $row Row from the recentchanges table
+ * @return string
*/
public static function formatDiff( $row ) {
$titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
/**
* Really format a diff for the newsfeed
*
- * @param $title Title object
- * @param $oldid Integer: old revision's id
- * @param $newid Integer: new revision's id
- * @param $timestamp Integer: new revision's timestamp
- * @param string $comment new revision's comment
- * @param string $actiontext text of the action; in case of log event
- * @return String
+ * @param Title $title Title object
+ * @param int $oldid Old revision's id
+ * @param int $newid New revision's id
+ * @param int $timestamp New revision's timestamp
+ * @param string $comment New revision's comment
+ * @param string $actiontext Text of the action; in case of log event
+ * @return string
*/
public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext = '' ) {
global $wgFeedDiffCutoff, $wgLang;
* Generates a diff link. Used when the full diff is not wanted for example
* when $wgFeedDiffCutoff is 0.
*
- * @param $title Title object: used to generate the diff URL
- * @param $newid Integer newid for this diff
- * @param $oldid Integer|null oldid for the diff. Null means it is a new article
+ * @param Title $title Title object: used to generate the diff URL
+ * @param int $newid Newid for this diff
+ * @param int|null $oldid Oldid for the diff. Null means it is a new article
* @return string
*/
protected static function getDiffLink( Title $title, $newid, $oldid = null ) {
* Might be 'cleaner' to use DOM or XSLT or something,
* but *gack* it's a pain in the ass.
*
- * @param string $text diff's HTML output
- * @return String: modified HTML
+ * @param string $text Diff's HTML output
+ * @return string Modified HTML
*/
public static function applyDiffStyle( $text ) {
$styles = array(
* showing an appropriate message depending upon whether
* it's a current file or an old version
*
- * @param string $message message base
- * @return String
+ * @param string $message Message base
+ * @return string
*/
private function prepareMessage( $message ) {
global $wgLang;
/**
* Is the provided `oldimage` value valid?
*
+ * @param string $oldimage
* @return bool
*/
public static function isValidOldSpec( $oldimage ) {
* value was provided, does it correspond to an
* existing, local, old version of this file?
*
- * @param $file File
- * @param $oldfile File
- * @param $oldimage File
+ * @param File $file
+ * @param File $oldfile
+ * @param File $oldimage
* @return bool
*/
public static function haveDeletableFile( &$file, &$oldfile, $oldimage ) {
* You must call setLocation() on the stub object before storing it to the
* database
*
- * @param $text string
+ * @param string $text
*
- * @return String: the key for getItem()
+ * @return string The key for getItem()
*/
function addItem( $text );
/**
* Get item by key, or false if the key is not present
*
- * @param $key string
+ * @param string $key
*
- * @return String or false
+ * @return string|bool
*/
function getItem( $key );
*
* Default text is not required for two-part external storage URLs.
*
- * @param $text string
+ * @param string $text
*/
function setText( $text );
/**
* Get default text. This is called from Revision::getRevisionText()
*
- * @return String
+ * @return string
*/
function getText();
}
}
/**
- * @param $text string
+ * @param string $text
* @return string
*/
public function addItem( $text ) {
}
/**
- * @param $hash string
+ * @param string $hash
* @return array|bool
*/
public function getItem( $hash ) {
}
/**
- * @param $text string
+ * @param string $text
* @return void
*/
public function setText( $text ) {
/**
* Remove an item
*
- * @param $hash string
+ * @param string $hash
*/
public function removeItem( $hash ) {
$this->mSize -= strlen( $this->mItems[$hash] );
var $mOldId, $mHash, $mRef;
/**
- * @param string $hash the content hash of the text
- * @param $oldid Integer the old_id for the CGZ object
+ * @param string $hash The content hash of the text
+ * @param int $oldid The old_id for the CGZ object
*/
function __construct( $hash = '', $oldid = 0 ) {
$this->mHash = $hash;
/**
* Sets the location (old_id) of the main object to which this object
* points
+ * @param int $id
*/
function setLocation( $id ) {
$this->mOldId = $id;
/**
* Sets the location (old_id) of the referring object
+ * @param string $id
*/
function setReferrer( $id ) {
$this->mRef = $id;
/**
* Gets the location of the referring object
+ * @return string
*/
function getReferrer() {
return $this->mRef;
var $mCurId;
/**
- * @param $curid Integer: the cur_id pointed to
+ * @param int $curid The cur_id pointed to
*/
function __construct( $curid = 0 ) {
$this->mCurId = $curid;
* Sets the location (cur_id) of the main object to which this object
* points
*
- * @param $id int
+ * @param int $id
*/
function setLocation( $id ) {
$this->mCurId = $id;
/**
* @throws MWException
- * @param $text string
+ * @param string $text
* @return int
*/
function addItem( $text ) {
}
/**
- * @param $key string
+ * @param string $key
* @return string
*/
function getItem( $key ) {
}
/**
- * @param $text string
+ * @param string $text
*/
function setText( $text ) {
$this->mDefaultKey = $this->addItem( $text );
}
/**
- * @param $t1
- * @param $t2
+ * @param string $t1
+ * @param string $t2
* @return string
*/
function diff( $t1, $t2 ) {
}
/**
- * @param $base
- * @param $diff
+ * @param string $base
+ * @param string $diff
* @return bool|string
*/
function patch( $base, $diff ) {
* the bytes backwards and initialised with 0 instead of 1. See bug 34428.
*
* @param string $s
- * @return string|bool: false if the hash extension is not available
+ * @return string|bool false if the hash extension is not available
*/
function xdiffAdler32( $s ) {
if ( !function_exists( 'hash' ) ) {
* Identical to rawElement(), but HTML-escapes $contents (like
* Xml::element()).
*
- * @param $element string
- * @param $attribs array
- * @param $contents string
+ * @param string $element
+ * @param array $attribs
+ * @param string $contents
*
* @return string
*/
* Identical to rawElement(), but has no third parameter and omits the end
* tag (and the self-closing '/' in XML mode for empty elements).
*
- * @param $element string
- * @param $attribs array
+ * @param string $element
+ * @param array $attribs
*
* @return string
*/
* to the input array (currently per the HTML 5 draft as of 2009-09-06).
*
* @param string $element Name of the element, e.g., 'a'
- * @param array $attribs Associative array of attributes, e.g., array(
+ * @param array $attribs Associative array of attributes, e.g., array(
* 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
* further documentation.
* @return array An array of attributes functionally identical to $attribs
* Output a "<script>" tag linking to the given URL, e.g.,
* "<script src=foo.js></script>".
*
- * @param $url string
+ * @param string $url
* @return string Raw HTML
*/
public static function linkedScript( $url ) {
* contains literal "</style>" (admittedly unlikely).
*
* @param string $contents CSS
- * @param $media mixed A media type string, like 'screen'
+ * @param string $media A media type string, like 'screen'
* @return string Raw HTML
*/
public static function inlineStyle( $contents, $media = 'all' ) {
* Output a "<link rel=stylesheet>" linking to the given URL for the given
* media type (if any).
*
- * @param $url string
- * @param $media mixed A media type string, like 'screen'
+ * @param string $url
+ * @param string $media A media type string, like 'screen'
* @return string Raw HTML
*/
public static function linkedStyle( $url, $media = 'all' ) {
/**
* Get HTML for an info box with an icon.
*
- * @param string $text wikitext, get this with wfMessage()->plain()
- * @param string $icon icon name, file in skins/common/images
- * @param string $alt alternate text for the icon
- * @param string $class additional class name to add to the wrapper div
- * @param $useStylePath
+ * @param string $text Wikitext, get this with wfMessage()->plain()
+ * @param string $icon Icon name, file in skins/common/images
+ * @param string $alt Alternate text for the icon
+ * @param string $class Additional class name to add to the wrapper div
+ * @param bool $useStylePath
*
* @return string
*/
* to avoid attacks on intranet services accessible by HTTP.
* - userAgent A user agent, if you want to override the default
* MediaWiki/$wgVersion
- * @return Mixed: (bool)false on failure or a string on success
+ * @return string|bool (bool)false on failure or a string on success
*/
public static function request( $method, $url, $options = array() ) {
wfDebug( "HTTP: $method: $url\n" );
* Simple wrapper for Http::request( 'GET' )
* @see Http::request()
*
- * @param $url
- * @param $timeout string
- * @param $options array
+ * @param string $url
+ * @param string $timeout
+ * @param array $options
* @return string
*/
public static function get( $url, $timeout = 'default', $options = array() ) {
* Simple wrapper for Http::request( 'POST' )
* @see Http::request()
*
- * @param $url
- * @param $options array
+ * @param string $url
+ * @param array $options
* @return string
*/
public static function post( $url, $options = array() ) {
/**
* Check if the URL can be served by localhost
*
- * @param string $url full url to check
- * @return Boolean
+ * @param string $url Full url to check
+ * @return bool
*/
public static function isLocalURL( $url ) {
global $wgCommandLineMode, $wgConf;
/**
* A standard user-agent we can use for external requests.
- * @return String
+ * @return string
*/
public static function userAgent() {
global $wgVersion;
*
* @todo FIXME this is wildly inaccurate and fails to actually check most stuff
*
- * @param $uri Mixed: URI to check for validity
- * @return Boolean
+ * @param string $uri URI to check for validity
+ * @return bool
*/
public static function isValidURI( $uri ) {
return preg_match(
public $status;
/**
- * @param string $url url to use. If protocol-relative, will be expanded to an http:// URL
+ * @param string $url Url to use. If protocol-relative, will be expanded to an http:// URL
* @param array $options (optional) extra params to pass (see Http::request())
*/
protected function __construct( $url, $options = array() ) {
/**
* Generate a new request object
- * @param string $url url to use
+ * @param string $url Url to use
* @param array $options (optional) extra params to pass (see Http::request())
* @throws MWException
* @return CurlHttpRequest|PhpHttpRequest
/**
* Get the body, or content, of the response to the request
*
- * @return String
+ * @return string
*/
public function getContent() {
return $this->content;
/**
* Set the parameters of the request
*
- * @param $args Array
+ * @param array $args
* @todo overload the args param
*/
public function setData( $args ) {
/**
* Set the user agent
- * @param $UA string
+ * @param string $UA
*/
public function setUserAgent( $UA ) {
$this->setHeader( 'User-Agent', $UA );
/**
* Set an arbitrary header
- * @param $name
- * @param $value
+ * @param string $name
+ * @param string $value
*/
public function setHeader( $name, $value ) {
// I feel like I should normalize the case here...
* bytes are reported handled than were passed to you, the HTTP fetch
* will be aborted.
*
- * @param $callback Callback
+ * @param callable $callback
* @throws MWException
*/
public function setCallback( $callback ) {
* A generic callback to read the body of the response from a remote
* server.
*
- * @param $fh handle
- * @param $content String
+ * @param resource $fh
+ * @param string $content
* @return int
*/
public function read( $fh, $content ) {
* (see RFC2616, section 10, http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
* for a list of status codes.)
*
- * @return Integer
+ * @return int
*/
public function getStatus() {
if ( !$this->respHeaders ) {
/**
* Returns true if the last status code was a redirect.
*
- * @return Boolean
+ * @return bool
*/
public function isRedirect() {
if ( !$this->respHeaders ) {
* (e.g. Set-Cookie) can appear more than once the, each value of
* the associative array is an array of the values given.
*
- * @return Array
+ * @return array
*/
public function getResponseHeaders() {
if ( !$this->respHeaders ) {
/**
* Returns the value of the given response header.
*
- * @param $header String
- * @return String
+ * @param string $header
+ * @return string
*/
public function getResponseHeader( $header ) {
if ( !$this->respHeaders ) {
/**
* Tells the MWHttpRequest object to use this pre-loaded CookieJar.
*
- * @param $jar CookieJar
+ * @param CookieJar $jar
*/
public function setCookieJar( $jar ) {
$this->cookieJar = $jar;
* cookies. Used internally after a request to parse the
* Set-Cookie headers.
* @see Cookie::set
- * @param $name
- * @param $value null
- * @param $attr null
+ * @param string $name
+ * @param mixed $value
+ * @param array $attr
*/
public function setCookie( $name, $value = null, $attr = null ) {
if ( !$this->cookieJar ) {
protected $headerText = "";
/**
- * @param $fh
- * @param $content
+ * @param resource $fh
+ * @param string $content
* @return int
*/
protected function readHeader( $fh, $content ) {
class PhpHttpRequest extends MWHttpRequest {
/**
- * @param $url string
+ * @param string $url
* @return string
*/
protected function urlToTcp( $url ) {
var $mExtraDescription = false;
/**
- * @param $title Title
+ * @param Title $title
* @return WikiFilePage
*/
protected function newPage( Title $title ) {
/**
* Constructor from a page id
- * @param int $id article ID to load
+ * @param int $id Article ID to load
* @return ImagePage|null
*/
public static function newFromID( $id ) {
}
/**
- * @param $file File:
+ * @param File $file
* @return void
*/
public function setFile( $file ) {
/**
* Create the TOC
*
- * @param $metadata Boolean: whether or not to show the metadata link
- * @return String
+ * @param bool $metadata Whether or not to show the metadata link
+ * @return string
*/
protected function showTOC( $metadata ) {
$r = array(
*
* @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
*
- * @param array $metadata the array containing the Exif data
- * @return String The metadata table. This is treated as Wikitext (!)
+ * @param array $metadata The array containing the Exif data
+ * @return string The metadata table. This is treated as Wikitext (!)
*/
protected function makeMetadataTable( $metadata ) {
$r = "<div class=\"mw-imagepage-section-metadata\">";
/**
* Creates an thumbnail of specified size and returns an HTML link to it
* @param array $params Scaler parameters
- * @param $width int
- * @param $height int
+ * @param int $width
+ * @param int $height
* @return string
*/
private function makeSizeLink( $params, $width, $height ) {
}
/**
- * @param $target
- * @param $limit
+ * @param string $target
+ * @param int $limit
* @return ResultWrapper
*/
protected function queryImageLinks( $target, $limit ) {
/**
* Display an error with a wikitext description
*
- * @param $description String
+ * @param string $description
*/
function showError( $description ) {
$out = $this->getContext()->getOutput();
* Callback for usort() to do link sorts by (namespace, title)
* Function copied from Title::compare()
*
- * @param $a object page to compare with
- * @param $b object page to compare with
- * @return Integer: result of string comparison, or namespace comparison
+ * @param object $a Object page to compare with
+ * @param object $b Object page to compare with
+ * @return int Result of string comparison, or namespace comparison
*/
protected function compare( $a, $b ) {
if ( $a->page_namespace == $b->page_namespace ) {
/**
* Returns the corresponding $wgImageLimits entry for the selected user option
*
- * @param $user User
+ * @param User $user
* @param string $optionName Name of a option to check, typically imagesize or thumbsize
* @return array
* @since 1.21
/**
* Output a drop-down box for language options for the file
*
- * @param Array $langChoices Array of string language codes
- * @param String $curLang Language code file is being viewed in.
- * @param String $defaultLang Language code that image is rendered in by default
- * @return String HTML to insert underneath image.
+ * @param array $langChoices Array of string language codes
+ * @param string $curLang Language code file is being viewed in.
+ * @param string $defaultLang Language code that image is rendered in by default
+ * @return string HTML to insert underneath image.
*/
protected function doRenderLangOpt( array $langChoices, $curLang, $defaultLang ) {
global $wgScript;
}
/**
- * @param $navLinks string
+ * @param string $navLinks
* @return string
*/
public function beginImageHistoryList( $navLinks = '' ) {
}
/**
- * @param $navLinks string
+ * @param string $navLinks
* @return string
*/
public function endImageHistoryList( $navLinks = '' ) {
}
/**
- * @param $iscur
- * @param $file File
+ * @param bool $iscur
+ * @param File $file
* @return string
*/
public function imageHistoryLine( $iscur, $file ) {
}
/**
- * @param $file File
+ * @param File $file
* @return string
*/
protected function getThumbForLine( $file ) {
}
/**
- * @param $enable bool
+ * @param bool $enable
*/
protected function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;
}
/**
- * @param $row object
+ * @param object $row
* @return string
*/
function formatRow( $row ) {
}
/**
- * @param $enable bool
+ * @param bool $enable
*/
protected function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;
* Get a fully-qualified path for a source file relative to $IP.
* @deprecated since 1.22
*
- * @param $file string
+ * @param string $file
*
* @return string
*/
/**
* @deprecated since 1.22
- * @param $file string
+ * @param string $file
* @return string
*/
static function compiledPath( $file ) {
/**
* @deprecated since 1.22
- * @param $file string
+ * @param string $file
* @return string
*/
static function extCompiledPath( $file ) {
* Deprecated wrapper for class_exists()
* @deprecated since 1.22
*
- * @param $class string
+ * @param string $class
*
* @return bool
*/
* Deprecated wrapper for method_exists()
* @deprecated since 1.22
*
- * @param $class string
- * @param $method string
+ * @param string $class
+ * @param string $method
*
* @return bool
*/
* Deprecated wrapper for function_exists()
* @deprecated since 1.22
*
- * @param $function string
+ * @param string $function
*
* @return bool
*/
* Deprecated wrapper for call_user_func_array()
* @deprecated since 1.22
*
- * @param $className string
- * @param $methodName string
- * @param $args array
+ * @param string $className
+ * @param string $methodName
+ * @param array $args
*
* @return mixed
*/
/**
* Constructor
*
- * @param $params array
+ * @param array $params
*/
public function __construct( $params ) {
parent::__construct( $params );
}
/**
- * @param $str
+ * @param string $str
* @return array
*/
protected function trimStars( $str ) {
}
/**
- * @param $list
- * @param $path
- * @param $item
+ * @param array $list
+ * @param array $path
+ * @param mixed $item
*/
protected function stackItem( &$list, $path, $item ) {
$position =& $list;
}
/**
- * @param $tagset
- * @param $depth int
+ * @param array $tagset
+ * @param int $depth
*/
protected function makeHtml( $tagset, $depth = 0 ) {
foreach ( $tagset as $key => $val ) {
}
/**
- * @param $message
- * @param $value
- * @param $attribs null
- * @param $depth int
+ * @param string $message
+ * @param string $value
+ * @param null|array $attribs
+ * @param int $depth
* @return string
*/
protected function outputOption( $message, $value, $attribs = null, $depth = 0 ) {
/**
* Accessor for $this->html
*
- * @param $value bool
+ * @param bool $value
*
* @return string
*/
/**
* Check whether $content contains a link to $filterEntry
*
- * @param $content Content: content to check
- * @param string $filterEntry domainparts, see makeRegex() for more details
- * @return Integer: 0 if no match or 1 if there's at least one match
+ * @param Content $content Content to check
+ * @param string $filterEntry Domainparts, see makeRegex() for more details
+ * @return int 0 if no match or 1 if there's at least one match
*/
static function matchEntry( Content $content, $filterEntry ) {
if ( !( $content instanceof TextContent ) ) {
*
* @param string $filterEntry URL, if it begins with "*.", it'll be
* replaced to match any subdomain
- * @return String: regex pattern, for preg_match()
+ * @return string Regex pattern, for preg_match()
*/
private static function makeRegex( $filterEntry ) {
$regex = '!http://';
* This function does the same as wfMakeUrlIndexes(), except it also takes care
* of adding wildcards
*
- * @param String $filterEntry domainparts
- * @param String $protocol protocol (default http://)
- * @return Array to be passed to DatabaseBase::buildLike() or false on error
+ * @param string $filterEntry Domainparts
+ * @param string $protocol Protocol (default http://)
+ * @return array Array to be passed to DatabaseBase::buildLike() or false on error
*/
public static function makeLikeArray( $filterEntry, $protocol = 'http://' ) {
$db = wfGetDB( DB_MASTER );
* Filters an array returned by makeLikeArray(), removing everything past first
* pattern placeholder.
*
- * @param array $arr array to filter
- * @return array filtered array
+ * @param array $arr Array to filter
+ * @return array Filtered array
*/
public static function keepOneWildcard( $arr ) {
if ( !is_array( $arr ) ) {
* Get the appropriate HTML attributes to add to the "a" element of an
* external link, as created by [wikisyntax].
*
- * @param string $class the contents of the class attribute; if an empty
+ * @param string $class The contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
* @return string
* @deprecated since 1.18 Just pass the external class directly to something using Html::expandAttributes
/**
* Get the appropriate HTML attributes to add to the "a" element of an interwiki link.
*
- * @param string $title the title text for the link, URL-encoded (???) but
+ * @param string $title The title text for the link, URL-encoded (???) but
* not HTML-escaped
- * @param string $unused unused
- * @param string $class the contents of the class attribute; if an empty
+ * @param string $unused Unused
+ * @param string $class The contents of the class attribute; if an empty
* string is passed, which is the default value, defaults to 'external'.
* @return string
*/
/**
* Get the appropriate HTML attributes to add to the "a" element of an internal link.
*
- * @param string $title the title text for the link, URL-encoded (???) but
+ * @param string $title The title text for the link, URL-encoded (???) but
* not HTML-escaped
- * @param string $unused unused
- * @param string $class the contents of the class attribute, default none
+ * @param string $unused Unused
+ * @param string $class The contents of the class attribute, default none
* @return string
*/
static function getInternalLinkAttributes( $title, $unused = null, $class = '' ) {
* Get the appropriate HTML attributes to add to the "a" element of an internal
* link, given the Title object for the page we want to link to.
*
- * @param $nt Title
+ * @param Title $nt
* @param string $unused Unused
* @param string $class The contents of the class attribute, default none
* @param string|bool $title Optional (unescaped) string to use in the title
/**
* Common code for getLinkAttributesX functions
*
- * @param $title string
- * @param $class string
+ * @param string $title
+ * @param string $class
*
* @return string
*/
/**
* Returns the Url used to link to a Title
*
- * @param $target Title
+ * @param Title $target
* @param array $query query parameters
- * @param $options Array
- * @return String
+ * @param array $options
+ * @return string
*/
private static function linkUrl( $target, $query, $options ) {
wfProfileIn( __METHOD__ );
/**
* Returns the array of attributes used when linking to the Title $target
*
- * @param $target Title
- * @param $attribs
- * @param $options
+ * @param Title $target
+ * @param array $attribs
+ * @param array $options
*
* @return array
*/
/**
* Default text of the links to the Title $target
*
- * @param $target Title
+ * @param Title $target
*
* @return string
*/
* as the bold link text. The calling sequence is the same as the other make*LinkObj static functions,
* despite $query not being used.
*
- * @param $nt Title
+ * @param Title $nt
* @param string $html [optional]
* @param string $query [optional]
* @param string $trail [optional]
* This should be called after a method like Title::makeTitleSafe() returned
* a value indicating that the title object is invalid.
*
- * @param $context IContextSource context to use to get the messages
+ * @param IContextSource $context Context to use to get the messages
* @param int $namespace Namespace number
* @param string $title Text of the title, without the namespace part
* @return string
}
/**
- * @param $title Title
+ * @param Title $title
* @return Title
*/
static function normaliseSpecialPage( Title $title ) {
* Returns the filename part of an url.
* Used as alternative text for external images.
*
- * @param $url string
+ * @param string $url
*
* @return string
*/
* Return the code for images which were added via external links,
* via Parser::maybeMakeExternalImage().
*
- * @param $url
- * @param $alt
+ * @param string $url
+ * @param string $alt
*
* @return string
*/
* Given parameters derived from [[Image:Foo|options...]], generate the
* HTML that that syntax inserts in the page.
*
- * @param $parser Parser object
- * @param $title Title object of the file (not the currently viewed page)
- * @param $file File object, or false if it doesn't exist
- * @param array $frameParams associative array of parameters external to the media handler.
+ * @param Parser $parser
+ * @param Title $title Title object of the file (not the currently viewed page)
+ * @param File $file File object, or false if it doesn't exist
+ * @param array $frameParams Associative array of parameters external to the media handler.
* Boolean parameters are indicated by presence or absence, the value is arbitrary and
* will often be false.
* thumbnail If present, downscale and frame
/**
* Make HTML for a thumbnail including image, border and caption
- * @param $title Title object
- * @param $file File object or false if it doesn't exist
- * @param $label String
- * @param $alt String
- * @param $align String
- * @param $params Array
- * @param $framed Boolean
- * @param $manualthumb String
- * @return mixed
+ * @param Title $title
+ * @param File|bool $file File object or false if it doesn't exist
+ * @param string $label
+ * @param string $alt
+ * @param string $align
+ * @param array $params
+ * @param bool $framed
+ * @param string $manualthumb
+ * @return string
*/
public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt,
$align = 'right', $params = array(), $framed = false, $manualthumb = ""
}
/**
- * @param $title Title
- * @param $file File
+ * @param Title $title
+ * @param File $file
* @param array $frameParams
* @param array $handlerParams
* @param bool $time
* @param string $query
- * @return mixed
+ * @return string
*/
public static function makeThumbLink2( Title $title, $file, $frameParams = array(),
$handlerParams = array(), $time = false, $query = ""
*
* @param File $file
* @param MediaTransformOutput $thumb
- * @param array $hp image parameters
+ * @param array $hp Image parameters
*/
public static function processResponsiveImages( $file, $thumb, $hp ) {
global $wgResponsiveImages;
* Make a "broken" link to an image
*
* @param Title $title
- * @param string $label link label (plain text)
- * @param string $query query string
+ * @param string $label Link label (plain text)
+ * @param string $query Query string
* @param string $unused1 Unused parameter kept for b/c
* @param string $unused2 Unused parameter kept for b/c
- * @param bool $time a file of a certain timestamp was requested
+ * @param bool $time A file of a certain timestamp was requested
* @return string
*/
public static function makeBrokenImageLinkObj( $title, $label = '', $query = '', $unused1 = '', $unused2 = '', $time = false ) {
* a message key from the link text.
* Usage example: Linker::specialLink( 'Recentchanges' )
*
+ * @param string $name
+ * @param string $key
* @return string
*/
public static function specialLink( $name, $key = '' ) {
* Generate a user link if the current user is allowed to view it
* @param Revision $rev
* @param bool $isPublic Show only if all users can see it
- * @return String HTML fragment
+ * @return string HTML fragment
*/
public static function revUserLink( $rev, $isPublic = false ) {
if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
* @param string $comment
* @param Title|null $title Title object (to generate link to the section in autocomment) or null
* @param bool $local Whether section links should refer to local page
- * @return mixed|String
+ * @return mixed|string
*/
public static function formatComment( $comment, $title = null, $local = false ) {
wfProfileIn( __METHOD__ );
/**
* Helper function for Linker::formatAutocomments
- * @param $match
+ * @param array $match
* @return string
*/
private static function formatAutocommentsCallback( $match ) {
}
/**
- * @param $match
+ * @param array $match
* @return mixed
*/
protected static function formatLinksInCommentCallback( $match ) {
}
/**
- * @param $contextTitle Title
- * @param $target
- * @param $text
+ * @param Title $contextTitle
+ * @param string $target
+ * @param string $text
* @return string
*/
public static function normalizeSubpageLink( $contextTitle, $target, &$text ) {
}
/**
- * @param $size
+ * @param int $size
* @return string
*/
public static function formatRevisionSize( $size ) {
/**
* Finish one or more sublevels on the Table of Contents
*
+ * @param int $level
* @return string
*/
public static function tocUnindent( $level ) {
/**
* parameter level defines if we are on an indentation level
*
+ * @param string $anchor
+ * @param string $tocline
+ * @param string $tocnumber
+ * @param string $level
+ * @param string|bool $sectionIndex
* @return string
*/
public static function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
* @param string $attribs Any attributes for the headline, starting with
* a space and ending with '>'
* This *must* be at least '>' for no attribs
- * @param string $anchor the anchor to give the headline (the bit after the #)
- * @param string $html html for the text of the header
+ * @param string $anchor The anchor to give the headline (the bit after the #)
+ * @param string $html Html for the text of the header
* @param string $link HTML to add for the section edit link
- * @param bool|string $legacyAnchor a second, optional anchor to give for
+ * @param bool|string $legacyAnchor A second, optional anchor to give for
* backward compatibility (false to omit)
*
* @return string HTML headline
/**
* Split a link trail, return the "inside" portion and the remainder of the trail
* as a two-element array
+ * @param string $trail
* @return array
*/
static function splitTrail( $trail ) {
*
* If the option noBrackets is set the rollback link wont be enclosed in []
*
- * @param $rev Revision object
- * @param $context IContextSource context to use or null for the main context.
- * @param $options array
+ * @param Revision $rev
+ * @param IContextSource $context Context to use or null for the main context.
+ * @param array $options
* @return string
*/
public static function generateRollback( $rev, IContextSource $context = null, $options = array( 'verify' ) ) {
* Returns null if $wgShowRollbackEditCount is disabled or false if $verify
* is set and the user is the only contributor of the page.
*
- * @param $rev Revision object
+ * @param Revision $rev
* @param bool $verify Try to verify that this revision can really be rolled back
- * @return integer|bool|null
+ * @return int|bool|null
*/
public static function getRollbackEditCount( $rev, $verify ) {
global $wgShowRollbackEditCount;
*
* @param array $hiddencats Array of hidden categories from Article::getHiddenCategories
* or similar
- * @return String HTML output
+ * @return string HTML output
*/
public static function formatHiddenCategories( $hiddencats ) {
wfProfileIn( __METHOD__ );
* unit (B, KB, MB or GB) according to the magnitude in question
*
* @param int $size Size to format
- * @return String
+ * @return string
*/
public static function formatSize( $size ) {
global $wgLang;
* element than the id, for reverse-compatibility, etc.)
*
* @param string $name Id of the element, minus prefixes.
- * @param string|null $options null or the string 'withaccess' to add an access-
+ * @param string|null $options Null or the string 'withaccess' to add an access-
* key hint
* @return string Contents of the title attribute (which you must HTML-
* escape), or false for no title attribute
*
* @param Title $nt The title object to make the link from, e.g. from Title::newFromText.
* @param string $text Link text
- * @param string $query optional query part
- * @param string $trail optional trail. Alphabetic characters at the start of this string will
+ * @param string $query Optional query part
+ * @param string $trail Optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
- * @param string $prefix optional prefix. As trail, only before instead of after.
+ * @param string $prefix Optional prefix. As trail, only before instead of after.
* @return string
*/
static function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
/**
* Returns the attributes for the tooltip and access key.
+ * @param string $name
* @return array
*/
public static function tooltipAndAccesskeyAttribs( $name ) {
/**
* Returns raw bits of HTML, use titleAttrib()
+ * @param string $name
+ * @param array|null $options
* @return null|string
*/
public static function tooltip( $name, $options = null ) {
* Set the timezone of this timestamp to the specified timezone.
*
* @since 1.22
- * @param String $timezone Timezone to set
+ * @param string $timezone Timezone to set
* @throws TimestampException
*/
public function setTimezone( $timezone ) {
/**
* Factory: creates an object representing an ID
*
- * @param $id
+ * @param int $id
*
* @return MagicWord
*/
/**
* Allow external reads of TTL array
*
- * @param $id int
+ * @param int $id
* @return array
*/
static function getCacheTTL( $id ) {
/**
* Initialises this object with an ID
*
- * @param $id
+ * @param int $id
* @throws MWException
*/
function load( $id ) {
* first string is longer, the same length or shorter than the second
* string.
*
- * @param $s1 string
- * @param $s2 string
+ * @param string $s1
+ * @param string $s2
*
* @return int
*/
/**
* Returns true if the text contains the word
*
- * @param $text string
+ * @param string $text
*
* @return bool
*/
/**
* Returns true if the text starts with the word
*
- * @param $text string
+ * @param string $text
*
* @return bool
*/
/**
* Returns true if the text matched the word
*
- * @param $text string
+ * @param string $text
*
* @return bool
* @since 1.23
* part in the regex and the matched variable part ($1) if there
* is one.
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
* Returns true if the text matches the word, and alters the
* input string, removing all instances of the word
*
- * @param $text string
+ * @param string $text
*
* @return bool
*/
}
/**
- * @param $text
+ * @param string $text
* @return bool
*/
function matchStartAndRemove( &$text ) {
/**
* Replaces the word with something else
*
- * @param $replacement
- * @param $subject
- * @param $limit int
+ * @param string $replacement
+ * @param string $subject
+ * @param int $limit
*
* @return string
*/
* Calls back a function to determine what to replace xxx with
* Input word must contain $1
*
- * @param $text string
- * @param $callback
+ * @param string $text
+ * @param callable $callback
*
* @return string
*/
/**
* Accesses the synonym list directly
*
- * @param $i int
+ * @param int $i
*
* @return string
*/
* $result. The return value is true if something was replaced.
* @todo Should this be static? It doesn't seem to be used at all
*
- * @param $magicarr
- * @param $subject
- * @param $result
+ * @param array $magicarr
+ * @param string $subject
+ * @param string $result
*
* @return bool
*/
* Adds all the synonyms of this MagicWord to an array, to allow quick
* lookup in a list of magic words
*
- * @param $array
- * @param $value
+ * @param array $array
+ * @param string $value
*/
function addToArray( &$array, $value ) {
global $wgContLang;
var $matches;
/**
- * @param $names array
+ * @param array $names
*/
function __construct( $names = array() ) {
$this->names = $names;
/**
* Add a magic word by name
*
- * @param $name string
+ * @param string $name
*/
public function add( $name ) {
$this->names[] = $name;
/**
* Add a number of magic words by name
*
- * @param $names array
+ * @param array $names
*/
public function addArray( $names ) {
$this->names = array_merge( $this->names, array_values( $names ) );
* Returns array(magic word ID, parameter value)
* If there is no parameter value, that element will be false.
*
- * @param $m array
+ * @param array $m
*
* @throws MWException
* @return array
* parameter in the second element.
* Both elements are false if there was no match.
*
- * @param $text string
+ * @param string $text
*
* @return array
*/
* Match some text, without parameter capture
* Returns the magic word name, or false if there was no capture
*
- * @param $text string
+ * @param string $text
*
* @return string|bool False on failure
*/
* Returns an associative array, ID => param value, for all items that match
* Removes the matched items from the input string (passed by reference)
*
- * @param $text string
+ * @param string $text
*
* @return array
*/
* Return false if no match found and $text is not modified.
* Does not match parameters.
*
- * @param $text string
+ * @param string $text
*
* @return int|bool False on failure
*/
*
* @since 1.22
*
- * @param number|number[] [$param,...] Time period parameters, or a single argument that is
+ * @param int|int[] [$param,...] Time period parameters, or a single argument that is
* an array of time period parameters.
*
* @return Message $this
*
* @since 1.19
*
- * @param $context IContextSource
+ * @param IContextSource $context
*
* @return Message $this
*/
*
* @since 1.18
*
- * @param $title Title object
+ * @param Title $title
*
* @return Message $this
*/
* @param string $message The message text.
* @param string $type Either "before" or "after".
*
- * @return String
+ * @return string
*/
protected function replaceParameters( $message, $type = 'before' ) {
$replacementKeys = array();
/**
* Get the message blobs for a set of modules
*
- * @param $resourceLoader ResourceLoader object
+ * @param ResourceLoader $resourceLoader
* @param array $modules Array of module objects keyed by module name
* @param string $lang Language code
* @return array An array mapping module names to message blobs
* present, it is not regenerated; instead, the preexisting blob
* is fetched and returned.
*
- * @param string $name module name
- * @param $module ResourceLoaderModule object
- * @param string $lang language code
+ * @param string $name Module name
+ * @param ResourceLoaderModule $module
+ * @param string $lang Language code
* @return mixed Message blob or false if the module has no messages
*/
public static function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) {
/**
* Update the message blob for a given module in a given language
*
- * @param string $name module name
- * @param $module ResourceLoaderModule object
- * @param string $lang language code
- * @return String Regenerated message blob, or null if there was no blob for the given module/language pair
+ * @param string $name Module name
+ * @param ResourceLoaderModule $module
+ * @param string $lang Language code
+ * @return string Regenerated message blob, or null if there was no blob for the given module/language pair
*/
public static function updateModule( $name, ResourceLoaderModule $module, $lang ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Update a single message in all message blobs it occurs in.
*
- * @param string $key message key
+ * @param string $key Message key
*/
public static function updateMessage( $key ) {
try {
/**
* Create an update queue for updateMessage()
*
- * @param string $key message key
- * @param array $prevUpdates updates queue to refresh or null to build a fresh update queue
- * @return Array: updates queue
+ * @param string $key Message key
+ * @param array $prevUpdates Updates queue to refresh or null to build a fresh update queue
+ * @return array Updates queue
*/
private static function getUpdatesForMessage( $key, $prevUpdates = null ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Reencode a message blob with the updated value for a message
*
- * @param string $blob message blob (JSON object)
- * @param string $key message key
- * @param string $lang language code
- * @return Message blob with $key replaced with its new value
+ * @param string $blob Message blob (JSON object)
+ * @param string $key Message key
+ * @param string $lang Language code
+ * @return string Message blob with $key replaced with its new value
*/
private static function reencodeBlob( $blob, $key, $lang ) {
$decoded = FormatJson::decode( $blob, true );
* Get the message blobs for a set of modules from the database.
* Modules whose blobs are not in the database are silently dropped.
*
- * @param $resourceLoader ResourceLoader object
- * @param array $modules of module names
- * @param string $lang language code
+ * @param ResourceLoader $resourceLoader
+ * @param array $modules Array of module names
+ * @param string $lang Language code
* @throws MWException
* @return array Array mapping module names to blobs
*/
/**
* Generate the message blob for a given module in a given language.
*
- * @param $module ResourceLoaderModule object
- * @param string $lang language code
- * @return String: JSON object
+ * @param ResourceLoaderModule $module
+ * @param string $lang Language code
+ * @return string JSON object
*/
private static function generateMessageBlob( ResourceLoaderModule $module, $lang ) {
$messages = array();
* separated string or null if the mime type was unrecognized. Resolves
* mime type aliases.
*
- * @param $mime string
+ * @param string $mime
* @return string|null
*/
public function getExtensionsForType( $mime ) {
* Returns a list of mime types for a given file extension as a space
* separated string or null if the extension was unrecognized.
*
- * @param $ext string
+ * @param string $ext
* @return string|null
*/
public function getTypesForExtension( $ext ) {
* Returns a single mime type for a given file extension or null if unknown.
* This is always the first type from the list returned by getTypesForExtension($ext).
*
- * @param $ext string
+ * @param string $ext
* @return string|null
*/
public function guessTypesForExtension( $ext ) {
* match was found, null if the mime type is unknown, and false if the
* mime type is known but no matches where found.
*
- * @param $extension string
- * @param $mime string
+ * @param string $extension
+ * @param string $mime
* @return bool|null
*/
public function isMatchingExtension( $extension, $mime ) {
* Returns true if the mime type is known to represent an image format
* supported by the PHP GD library.
*
- * @param $mime string
+ * @param string $mime
*
* @return bool
*/
*
* @todo Be more accurate when using fancy mime detector plugins;
* right now this is the bare minimum getimagesize() list.
+ * @param string $extension
* @return bool
*/
function isRecognizableExtension( $extension ) {
* If $mime is "application/x-opc+zip" and isMatchingExtension( $ext, $mime )
* gives true, return the result of guessTypesForExtension($ext).
*
- * @param string $mime the mime type, typically guessed from a file's content.
- * @param string $ext the file extension, as taken from the file name
+ * @param string $mime The mime type, typically guessed from a file's content.
+ * @param string $ext The file extension, as taken from the file name
*
- * @return string the mime type
+ * @return string The mime type
*/
public function improveTypeFromExtension( $mime, $ext ) {
if ( $mime === 'unknown/unknown' ) {
* detection (namely XML based formats like XHTML or SVG, as well as ZIP
* based formats like OPC/ODF files).
*
- * @param string $file the file to check
+ * @param string $file The file to check
* @param string|bool $ext The file extension, or true (default) to extract it from the filename.
* Set it to false to ignore the extension. DEPRECATED! Set to false, use
* improveTypeFromExtension($mime, $ext) later to improve mime type.
*
- * @return string the mime type of $file
+ * @return string The mime type of $file
*/
public function guessMimeType( $file, $ext = true ) {
if ( $ext ) { // TODO: make $ext default to false. Or better, remove it.
* Set it to false to ignore the extension. DEPRECATED! Set to false, use
* improveTypeFromExtension($mime, $ext) later to improve mime type.
*
- * @return string the mime type of $file
+ * @return string The mime type of $file
*/
private function detectMimeType( $file, $ext = true ) {
global $wgMimeDetectorCommand;
* @todo analyse file if need be
* @todo look at multiple extension, separately and together.
*
- * @param string $path full path to the image file, in case we have to look at the contents
+ * @param string $path Full path to the image file, in case we have to look at the contents
* (if null, only the mime type is used to determine the media type code).
- * @param string $mime mime type. If null it will be guessed using guessMimeType.
+ * @param string $mime Mime type. If null it will be guessed using guessMimeType.
*
- * @return (int?string?) a value to be used with the MEDIATYPE_xxx constants.
+ * @return string A value to be used with the MEDIATYPE_xxx constants.
*/
function getMediaType( $path = null, $mime = null ) {
if ( !$mime && !$path ) {
*
* This function relies on the mapping defined by $this->mMediaTypes
* @access private
+ * @param string $extMime
* @return int|string
*/
function findMediaType( $extMime ) {
* Get the MIME types that various versions of Internet Explorer would
* detect from a chunk of the content.
*
- * @param string $fileName the file name (unused at present)
- * @param string $chunk the first 256 bytes of the file
- * @param string $proposed the MIME type proposed by the server
- * @return Array
+ * @param string $fileName The file name (unused at present)
+ * @param string $chunk The first 256 bytes of the file
+ * @param string $proposed The MIME type proposed by the server
+ * @return array
*/
public function getIEMimeTypes( $fileName, $chunk, $proposed ) {
$ca = $this->getIEContentAnalyzer();
* Special namespaces are defined in includes/Defines.php and have
* a value below 0 (ex: NS_SPECIAL = -1 , NS_MEDIA = -2)
*
- * @param $index
- * @param $method
+ * @param int $index
+ * @param string $method
*
* @throws MWException
* @return bool
/**
* Can pages in the given namespace be moved?
*
- * @param int $index namespace index
+ * @param int $index Namespace index
* @return bool
*/
public static function isMovable( $index ) {
/**
* Is the given namespace is a subject (non-talk) namespace?
*
- * @param int $index namespace index
+ * @param int $index Namespace index
* @return bool
* @since 1.19
*/
/**
* Is the given namespace a talk namespace?
*
- * @param int $index namespace index
+ * @param int $index Namespace index
* @return bool
*/
public static function isTalk( $index ) {
/**
* Get the talk namespace index for a given namespace
*
- * @param int $index namespace index
+ * @param int $index Namespace index
* @return int
*/
public static function getTalk( $index ) {
* For talk namespaces, returns the subject (non-talk) namespace
* For subject (non-talk) namespaces, returns the talk namespace
*
- * @param int $index namespace index
- * @return int or null if no associated namespace could be found
+ * @param int $index Namespace index
+ * @return int|null If no associated namespace could be found
*/
public static function getAssociated( $index ) {
self::isMethodValidFor( $index, __METHOD__ );
/**
* Returns whether the specified namespace exists
*
- * @param $index
+ * @param int $index
*
* @return bool
* @since 1.19
* Returns array of all defined namespaces with their canonical
* (English) names.
*
- * @param bool $rebuild rebuild namespace list (default = false). Used for testing.
+ * @param bool $rebuild Rebuild namespace list (default = false). Used for testing.
*
* @return array
* @since 1.17
/**
* Returns the canonical (English) name for a given index
*
- * @param int $index namespace index
- * @return string or false if no canonical definition.
+ * @param int $index Namespace index
+ * @return string|false If no canonical definition.
*/
public static function getCanonicalName( $index ) {
$nslist = self::getCanonicalNamespaces();
* Returns the index for a given canonical name, or NULL
* The input *must* be converted to lower case first
*
- * @param string $name namespace name
+ * @param string $name Namespace name
* @return int
*/
public static function getCanonicalIndex( $name ) {
/**
* Can this namespace ever have a talk namespace?
*
- * @param int $index namespace index
+ * @param int $index Namespace index
* @return bool
*/
public static function canTalk( $index ) {
* Does this namespace contain content, for the purposes of calculating
* statistics, etc?
*
- * @param int $index index to check
+ * @param int $index Index to check
* @return bool
*/
public static function isContent( $index ) {
/**
* Can pages in a namespace be watched?
*
- * @param $index Int
+ * @param int $index
* @return bool
*/
public static function isWatchable( $index ) {
/**
* Get a list of all namespace indices which are considered to contain content
- * @return array of namespace indices
+ * @return array Array of namespace indices
*/
public static function getContentNamespaces() {
global $wgContentNamespaces;
* List all namespace indices which are considered subject, aka not a talk
* or special namespace. See also MWNamespace::isSubject
*
- * @return array of namespace indices
+ * @return array Array of namespace indices
*/
public static function getSubjectNamespaces() {
return array_filter(
* List all namespace indices which are considered talks, aka not a subject
* or special namespace. See also MWNamespace::isTalk
*
- * @return array of namespace indices
+ * @return array Array of namespace indices
*/
public static function getTalkNamespaces() {
return array_filter(
*
* @since 1.21
* @param int $index Index to check
- * @return null|string default model name for the given namespace, if set
+ * @return null|string Default model name for the given namespace, if set
*/
public static function getNamespaceContentModel( $index ) {
global $wgNamespaceContentModels;
/**
* Standard output handler for use with ob_start
*
- * @param $s string
+ * @param string $s
*
* @return string
*/
* Handler that compresses data with gzip if allowed by the Accept header.
* Unlike ob_gzhandler, it works for HEAD requests too.
*
- * @param $s string
+ * @param string $s
*
* @return string
*/
/**
* Mangle flash policy tags which open up the site to XSS attacks.
*
- * @param $s string
+ * @param string $s
*
* @return string
*/
/**
* Add a Content-Length header if possible. This makes it cooperate with squid better.
*
- * @param $length int
+ * @param int $length
*/
function wfDoContentLength( $length ) {
if ( !headers_sent() && isset( $_SERVER['SERVER_PROTOCOL'] ) && $_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0' ) {
/**
* Replace the output with an error if the HTML is not valid
*
- * @param $s string
+ * @param string $s
*
* @return string
*/
* like page existence and information for stub color and redirect hints.
* This should be done for live data and cached data.
*
- * @param $db DatabaseBase connection
+ * @param DatabaseBase $db
* @param ResultWrapper $res
*/
public function preprocessResults( $db, $res ) {
/**
* Set the offset from an other source than the request
*
- * @param $offset Int|String
+ * @param int|string $offset
*/
function setOffset( $offset ) {
$this->mOffset = $offset;
*
* Verifies limit is between 1 and 5000
*
- * @param $limit Int|String
+ * @param int|string $limit
*/
function setLimit( $limit ) {
$limit = (int)$limit;
* in the result or not. By default this is not the case, but when the
* offset is user-supplied this might be wanted.
*
- * @param $include bool
+ * @param bool $include
*/
public function setIncludeOffset( $include ) {
$this->mIncludeOffset = $include;
* Extract some useful data from the result object for use by
* the navigation bar, put it into $this
*
- * @param $isFirst bool: False if there are rows before those fetched (i.e.
+ * @param bool $isFirst False if there are rows before those fetched (i.e.
* if a "previous" link would make sense)
- * @param $limit Integer: exact query limit
- * @param $res ResultWrapper
+ * @param int $limit Exact query limit
+ * @param ResultWrapper $res
*/
function extractResultInfo( $isFirst, $limit, ResultWrapper $res ) {
$numRows = $res->numRows();
/**
* Get some text to go in brackets in the "function name" part of the SQL comment
*
- * @return String
+ * @return string
*/
function getSqlComment() {
return get_class( $this );
* Do a query with specified parameters, rather than using the object
* context
*
- * @param string $offset index offset, inclusive
- * @param $limit Integer: exact query limit
- * @param $descending Boolean: query direction, false for ascending, true for descending
+ * @param string $offset Index offset, inclusive
+ * @param int $limit Exact query limit
+ * @param bool $descending Query direction, false for ascending, true for descending
* @return ResultWrapper
*/
public function reallyDoQuery( $offset, $limit, $descending ) {
/**
* Build variables to use by the database wrapper.
*
- * @param string $offset index offset, inclusive
- * @param $limit Integer: exact query limit
- * @param $descending Boolean: query direction, false for ascending, true for descending
+ * @param string $offset Index offset, inclusive
+ * @param int $limit Exact query limit
+ * @param bool $descending Query direction, false for ascending, true for descending
* @return array
*/
protected function buildQueryInfo( $offset, $limit, $descending ) {
/**
* Pre-process results; useful for performing batch existence checks, etc.
*
- * @param $result ResultWrapper
+ * @param ResultWrapper $result
*/
protected function preprocessResults( $result ) {}
* Get the formatted result list. Calls getStartBody(), formatRow() and
* getEndBody(), concatenates the results and returns them.
*
- * @return String
+ * @return string
*/
public function getBody() {
if ( !$this->mQueryDone ) {
/**
* Make a self-link
*
- * @param string $text text displayed on the link
- * @param array $query associative array of parameter to be in the query string
- * @param string $type value of the "rel" attribute
+ * @param string $text Text displayed on the link
+ * @param array $query Associative array of parameter to be in the query string
+ * @param string $type Value of the "rel" attribute
*
- * @return String: HTML fragment
+ * @return string HTML fragment
*/
function makeLink( $text, array $query = null, $type = null ) {
if ( $query === null ) {
* Hook into getBody(), allows text to be inserted at the start. This
* will be called even if there are no rows in the result set.
*
- * @return String
+ * @return string
*/
protected function getStartBody() {
return '';
/**
* Hook into getBody() for the end of the list
*
- * @return String
+ * @return string
*/
protected function getEndBody() {
return '';
* Hook into getBody(), for the bit between the start and the
* end when there are no rows
*
- * @return String
+ * @return string
*/
protected function getEmptyBody() {
return '';
/**
* Get the number of rows in the result set
*
- * @return Integer
+ * @return int
*/
function getNumRows() {
if ( !$this->mQueryDone ) {
/**
* Get a URL query array for the prev, next, first and last links.
*
- * @return Array
+ * @return array
*/
function getPagingQueries() {
if ( !$this->mQueryDone ) {
/**
* Returns whether to show the "navigation bar"
*
- * @return Boolean
+ * @return bool
*/
function isNavigationBarShown() {
if ( !$this->mQueryDone ) {
* $linkTexts will be used. Both $linkTexts and $disabledTexts are arrays
* of HTML.
*
- * @param $linkTexts Array
- * @param $disabledTexts Array
- * @return Array
+ * @param array $linkTexts
+ * @param array $disabledTexts
+ * @return array
*/
function getPagingLinks( $linkTexts, $disabledTexts = array() ) {
$queries = $this->getPagingQueries();
* options => option array
* join_conds => JOIN conditions
*
- * @return Array
+ * @return array
*/
abstract function getQueryInfo();
* Needless to say, it's really not a good idea to use a non-unique index
* for this! That won't page right.
*
- * @return string|Array
+ * @return string|array
*/
abstract function getIndexField();
* page_len,page_id avoids temp tables (given a page_len index). This would
* also work if page_id was non-unique but we had a page_len,page_id index.
*
- * @return Array
+ * @return array
*/
protected function getExtraSortFields() {
return array();
* particular instantiation, which is a single value. This is the set of
* all defaults for the class.
*
- * @return Boolean
+ * @return bool
*/
protected function getDefaultDirections() {
return false;
* Shamelessly stolen bits from ReverseChronologicalPager,
* didn't want to do class magic as may be still revamped
*
- * @return String HTML
+ * @return string HTML
*/
function getNavigationBar() {
if ( !$this->isNavigationBarShown() ) {
* array whose keys must exactly match the keys of the array returned
* by getIndexField(), and whose values are message keys.
*
- * @return Array
+ * @return array
*/
protected function getOrderTypeMessages() {
return null;
/**
* @protected
* @param stdClass $row
- * @return String HTML
+ * @return string HTML
*/
function formatRow( $row ) {
$this->mCurrentRow = $row; // In case formatValue etc need to know
*
* @protected
*
- * @param $row Object: the database result row
- * @return String
+ * @param object $row The database result row
+ * @return string
*/
function getRowClass( $row ) {
return '';
*
* @protected
*
- * @param $row Object: the database result row
- * @return Array of attribute => value
+ * @param object $row The database result row
+ * @return array Array of attribute => value
*/
function getRowAttrs( $row ) {
$class = $this->getRowClass( $row );
*
* @param string $field The column
* @param string $value The cell contents
- * @return Array of attr => value
+ * @return array Array of attr => value
*/
function getCellAttrs( $field, $value ) {
return array( 'class' => 'TablePager_col_' . $field );
/**
* A navigation bar with images
- * @return String HTML
+ * @return string HTML
*/
public function getNavigationBar() {
global $wgStylePath;
/**
* Get a "<select>" element which has options for each of the allowed limits
*
- * @param $attribs String: Extra attributes to set
- * @return String: HTML fragment
+ * @param string $attribs Extra attributes to set
+ * @return string HTML fragment
*/
public function getLimitSelect( $attribs = array() ) {
$select = new XmlSelect( 'limit', false, $this->mLimit );
* Resubmits all defined elements of the query string, except for a
* blacklist, passed in the $blacklist parameter.
*
- * @param array $blacklist parameters from the request query which should not be resubmitted
- * @return String: HTML fragment
+ * @param array $blacklist Parameters from the request query which should not be resubmitted
+ * @return string HTML fragment
*/
function getHiddenFields( $blacklist = array() ) {
$blacklist = (array)$blacklist;
/**
* Get a form containing a limit selection dropdown
*
- * @return String: HTML fragment
+ * @return string HTML fragment
*/
function getLimitForm() {
global $wgScript;
* Return true if the named field should be sortable by the UI, false
* otherwise
*
- * @param $field String
+ * @param string $field
*/
abstract function isFieldSortable( $field );
*
* @protected
*
- * @param string $name the database field name
- * @param string $value the value retrieved from the database
+ * @param string $name The database field name
+ * @param string $value The value retrieved from the database
*/
abstract function formatValue( $name, $value );
* field name, for use in the table header. The description should be plain
* text, it will be HTML-escaped later.
*
- * @return Array
+ * @return array
*/
abstract function getFieldNames();
}
* This is in a separate method so that add() can handle the difference between
* a single string $path and an array() $path that contains multiple path
* patterns each with an associated $key to pass on.
- * @param $path string
- * @param $params array
- * @param $options array
- * @param $key null|string
+ * @param string $path
+ * @param array $params
+ * @param array $options
+ * @param null|string $key
*/
protected function doAdd( $path, $params, $options, $key = null ) {
// Make sure all paths start with a /
/**
* Add a new path pattern to the path router with the strict option on
* @see self::add
- * @param $path string|array
- * @param $params array
- * @param $options array
+ * @param string|array $path
+ * @param array $params
+ * @param array $options
*/
public function addStrict( $path, $params = array(), $options = array() ) {
$options['strict'] = true;
}
/**
- * @param $pattern object
+ * @param object $pattern
* @return float|int
*/
protected static function makeWeight( $pattern ) {
* Parse a path and return the query matches for the path
*
* @param string $path The path to parse
- * @return Array The array of matches for the path
+ * @return array The array of matches for the path
*/
public function parse( $path ) {
// Make sure our patterns are sorted by weight so the most specific
}
/**
- * @param $path string
- * @param $pattern string
+ * @param string $path
+ * @param string $pattern
* @return array|null
*/
protected static function extractTitle( $path, $pattern ) {
* We do this inside of a replacement callback because after replacement we can't tell the
* difference between a $1 that was not replaced and a $1 that was part of
* the content a $1 was replaced with.
- * @param $value string
+ * @param string $value
* @return string
*/
public function replace( $value ) {
}
/**
- * @param $m array
+ * @param array $m
* @return string
*/
protected function callback( $m ) {
* Do a prefix search of titles and return a list of matching page names.
* @deprecated: Since 1.23, use TitlePrefixSearch or StringPrefixSearch classes
*
- * @param $search String
- * @param $limit Integer
- * @param array $namespaces used if query is not explicitly prefixed
- * @return Array of strings
+ * @param string $search
+ * @param int $limit
+ * @param array $namespaces Used if query is not explicitly prefixed
+ * @return array Array of strings
*/
public static function titleSearch( $search, $limit, $namespaces = array() ) {
$prefixSearch = new StringPrefixSearch;
/**
* Do a prefix search of titles and return a list of matching page names.
*
- * @param $search String
- * @param $limit Integer
- * @param array $namespaces used if query is not explicitly prefixed
- * @return Array of strings or Title objects
+ * @param string $search
+ * @param int $limit
+ * @param array $namespaces Used if query is not explicitly prefixed
+ * @return array Array of strings or Title objects
*/
public function search( $search, $limit, $namespaces = array() ) {
$search = trim( $search );
/**
* Do a prefix search for all possible variants of the prefix
- * @param $search String
- * @param $limit Integer
+ * @param string $search
+ * @param int $limit
* @param array $namespaces
*
* @return array
/**
* Do a prefix search of titles and return a list of matching page names.
- * @param $namespaces Array
- * @param $search String
- * @param $limit Integer
- * @return Array of strings
+ * @param array $namespaces
+ * @param string $search
+ * @param int $limit
+ * @return array Array of strings
*/
protected function searchBackend( $namespaces, $search, $limit ) {
if ( count( $namespaces ) == 1 ) {
/**
* Prefix search special-case for Special: namespace.
*
- * @param string $search term
- * @param $limit Integer: max number of items to return
- * @return Array
+ * @param string $search Term
+ * @param int $limit Max number of items to return
+ * @return array
*/
protected function specialSearch( $search, $limit ) {
global $wgContLang;
* be automatically capitalized by Title::secureAndSpit()
* later on depending on $wgCapitalLinks)
*
- * @param array $namespaces namespaces to search in
- * @param string $search term
- * @param $limit Integer: max number of items to return
- * @return Array of Title objects
+ * @param array $namespaces Namespaces to search in
+ * @param string $search Term
+ * @param int $limit Max number of items to return
+ * @return array Array of Title objects
*/
protected function defaultSearchBackend( $namespaces, $search, $limit ) {
$ns = array_shift( $namespaces ); // support only one namespace
/**
* Validate an array of numerical namespace indexes
*
- * @param $namespaces Array
- * @return Array (default: contains only NS_MAIN)
+ * @param array $namespaces
+ * @return array (default: contains only NS_MAIN)
*/
protected function validateNamespaces( $namespaces ) {
global $wgContLang;
/**
* Get the expiry time for a given action, by combining the relevant inputs.
*
- * @param $action string
+ * @param string $action
*
* @return string 14-char timestamp or "infinity", or false if the input was invalid
*/
/**
* Show the input form with optional error message
*
- * @param string $err error message or null if there's no error
+ * @param string $err Error message or null if there's no error
*/
function show( $err = null ) {
global $wgOut;
/**
* Save submitted protection form
*
- * @return Boolean: success
+ * @return bool Success
*/
function save() {
global $wgRequest, $wgUser, $wgOut;
/**
* Build the input form
*
- * @return String: HTML form
+ * @return string HTML form
*/
function buildForm() {
global $wgUser, $wgLang, $wgOut;
/**
* Build protection level selector
*
- * @param string $action action to protect
- * @param string $selected current protection level
- * @return String: HTML fragment
+ * @param string $action Action to protect
+ * @param string $selected Current protection level
+ * @return string HTML fragment
*/
function buildSelector( $action, $selected ) {
global $wgUser;
/**
* Prepare the label for a protection selector option
*
- * @param string $permission permission required
- * @return String
+ * @param string $permission Permission required
+ * @return string
*/
private function getOptionLabel( $permission ) {
if ( $permission == '' ) {
/**
* Show protection long extracts for this page
*
- * @param $out OutputPage
+ * @param OutputPage $out
* @access private
*/
function showLogExtract( &$out ) {
/**
* Get a DB connection to be used for slow recache queries
+ * @return DatabaseBase
*/
function getRecacheDB() {
return wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
}
/**
- * @param $offset
+ * @param int $offset
* @return string
*/
function openList( $offset ) {
/**
* Construct a revision list for a given title
- * @param $context IContextSource
- * @param $title Title
+ * @param IContextSource $context
+ * @param Title $title
*/
function __construct( IContextSource $context, Title $title ) {
$this->setContext( $context );
/**
* Select items only where the ID is any of the specified values
- * @param $ids Array
+ * @param array $ids
*/
function filterByIds( array $ids ) {
$this->ids = $ids;
/**
* Start iteration. This must be called before current() or next().
- * @return First list item
+ * @return Revision First list item
*/
public function reset() {
if ( !$this->res ) {
/**
* Get the current list item, or false if we are at the end
+ * @return Revision
*/
public function current() {
return $this->current;
/**
* Move the iteration pointer to the next list item, and return it.
+ * @return Revision
*/
public function next() {
$this->res->next();
/**
* Do the DB query to iterate through the objects.
- * @param $db DatabaseBase object to use for the query
+ * @param DatabaseBase $db DatabaseBase object to use for the query
*/
abstract public function doQuery( $db );
/**
* Create an item object from a DB result row
- * @param $row stdclass
+ * @param object $row
*/
abstract public function newItem( $row );
}
var $row;
/**
- * @param $list RevisionListBase
- * @param $row DB result row
+ * @param RevisionListBase $list
+ * @param object $row DB result row
*/
public function __construct( $list, $row ) {
$this->list = $list;
/**
* Get the ID, as it would appear in the ids URL parameter
- * @return
+ * @return int
*/
public function getId() {
$field = $this->getIdField();
/**
* Get the date, formatted in user's language
- * @return String
+ * @return string
*/
public function formatDate() {
return $this->list->getLanguage()->userDate( $this->getTimestamp(),
/**
* Get the time, formatted in user's language
- * @return String
+ * @return string
*/
public function formatTime() {
return $this->list->getLanguage()->userTime( $this->getTimestamp(),
/**
* Get the timestamp in MW 14-char form
- * @return Mixed
+ * @return mixed
*/
public function getTimestamp() {
$field = $this->getTimestampField();
}
/**
- * @param $db DatabaseBase
+ * @param DatabaseBase $db
* @return mixed
*/
public function doQuery( $db ) {
* HTML5 definition of id attribute
*
* @param string $id id to escape
- * @param $options Mixed: string or array of strings (default is array()):
+ * @param string|array $options String or array of strings (default is array()):
* 'noninitial': This is a non-initial fragment of an id, not a full id,
* so don't pay attention if the first character isn't valid at the
* beginning of an id. Only matters if $wgExperimentalHtmlIds is
* This allows (generally harmless) entities like   to survive.
*
* @param string $html HTML to escape
- * @return string: escaped input
+ * @return string Escaped input
*/
static function escapeHtmlAllowEntities( $html ) {
$html = Sanitizer::decodeCharReferences( $html );
* @param string $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in all returned data.
* @param array $wikiTags The tags assigned to the wiki.
- * @return Mixed the value of the setting requested.
+ * @return mixed The value of the setting requested.
*/
public function get( $settingName, $wiki, $suffix = null, $params = array(), $wikiTags = array() ) {
$params = $this->mergeParams( $wiki, $suffix, $params, $wikiTags );
*
* @param string $settingName ID of the setting name to retrieve.
* @param string $wiki Wiki ID of the wiki in question.
- * @param array $params array of parameters.
- * @return Mixed the value of the setting requested.
+ * @param array $params Array of parameters.
+ * @return mixed The value of the setting requested.
*/
protected function getSetting( $settingName, $wiki, /*array*/ $params ) {
$retval = null;
* Type-safe string replace; won't do replacements on non-strings
* private?
*
- * @param $from
- * @param $to
- * @param $in
+ * @param string $from
+ * @param string $to
+ * @param string|array $in
* @return string
*/
function doReplace( $from, $to, $in ) {
* @param string $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in all returned data.
* @param array $wikiTags The tags assigned to the wiki.
- * @return Array Array of settings requested.
+ * @return array Array of settings requested.
*/
public function getAll( $wiki, $suffix = null, $params = array(), $wikiTags = array() ) {
$params = $this->mergeParams( $wiki, $suffix, $params, $wikiTags );
}
/**
- * @param $setting string
- * @param $wiki string
- * @param $params array
+ * @param string $setting
+ * @param string $wiki
+ * @param array $params
*/
public function extractGlobalSetting( $setting, $wiki, $params ) {
$value = $this->getSetting( $setting, $wiki, $params );
* See the documentation of self::$siteParamsCallback for more in-depth
* documentation about this function
*
- * @param $wiki String
+ * @param string $wiki
* @return array
*/
protected function getWikiParams( $wiki ) {
* @param string $wiki Wiki ID of the wiki in question.
* @param string $suffix The suffix of the wiki in question.
* @param array $params List of parameters. $.'key' is replaced by $value in
- * all returned data.
+ * all returned data.
* @param array $wikiTags The tags assigned to the wiki.
* @return array
*/
/**
* Work out the site and language name from a database name
- * @param $db
+ * @param string $db
*
* @return array
*/
*
* @param string $wiki
* @param array|string $settings A setting name or array of setting names
- * @return Array|mixed Array if $settings is an array, otherwise the value
+ * @return array|mixed Array if $settings is an array, otherwise the value
* @throws MWException
* @since 1.21
*/
/**
* Returns true if the given vhost is handled locally.
- * @param $vhost String
+ * @param string $vhost
* @return bool
*/
public function isLocalVHost( $vhost ) {
* PHP's array_merge_recursive() merges ANY duplicate values into arrays,
* which is not fun
*
- * @param $array1 array
+ * @param array $array1
*
* @return array
*/
}
/**
- * @param $recache bool
+ * @param bool $recache
*/
static function load( $recache = false ) {
if ( self::$loaded && !$recache ) {
}
/**
- * @return Bool|ResultWrapper
+ * @return bool|ResultWrapper
*/
static function loadAndLazyInit() {
wfDebug( __METHOD__ . ": reading site_stats from slave\n" );
}
/**
- * @param $db DatabaseBase
- * @return Bool|ResultWrapper
+ * @param DatabaseBase $db
+ * @return bool|ResultWrapper
*/
static function doLoad( $db ) {
return $db->selectRow( 'site_stats', array(
/**
* Find the number of users in a given user group.
* @param string $group name of group
- * @return Integer
+ * @return int
*/
static function numberingroup( $group ) {
if ( !isset( self::$groupMemberCounts[$group] ) ) {
}
/**
- * @param $ns int
+ * @param int $ns
*
* @return int
*/
*
* Checks only fields which are filled by SiteStatsInit::refresh.
*
- * @param $row
+ * @param bool|object $row
*
* @return bool
*/
/**
* Constructor
- * @param $database Boolean or DatabaseBase:
+ * @param bool|DatabaseBase $database
* - Boolean: whether to use the master DB
* - DatabaseBase: database connection to use
*/
/**
* Count the total number of edits
- * @return Integer
+ * @return int
*/
public function edits() {
$this->mEdits = $this->db->selectField( 'revision', 'COUNT(*)', '', __METHOD__ );
/**
* Count pages in article space(s)
- * @return Integer
+ * @return int
*/
public function articles() {
global $wgArticleCountMethod;
/**
* Count total pages
- * @return Integer
+ * @return int
*/
public function pages() {
$this->mPages = $this->db->selectField( 'page', 'COUNT(*)', '', __METHOD__ );
/**
* Count total users
- * @return Integer
+ * @return int
*/
public function users() {
$this->mUsers = $this->db->selectField( 'user', 'COUNT(*)', '', __METHOD__ );
/**
* Count views
- * @return Integer
+ * @return int
*/
public function views() {
$this->mViews = $this->db->selectField( 'page', 'SUM(page_counter)', '', __METHOD__ );
/**
* Count total files
- * @return Integer
+ * @return int
*/
public function files() {
$this->mFiles = $this->db->selectField( 'image', 'COUNT(*)', '', __METHOD__ );
* Do all updates and commit them. More or less a replacement
* for the original initStats, but without output.
*
- * @param $database DatabaseBase|bool
+ * @param DatabaseBase|bool $database
* - Boolean: whether to use the master DB
* - DatabaseBase: database connection to use
* @param array $options of options, may contain the following values
/**
* Add specific styles for this skin
*
- * @param $out OutputPage
+ * @param OutputPage $out
*/
function setupSkinUserCss( OutputPage $out ) {
$out->addModuleStyles( array(
* and eventually it spits out some HTML. Should have interface
* roughly equivalent to PHPTAL 0.7.
*
- * @param $classname String
- * @param string $repository subdirectory where we keep template files
- * @param $cache_dir string
+ * @param string $classname
+ * @param string $repository Subdirectory where we keep template files
+ * @param string $cache_dir
* @return QuickTemplate
* @private
*/
/**
* initialize various variables and generate the template
*
- * @param $out OutputPage
+ * @param OutputPage $out
*/
function outputPage( OutputPage $out = null ) {
wfProfileIn( __METHOD__ );
* initialize various variables and generate the template
*
* @since 1.23
- * @return QuickTemplate the template to be executed by outputPage
+ * @return QuickTemplate The template to be executed by outputPage
*/
protected function prepareQuickTemplate() {
global $wgContLang, $wgScript, $wgStylePath,
* an error object of the appropriate type.
* For the base class, assume strings all around.
*
- * @param $str Mixed
+ * @param string $str
* @private
*/
function printOrError( $str ) {
/**
* Builds an array with tab definition
*
- * @param Title $title page where the tab links to
- * @param string|array $message message key or an array of message keys (will fall back)
- * @param boolean $selected display the tab as selected
- * @param string $query query string attached to tab URL
- * @param boolean $checkEdit check if $title exists and mark with .new if one doesn't
+ * @param Title $title page Where the tab links to
+ * @param string|array $message Message key or an array of message keys (will fall back)
+ * @param bool $selected Display the tab as selected
+ * @param string $query Query string attached to tab URL
+ * @param bool $checkEdit Check if $title exists and mark with .new if one doesn't
*
* @return array
*/
/**
* Sets the value $value to $name
- * @param $name
- * @param $value
+ * @param string $name
+ * @param mixed $value
*/
public function set( $name, $value ) {
$this->data[$name] = $value;
}
/**
- * @param $name
- * @param $value
+ * @param string $name
+ * @param mixed $value
*/
public function setRef( $name, &$value ) {
$this->data[$name] =& $value;
}
/**
- * @param $t
+ * @param MediaWiki_I18N $t
*/
public function setTranslator( &$t ) {
$this->translator = &$t;
/**
* @private
+ * @param string $str
+ * @return string
*/
function text( $str ) {
echo htmlspecialchars( $this->data[$str] );
/**
* @private
+ * @param string $str
+ * @return string
*/
function html( $str ) {
echo $this->data[$str];
/**
* @private
+ * @param string $str
+ * @return string
*/
function msg( $str ) {
echo htmlspecialchars( $this->translator->translate( $str ) );
/**
* @private
+ * @param string $str
+ * @return string
*/
function msgHtml( $str ) {
echo $this->translator->translate( $str );
/**
* An ugly, ugly hack.
* @private
+ * @param string $str
+ * @return string
*/
function msgWiki( $str ) {
global $wgOut;
/**
* @private
+ * @param string $str
* @return bool
*/
function haveData( $str ) {
/**
* @private
*
+ * @param string $str
* @return bool
*/
function haveMsg( $str ) {
/**
* Get the Skin object related to this object
*
- * @return Skin object
+ * @return Skin
*/
public function getSkin() {
return $this->data['skin'];
* Fetch the output of a QuickTemplate and return it
*
* @since 1.23
- * @return String
+ * @return string
*/
public function getHTML() {
ob_start();
/**
* Get a Message object with its context set
*
- * @param string $name message name
+ * @param string $name Message name
* @return Message
*/
public function getMsg( $name ) {
/**
* Generates a list item for a navigation, portlet, portal, sidebar... list
*
- * @param $key string, usually a key from the list you are generating this link from.
- * @param $item array, of list item data containing some of a specific set of keys.
+ * @param string $key Usually a key from the list you are generating this link from.
+ * @param array $item Array of list item data containing some of a specific set of keys.
* The "id", "class" and "itemtitle" keys will be used as attributes for the list item,
* if "active" contains a value of true a "active" class will also be appended to class.
*
- * @param $options array
+ * @param array $options
*
* If you want something other than a "<li>" you can pass a tag name such as
* "tag" => "span" in the $options array to change the tag used.
* in the list of footer icons. This is mostly useful for skins which only
* display the text from footericons instead of the images and don't want a
* duplicate copyright statement because footerlinks already rendered one.
- * @return
+ * @return string
*/
function getFooterIcons( $option = null ) {
// Generate additional footer icons
var $bodyRemaining;
/**
- * @param $server string
- * @param $options array
+ * @param string $server
+ * @param array $options
*/
public function __construct( $server, $options = array() ) {
$parts = explode( ':', $server, 2 );
/**
* Get the host's IP address.
* Does not support IPv6 at present due to the lack of a convenient interface in PHP.
+ * @return string
*/
protected function getIP() {
if ( $this->ip === null ) {
/**
* Queue a purge operation
*
- * @param $url string
+ * @param string $url
*/
public function queuePurge( $url ) {
global $wgSquidPurgeUseHostHeader;
}
/**
- * @param $line
+ * @param string $line
* @return
*/
protected function processStatusLine( $line ) {
}
/**
- * @param $line string
+ * @param string $line
*/
protected function processHeaderLine( $line ) {
if ( preg_match( '/^Content-Length: (\d+)$/i', $line, $m ) ) {
}
/**
- * @param $msg string
+ * @param string $msg
*/
protected function log( $msg ) {
wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg" );
var $timeout = 5;
/**
- * @param $options array
+ * @param array $options
*/
function __construct( $options = array() ) {
if ( isset( $options['timeout'] ) ) {
}
/**
- * @param $client SquidPurgeClient
+ * @param SquidPurgeClient $client
* @return void
*/
public function addClient( $client ) {
* @ingroup StatCounter
*/
class StatCounter {
- /** @var Array */
+ /** @var array */
protected $deltas = array(); // (key => count)
protected function __construct() {}
* Increment a key by delta $count
*
* @param string $key
- * @param integer $count
+ * @param int $count
* @return void
*/
public function incr( $key, $count = 1 ) {
/**
* Factory function for good results
*
- * @param $value Mixed
+ * @param mixed $value
* @return Status
*/
static function newGood( $value = null ) {
* Returns whether the operation completed and didn't have any error or
* warnings
*
- * @return Boolean
+ * @return bool
*/
public function isGood() {
return $this->ok && !$this->errors;
/**
* Returns whether the operation completed
*
- * @return Boolean
+ * @return bool
*/
public function isOK() {
return $this->ok;
/**
* Add a new warning
*
- * @param string|Message $message message name or object
+ * @param string|Message $message Message name or object
*/
public function warning( $message /*, parameters... */ ) {
$params = array_slice( func_get_args(), 1 );
* Add an error, do not set fatal flag
* This can be used for non-fatal errors
*
- * @param string|Message $message message name or object
+ * @param string|Message $message Message name or object
*/
public function error( $message /*, parameters... */ ) {
$params = array_slice( func_get_args(), 1 );
* Add an error and set OK to false, indicating that the operation
* as a whole was fatal
*
- * @param string|Message $message message name or object
+ * @param string|Message $message Message name or object
*/
public function fatal( $message /*, parameters... */ ) {
$params = array_slice( func_get_args(), 1 );
}
/**
- * @param $params array
+ * @param array $params
* @return array
*/
protected function cleanParams( $params ) {
/**
* Get the error list as a wikitext formatted list
*
- * @param string $shortContext a short enclosing context message name, to
+ * @param string $shortContext A short enclosing context message name, to
* be used when there is a single error
- * @param string $longContext a long enclosing context message name, for a list
- * @return String
+ * @param string $longContext A long enclosing context message name, for a list
+ * @return string
*/
public function getWikiText( $shortContext = false, $longContext = false ) {
if ( count( $this->errors ) == 0 ) {
/**
* Return the message for a single error.
- * @param $error Mixed With an array & two values keyed by
+ * @param mixed $error With an array & two values keyed by
* 'message' and 'params', use those keys-value pairs.
* Otherwise, if its an array, just use the first value as the
* message and the remaining items as the params.
*
- * @return String
+ * @return string
*/
protected function getErrorMessage( $error ) {
if ( is_array( $error ) ) {
/**
* Get the error message as HTML. This is done by parsing the wikitext error
* message.
- * @param string $shortContext a short enclosing context message name, to
+ * @param string $shortContext A short enclosing context message name, to
* be used when there is a single error
- * @param string $longContext a long enclosing context message name, for a list
- * @return String
+ * @param string $longContext A long enclosing context message name, for a list
+ * @return string
*/
public function getHTML( $shortContext = false, $longContext = false ) {
$text = $this->getWikiText( $shortContext, $longContext );
/**
* Return an array with the wikitext for each item in the array.
- * @param $errors Array
- * @return Array
+ * @param array $errors
+ * @return array
*/
protected function getErrorMessageArray( $errors ) {
return array_map( array( $this, 'getErrorMessage' ), $errors );
/**
* Returns a list of status messages of the given type
- * @param $type String
- * @return Array
+ * @param string $type
+ * @return array
*/
protected function getStatusArray( $type ) {
$result = array();
* Returns a list of status messages of the given type, with message and
* params left untouched, like a sane version of getStatusArray
*
- * @param $type String
+ * @param string $type
*
- * @return Array
+ * @return array
*/
public function getErrorsByType( $type ) {
$result = array();
* Note, due to the lack of tools for comparing Message objects, this
* function will not work when using a Message object as a parameter.
*
- * @param string $msg message name
- * @return Boolean
+ * @param string $msg Message name
+ * @return bool
*/
public function hasMessage( $msg ) {
foreach ( $this->errors as $error ) {
/**
* Constructor.
*
- * @param string $global name of the global variable.
- * @param string $class name of the class of the real object.
- * @param array $params parameters to pass to constructor of the real
- * object.
+ * @param string $global Name of the global variable.
+ * @param string $class Name of the class of the real object.
+ * @param array $params Parameters to pass to constructor of the real object.
*/
function __construct( $global = null, $class = null, $params = array() ) {
$this->mGlobal = $global;
* Returns a bool value whenever $obj is a stub object. Can be used to break
* a infinite loop when unstubbing an object.
*
- * @param $obj Object to check.
- * @return Boolean: true if $obj is not an instance of StubObject class.
+ * @param object $obj Object to check.
+ * @return bool True if $obj is not an instance of StubObject class.
*/
static function isRealObject( $obj ) {
return is_object( $obj ) && !$obj instanceof StubObject;
* infinite loop when unstubbing an object or to avoid reference parameter
* breakage.
*
- * @param $obj Object to check.
+ * @param object $obj Object to check.
* @return void
*/
static function unstub( $obj ) {
* This function will also call the function with the same name in the real
* object.
*
- * @param string $name name of the function called
- * @param array $args arguments
+ * @param string $name Name of the function called
+ * @param array $args Arguments
* @return mixed
*/
function _call( $name, $args ) {
* Function called by PHP if no function with that name exists in this
* object.
*
- * @param string $name name of the function called
- * @param array $args arguments
+ * @param string $name Name of the function called
+ * @param array $args Arguments
* @return mixed
*/
function __call( $name, $args ) {
* This is public, for the convenience of external callers wishing to access
* properties, e.g. eval.php
*
- * @param string $name name of the method called in this object.
- * @param $level Integer: level to go in the stack trace to get the function
- * who called this function.
+ * @param string $name Name of the method called in this object.
+ * @param int $level Level to go in the stack trace to get the function
+ * who called this function.
* @throws MWException
*/
function _unstub( $name = '_unstub', $level = 2 ) {
*/
class MailAddress {
/**
- * @param string|User $address string with an email address, or a User object
- * @param string $name human-readable name if a string address is given
- * @param string $realName human-readable real name if a string address is given
+ * @param string|User $address String with an email address, or a User object
+ * @param string $name Human-readable name if a string address is given
+ * @param string $realName Human-readable real name if a string address is given
*/
function __construct( $address, $name = null, $realName = null ) {
if ( is_object( $address ) && $address instanceof User ) {
/**
* Send mail using a PEAR mailer
*
- * @param $mailer
- * @param $dest
- * @param $headers
- * @param $body
+ * @param UserMailer $mailer
+ * @param string $dest
+ * @param string $headers
+ * @param string $body
*
* @return Status
*/
* Note RFC2822 says newlines must be CRLF (\r\n)
* but php mail naively "corrects" it and requires \n for the "correction" to work
*
- * @return String
+ * @return string
*/
static function arrayToHeaderString( $headers, $endl = "\n" ) {
$strings = array();
/**
* Create a value suitable for the MessageId Header
*
- * @return String
+ * @return string
*/
static function makeMsgId() {
global $wgSMTP, $wgServer;
* array of parameters. It requires PEAR:Mail to do that.
* Otherwise it just uses the standard PHP 'mail' function.
*
- * @param $to MailAddress: recipient's email (or an array of them)
- * @param $from MailAddress: sender's email
- * @param string $subject email's subject.
- * @param string $body email's text or Array of two strings to be the text and html bodies
- * @param $replyto MailAddress: optional reply-to email (default: null).
- * @param string $contentType optional custom Content-Type (default: text/plain; charset=UTF-8)
+ * @param MailAddress $to Recipient's email (or an array of them)
+ * @param MailAddress $from Sender's email
+ * @param string $subject Email's subject.
+ * @param string $body Email's text or Array of two strings to be the text and html bodies
+ * @param MailAddress $replyto Optional reply-to email (default: null).
+ * @param string $contentType Optional custom Content-Type (default: text/plain; charset=UTF-8)
* @throws MWException
- * @return Status object
+ * @return Status
*/
public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = 'text/plain; charset=UTF-8' ) {
global $wgSMTP, $wgEnotifMaxRecips, $wgAdditionalMailParams, $wgAllowHTMLEmail;
/**
* Set the mail error message in self::$mErrorString
*
- * @param $code Integer: error number
- * @param string $string error message
+ * @param int $code Error number
+ * @param string $string Error message
*/
static function errorHandler( $code, $string ) {
self::$mErrorString = preg_replace( '/^mail\(\)(\s*\[.*?\])?: /', '', $string );
/**
* Converts a string into a valid RFC 822 "phrase", such as is used for the sender name
- * @param $phrase string
+ * @param string $phrase
* @return string
*/
public static function rfc822Phrase( $phrase ) {
*
* May be deferred via the job queue.
*
- * @param $editor User object
- * @param $title Title object
- * @param $timestamp
- * @param $summary
- * @param $minorEdit
- * @param $oldid (default: false)
- * @param $pageStatus (default: 'changed')
+ * @param User $editor
+ * @param Title $title
+ * @param string $timestamp
+ * @param string $summary
+ * @param bool $minorEdit
+ * @param bool $oldid (default: false)
+ * @param string $pageStatus (default: 'changed')
*/
public function notifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid = false, $pageStatus = 'changed' ) {
global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker, $wgEnotifMinorEdits,
* Send emails corresponding to the user $editor editing the page $title.
* Also updates wl_notificationtimestamp.
*
- * @param $editor User object
- * @param $title Title object
+ * @param User $editor
+ * @param Title $title
* @param string $timestamp Edit timestamp
* @param string $summary Edit summary
- * @param $minorEdit bool
+ * @param bool $minorEdit
* @param int $oldid Revision ID
- * @param array $watchers of user IDs
+ * @param array $watchers Array of user IDs
* @param string $pageStatus
* @throws MWException
*/
}
/**
- * @param $editor User
- * @param $title Title bool
- * @param $minorEdit
+ * @param User $editor
+ * @param Title $title
+ * @param bool $minorEdit
* @return bool
*/
private function canSendUserTalkEmail( $editor, $title, $minorEdit ) {
* depending on settings.
*
* Call sendMails() to send any mails that were queued.
- * @param $user User
+ * @param User $user
*/
function compose( $user ) {
global $wgEnotifImpersonal;
* timestamp in proper timezone, etc) and sends it out.
* Returns true if the mail was sent successfully.
*
- * @param $watchingUser User object
- * @return Boolean
+ * @param User $watchingUser
+ * @return bool
* @private
*/
function sendPersonalised( $watchingUser ) {
/**
* Same as sendPersonalised but does impersonal mail suitable for bulk
* mailing. Takes an array of MailAddress objects.
- * @param $addresses array
+ * @param array $addresses
* @return Status|null
*/
function sendImpersonal( $addresses ) {
*
* @see newFromId()
* @see newFromName()
- * @param $db DatabaseBase: db connection
- * @param string $database database name
- * @param string $name user name
- * @param $id Integer: user ID
+ * @param DatabaseBase $db Db connection
+ * @param string $database Database name
+ * @param string $name User name
+ * @param int $id User ID
*/
private function __construct( $db, $database, $name, $id ) {
$this->db = $db;
/**
* Accessor for $this->database
*
- * @return String: database name
+ * @return string Database name
*/
public function getDBName() {
return $this->database;
/**
* Confirm the selected database name is a valid local interwiki database name.
*
- * @param string $database database name
- * @return Boolean
+ * @param string $database Database name
+ * @return bool
*/
public static function validDatabase( $database ) {
global $wgLocalDatabases;
/**
* Same as User::whoIs()
*
- * @param string $database database name
- * @param $id Integer: user ID
- * @param $ignoreInvalidDB Boolean: if true, don't check if $database is in $wgLocalDatabases
- * @return String: user name or false if the user doesn't exist
+ * @param string $database Database name
+ * @param int $id User ID
+ * @param bool $ignoreInvalidDB If true, don't check if $database is in $wgLocalDatabases
+ * @return string User name or false if the user doesn't exist
*/
public static function whoIs( $database, $id, $ignoreInvalidDB = false ) {
$user = self::newFromId( $database, $id, $ignoreInvalidDB );
/**
* Factory function; get a remote user entry by ID number.
*
- * @param string $database database name
- * @param $id Integer: user ID
- * @param $ignoreInvalidDB Boolean: if true, don't check if $database is in $wgLocalDatabases
- * @return UserRightsProxy or null if doesn't exist
+ * @param string $database Database name
+ * @param int $id User ID
+ * @param bool $ignoreInvalidDB If true, don't check if $database is in $wgLocalDatabases
+ * @return UserRightsProxy|null If doesn't exist
*/
public static function newFromId( $database, $id, $ignoreInvalidDB = false ) {
return self::newFromLookup( $database, 'user_id', intval( $id ), $ignoreInvalidDB );
/**
* Factory function; get a remote user entry by name.
*
- * @param string $database database name
- * @param string $name user name
- * @param $ignoreInvalidDB Boolean: if true, don't check if $database is in $wgLocalDatabases
- * @return UserRightsProxy or null if doesn't exist
+ * @param string $database Database name
+ * @param string $name User name
+ * @param bool $ignoreInvalidDB If true, don't check if $database is in $wgLocalDatabases
+ * @return UserRightsProxy|null If doesn't exist
*/
public static function newFromName( $database, $name, $ignoreInvalidDB = false ) {
return self::newFromLookup( $database, 'user_name', $name, $ignoreInvalidDB );
}
/**
- * @param $database
- * @param $field
- * @param $value
- * @param $ignoreInvalidDB bool
+ * @param string $database
+ * @param string $field
+ * @param string $value
+ * @param bool $ignoreInvalidDB
* @return null|UserRightsProxy
*/
private static function newFromLookup( $database, $field, $value, $ignoreInvalidDB = false ) {
* Open a database connection to work on for the requested user.
* This may be a new connection to another database for remote users.
*
- * @param $database String
- * @param $ignoreInvalidDB Boolean: if true, don't check if $database is in $wgLocalDatabases
- * @return DatabaseBase or null if invalid selection
+ * @param string $database
+ * @param bool $ignoreInvalidDB If true, don't check if $database is in $wgLocalDatabases
+ * @return DatabaseBase|null If invalid selection
*/
public static function getDB( $database, $ignoreInvalidDB = false ) {
global $wgDBname;
/**
* Same as User::getName()
*
- * @return String
+ * @return string
*/
public function getName() {
return $this->name . '@' . $this->database;
/**
* Same as User::getUserPage()
*
- * @return Title object
+ * @return Title
*/
public function getUserPage() {
return Title::makeTitle( NS_USER, $this->getName() );
/**
* Replaces User::addUserGroup()
+ * @param string $group
*/
function addGroup( $group ) {
$this->db->insert( 'user_groups',
/**
* Replaces User::removeUserGroup()
+ * @param string $group
*/
function removeGroup( $group ) {
$this->db->delete( 'user_groups',
/**
* Replaces User::setOption()
+ * @param string $option
+ * @param mixed $value
*/
public function setOption( $option, $value ) {
$this->newOptions[$option] = $value;
/**
* Create a WatchedItem object with the given user and title
* @since 1.22 $checkRights parameter added
- * @param $user User: the user to use for (un)watching
- * @param $title Title: the title we're going to (un)watch
- * @param $checkRights int: Whether to check the 'viewmywatchlist' and 'editmywatchlist' rights.
+ * @param User $user The user to use for (un)watching
+ * @param Title $title The title we're going to (un)watch
+ * @param int $checkRights Whether to check the 'viewmywatchlist' and 'editmywatchlist' rights.
* Pass either WatchedItem::IGNORE_USER_RIGHTS or WatchedItem::CHECK_USER_RIGHTS.
- * @return WatchedItem object
+ * @return WatchedItem
*/
public static function fromUserTitle( $user, $title, $checkRights = WatchedItem::CHECK_USER_RIGHTS ) {
$wl = new WatchedItem;
/**
* Check permissions
- * @param $what string: 'viewmywatchlist' or 'editmywatchlist'
+ * @param string $what 'viewmywatchlist' or 'editmywatchlist'
*/
private function isAllowed( $what ) {
return !$this->mCheckRights || $this->mUser->isAllowed( $what );
/**
* Get the notification timestamp of this entry.
*
- * @return false|null|string: false if the page is not watched, the value of
- * the wl_notificationtimestamp field otherwise
+ * @return false|null|string false if the page is not watched, the value of
+ * the wl_notificationtimestamp field otherwise
*/
public function getNotificationTimestamp() {
if ( !$this->isAllowed( 'viewmywatchlist' ) ) {
/**
* Reset the notification timestamp of this entry
*
- * @param $force Whether to force the write query to be executed even if the
- * page is not watched or the notification timestamp is already NULL.
+ * @param bool $force Whether to force the write query to be executed even if the
+ * page is not watched or the notification timestamp is already NULL.
* @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
*/
public function resetNotificationTimestamp( $force = '', $oldid = 0 ) {
}
/**
- * Given a title and user (assumes the object is setup), add the watch to the
- * database.
+ * Given a title and user (assumes the object is setup), add the watch to the database.
* @return bool
*/
public function addWatch() {
* Check if the given title already is watched by the user, and if so
* add watches on a new title. To be used for page renames and such.
*
- * @param $ot Title: page title to duplicate entries from, if present
- * @param $nt Title: page title to add watches on
+ * @param Title $ot Page title to duplicate entries from, if present
+ * @param Title $nt Page title to add watches on
*/
public static function duplicateEntries( $ot, $nt ) {
WatchedItem::doDuplicateEntries( $ot->getSubjectPage(), $nt->getSubjectPage() );
/**
* Handle duplicate entries. Backend for duplicateEntries().
*
- * @param $ot Title
- * @param $nt Title
+ * @param Title $ot
+ * @param Title $nt
*
* @return bool
*/
private $context;
/**
- * @param $x null|WebRequest
+ * @param null|WebRequest $x
* @return WebRequest
*/
public function request( WebRequest $x = null ) {
}
/**
- * @param $x null|OutputPage
+ * @param null|OutputPage $x
* @return OutputPage
*/
public function output( OutputPage $x = null ) {
/**
* Parse the request to get the Title object
*
- * @return Title object to be $wgTitle
+ * @return Title Title object to be $wgTitle
*/
private function parseTitle() {
global $wgContLang;
/**
* Returns the name of the action that will be executed.
*
- * @return string: action
+ * @return string Action
*/
public function getAction() {
static $action = null;
* Initialize the main Article object for "standard" actions (view, etc)
* Create an Article object for the page, following redirects if needed.
*
- * @return mixed an Article, or a string to redirect to another URL
+ * @return mixed An Article, or a string to redirect to another URL
*/
private function initializeArticle() {
global $wgDisableHardRedirects;
/**
* Perform one of the "standard" actions
*
- * @param $page Page
- * @param $requestTitle The original title, before any redirects were applied
+ * @param Page $page
+ * @param Title $requestTitle The original title, before any redirects were applied
*/
private function performAction( Page $page, Title $requestTitle ) {
global $wgUseSquid, $wgSquidMaxage;
/**
* Get a WikiReference object for $wikiID
*
- * @param string $wikiID wiki'd id (generally database name)
- * @return WikiReference object or null if the wiki was not found
+ * @param string $wikiID Wiki'd id (generally database name)
+ * @return WikiReference|null WikiReference object or null if the wiki was not found
*/
public static function getWiki( $wikiID ) {
global $wgConf;
* Convenience to get the wiki's display name
*
* @todo We can give more info than just the wiki id!
- * @param string $wikiID wiki'd id (generally database name)
+ * @param string $wikiID Wiki'd id (generally database name)
* @return string|int Wiki's name or $wiki_id if the wiki was not found
*/
public static function getWikiName( $wikiID ) {
/**
* Convenience to get a link to a user page on a foreign wiki
*
- * @param string $wikiID wiki'd id (generally database name)
- * @param string $user user name (must be normalised before calling this function!)
- * @param string $text link's text; optional, default to "User:$user"
- * @return String: HTML link or false if the wiki was not found
+ * @param string $wikiID Wiki'd id (generally database name)
+ * @param string $user User name (must be normalised before calling this function!)
+ * @param string $text Link's text; optional, default to "User:$user"
+ * @return string HTML link or false if the wiki was not found
*/
public static function foreignUserLink( $wikiID, $user, $text = null ) {
return self::makeForeignLink( $wikiID, "User:$user", $text );
/**
* Convenience to get a link to a page on a foreign wiki
*
- * @param string $wikiID wiki'd id (generally database name)
- * @param string $page page name (must be normalised before calling this function!)
- * @param string $text link's text; optional, default to $page
- * @return String: HTML link or false if the wiki was not found
+ * @param string $wikiID Wiki'd id (generally database name)
+ * @param string $page Page name (must be normalised before calling this function!)
+ * @param string $text Link's text; optional, default to $page
+ * @return string HTML link or false if the wiki was not found
*/
public static function makeForeignLink( $wikiID, $page, $text = null ) {
if ( !$text ) {
/**
* Convenience to get a url to a page on a foreign wiki
*
- * @param string $wikiID wiki'd id (generally database name)
- * @param string $page page name (must be normalised before calling this function!)
- * @return String: URL or false if the wiki was not found
+ * @param string $wikiID Wiki'd id (generally database name)
+ * @param string $page Page name (must be normalised before calling this function!)
+ * @return string|bool URL or false if the wiki was not found
*/
public static function getForeignURL( $wikiID, $page ) {
$wiki = WikiMap::getWiki( $wikiID );
private $mPath; ///< path, '/wiki/$1'
/**
- * @param $major string
- * @param $minor string
- * @param $canonicalServer string
- * @param $path string
- * @param $server null|string
+ * @param string $major
+ * @param string $minor
+ * @param string $canonicalServer
+ * @param string $path
+ * @param null|string $server
*/
public function __construct( $major, $minor, $canonicalServer, $path, $server = null ) {
$this->mMajor = $major;
* Get the the URL in a way to de displayed to the user
* More or less Wikimedia specific
*
- * @return String
+ * @return string
*/
public function getDisplayName() {
$url = $this->getUrl( '' );
* Helper function for getUrl()
*
* @todo FIXME: This may be generalized...
- * @param string $page page name (must be normalised before calling this function!)
- * @return String: Url fragment
+ * @param string $page Page name (must be normalised before calling this function!)
+ * @return string Url fragment
*/
private function getLocalUrl( $page ) {
return str_replace( '$1', wfUrlEncode( str_replace( ' ', '_', $page ) ), $this->mPath );
/**
* Get a canonical (i.e. based on $wgCanonicalServer) URL to a page on this foreign wiki
*
- * @param string $page page name (must be normalised before calling this function!)
- * @return String: Url
+ * @param string $page Page name (must be normalised before calling this function!)
+ * @return string Url
*/
public function getCanonicalUrl( $page ) {
return $this->mCanonicalServer . $this->getLocalUrl( $page );
/**
* Alias for getCanonicalUrl(), for backwards compatibility.
- * @param $page string
- * @return String
+ * @param string $page
+ * @return string
*/
public function getUrl( $page ) {
return $this->getCanonicalUrl( $page );
* Get a URL based on $wgServer, like Title::getFullURL() would produce
* when called locally on the wiki.
*
- * @param string $page page name (must be normalized before calling this function!)
- * @return String: URL
+ * @param string $page Page name (must be normalized before calling this function!)
+ * @return string URL
*/
public function getFullUrl( $page ) {
return $this->mServer .
$res = $dbw->select(
'oldimage',
array( 'oi_archive_name', 'oi_sha1' ),
- array( 'oi_archive_name' => array_keys( $oldRels ) ),
+ array( 'oi_archive_name' => array_keys( $oldRels ),
+ 'oi_name' => $this->file->getName() ), // performance
__METHOD__
);
/**
* Button cannot be invalid
*
- * @param $value String
- * @param $alldata Array
+ * @param string $value
+ * @param array $alldata
*
- * @return Bool
+ * @return bool
*/
public function validate( $value, $alldata ) {
return true;
/**
* For a checkbox, the label goes on the right hand side, and is
* added in getInputHTML(), rather than HTMLFormField::getRow()
- * @return String
+ * @return string
*/
function getLabel() {
return ' ';
/**
* checkboxes don't need a label.
+ * @return bool
*/
protected function needsLabel() {
return false;
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return String
+ * @return string
*/
function loadDataFromRequest( $request ) {
$invert = false;
* mParams['rows'] is an array with row labels as keys and row tags as values.
* mParams['columns'] is an array with column labels as keys and column tags as values.
*
- * @param array $value of the options that should be checked
+ * @param array $value Array of the options that should be checked
*
- * @return String
+ * @return string
*/
function getInputHTML( $value ) {
$html = '';
* line above the options in the case of a checkbox matrix, i.e. it's always
* a "vertical-label".
*
- * @param string $value the value to set the input to
+ * @param string $value The value to set the input to
*
- * @return String complete HTML table row
+ * @return string Complete HTML table row
*/
function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return Array
+ * @return array
*/
function loadDataFromRequest( $request ) {
if ( $this->mParent->getMethod() == 'post' ) {
/**
* Format in which to display form. For viable options,
* @see $availableDisplayFormats
- * @var String
+ * @var string
*/
protected $displayFormat = 'table';
/**
* Available formats in which to display the form
- * @var Array
+ * @var array
*/
protected $availableDisplayFormats = array(
'table',
/**
* Build a new HTMLForm from an array of field attributes
*
- * @param array $descriptor of Field constructs, as described above
- * @param $context IContextSource available since 1.18, will become compulsory in 1.18.
+ * @param array $descriptor Array of Field constructs, as described above
+ * @param IContextSource $context Available since 1.18, will become compulsory in 1.18.
* Obviates the need to call $form->setTitle()
- * @param string $messagePrefix a prefix to go in front of default messages
+ * @param string $messagePrefix A prefix to go in front of default messages
*/
public function __construct( $descriptor, /*IContextSource*/ $context = null,
$messagePrefix = ''
/**
* Set format in which to display the form
*
- * @param string $format the name of the format to use, must be one of
- * $this->availableDisplayFormats
+ * @param string $format The name of the format to use, must be one of
+ * $this->availableDisplayFormats
*
* @throws MWException
* @since 1.20
/**
* Getter for displayFormat
* @since 1.20
- * @return String
+ * @return string
*/
public function getDisplayFormat() {
return $this->displayFormat;
/**
* Test if displayFormat is 'vform'
* @since 1.22
- * @return Bool
+ * @return bool
*/
public function isVForm() {
return $this->displayFormat === 'vform';
/**
* Try submitting, with edit token check first
- * @return Status|boolean
+ * @return Status|bool
*/
function tryAuthorizedSubmit() {
$result = false;
* The here's-one-I-made-earlier option: do the submission if
* posted, or display the form with or without funky validation
* errors
- * @return Bool or Status whether submission was successful.
+ * @return bool|Status Whether submission was successful.
*/
function show() {
$this->prepareForm();
* Validate all the fields, and call the submission callback
* function if everything is kosher.
* @throws MWException
- * @return Mixed Bool true == Successful submission, Bool false
+ * @return mixed Bool true == Successful submission, Bool false
* == No submission attempted, anything else == Error to
* display.
*/
* Set a callback to a function to do something with the form
* once it's been successfully validated.
*
- * @param string $cb function name. The function will be passed
+ * @param string $cb Function name. The function will be passed
* the output from HTMLForm::filterDataForSubmit, and must
* return Bool true on success, Bool false if no submission
* was attempted, or String HTML output to display on error.
/**
* Set a message to display on a validation error.
*
- * @param $msg Mixed String or Array of valid inputs to wfMessage()
+ * @param string|array $msg String or Array of valid inputs to wfMessage()
* (so each entry can be either a String or Array)
*
* @return HTMLForm $this for chaining calls (since 1.20)
/**
* Set the introductory message, overwriting any existing message.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Set the introductory message, overwriting any existing message.
* @since 1.19
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add introductory text.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add header text, inside the form.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
* @param string $section The section to add the header to
*
* @return HTMLForm $this for chaining calls (since 1.20)
* Set header text, inside the form.
* @since 1.19
*
- * @param string $msg complete text of message to display
- * @param $section The section to add the header to
+ * @param string $msg Complete text of message to display
+ * @param string $section The section to add the header to
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Set footer text, inside the form.
* @since 1.19
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
* @param string $section The section to add the footer text to
*
* @return HTMLForm $this for chaining calls (since 1.20)
/**
* Add text to the end of the display.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set text at the end of the display.
*
- * @param string $msg complete text of message to display
+ * @param string $msg Complete text of message to display
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add a hidden field to the output
*
- * @param string $name field name. This will be used exactly as entered
- * @param string $value field value
- * @param $attribs Array
+ * @param string $name Field name. This will be used exactly as entered
+ * @param string $value Field value
+ * @param array $attribs
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Add a button to the form
*
- * @param string $name field name.
- * @param string $value field value
+ * @param string $name Field name.
+ * @param string $value Field value
* @param string $id DOM id for the button (default: null)
- * @param $attribs Array
+ * @param array $attribs
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* Moreover, when doing method chaining this should be the very last method
* call just after prepareForm().
*
- * @param $submitResult Mixed output from HTMLForm::trySubmit()
+ * @param mixed $submitResult Mixed output from HTMLForm::trySubmit()
*
* @return Nothing, should be last call
*/
/**
* Returns the raw HTML generated by the form
*
- * @param $submitResult Mixed output from HTMLForm::trySubmit()
+ * @param mixed $submitResult Mixed output from HTMLForm::trySubmit()
*
* @return string
*/
*
* @param string $html HTML contents to wrap.
*
- * @return String wrapped HTML.
+ * @return string Wrapped HTML.
*/
function wrapForm( $html ) {
/**
* Get the hidden fields that should go inside the form.
- * @return String HTML.
+ * @return string HTML.
*/
function getHiddenFields() {
global $wgArticlePath;
/**
* Get the submit and (potentially) reset buttons.
- * @return String HTML.
+ * @return string HTML.
*/
function getButtons() {
$buttons = '';
/**
* Get the whole body of the form.
- * @return String
+ * @return string
*/
function getBody() {
return $this->displaySection( $this->mFieldTree, $this->mTableId );
/**
* Format and display an error message stack.
*
- * @param $errors String|Array|Status
+ * @param string|array|Status $errors
*
- * @return String
+ * @return string
*/
function getErrors( $errors ) {
if ( $errors instanceof Status ) {
*
* @param array $errors of message keys/values
*
- * @return String HTML, a "<ul>" list of errors
+ * @return string HTML, a "<ul>" list of errors
*/
public static function formatErrors( $errors ) {
$errorstr = '';
* Set the text for the submit button to a message
* @since 1.19
*
- * @param string $msg message key
+ * @param string $msg Message key
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set the id for the submit button.
*
- * @param $t String.
+ * @param string $t
*
* @todo FIXME: Integrity of $t is *not* validated
* @return HTMLForm $this for chaining calls (since 1.20)
*
* @since 1.22
*
- * @param string $id new value of the id attribute, or "" to remove
+ * @param string $id New value of the id attribute, or "" to remove
*
* @return HTMLForm $this for chaining calls
*/
* this message as its "<legend>" element.
* @since 1.19
*
- * @param string $msg message key
+ * @param string $msg Message key
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* @todo Currently only used for the "<fieldset>" legend on forms
* with multiple sections; should be used elsewhere?
*
- * @param $p String
+ * @param string $p
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set the title for form submission
*
- * @param $t Title of page the form is on/should be posted to
+ * @param Title $t Title of page the form is on/should be posted to
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
/**
* Set the method used to submit the form
*
- * @param $method String
+ * @param string $method
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* section, ignored if empty.
* @param string $fieldsetIDPrefix ID prefix for the "<fieldset>" tag of
* each subsection, ignored if empty.
- * @param boolean &$hasUserVisibleFields Whether the section had user-visible fields.
+ * @param bool &$hasUserVisibleFields Whether the section had user-visible fields.
*
- * @return String
+ * @return string
*/
public function displaySection( $fields,
$sectionName = '',
/**
* Stop a reset button being shown for this form
*
- * @param bool $suppressReset set to false to re-enable the
- * button again
+ * @param bool $suppressReset Set to false to re-enable the button again
*
* @return HTMLForm $this for chaining calls (since 1.20)
*/
* to the form as a whole, after it's submitted but before it's
* processed.
*
- * @param $data
+ * @param array $data
*
* @return
*/
* Get a string to go in the "<legend>" of a section fieldset.
* Override this if you want something more complicated.
*
- * @param $key String
+ * @param string $key
*
- * @return String
+ * @return string
*/
public function getLegend( $key ) {
return $this->msg( "{$this->mMessagePrefix}-$key" )->text();
*
* Parameters are the same as wfMessage().
*
- * @return Message object
+ * @return Message
*/
function msg() {
$args = func_get_args();
* @param string $value The value the field was submitted with
* @param array $alldata The data collected from the form
*
- * @return Mixed Bool true on success, or String error to display.
+ * @return bool|string true on success, or String error to display.
*/
function validate( $value, $alldata ) {
if ( isset( $this->mParams['required'] )
* or the input's default value if it has not been set.
*
* @param WebRequest $request
- * @return String the value
+ * @return string The value
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
*
* @param string|null $helptext
*
- * @return String
+ * @return string
*/
public function getHelpTextHtmlDiv( $helptext ) {
if ( is_null( $helptext ) ) {
* @since 1.20
*
* @param string|null $helptext
- * @return String
+ * @return string
*/
public function getHelpTextHtmlRaw( $helptext ) {
return $this->getHelpTextHtmlDiv( $helptext );
* flatten an array of options to a single array, for instance,
* a set of "<options>" inside "<optgroups>".
*
- * @param array $options Associative Array with values either Strings
- * or Arrays
+ * @param array $options Associative Array with values either Strings or Arrays
* @return array Flattened input
*/
public static function flattenOptions( $options ) {
/**
* Formats one or more errors as accepted by field validation-callback.
*
- * @param string|Message|array $errors String|Message|Array of strings or Message instances
+ * @param string|Message|array $errors Array of strings or Message instances
* @return string HTML
* @since 1.18
*/
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return String
+ * @return string
*/
function loadDataFromRequest( $request ) {
if ( $this->mParent->getMethod() == 'post' ) {
* Support for seperating multi-option preferences into multiple preferences
* Due to lack of array support.
*
- * @param $data array
+ * @param array $data
*/
function filterDataForSubmit( $data );
}
* This returns a block of all the radio options, in one cell.
* @see includes/HTMLFormField#getInputHTML()
*
- * @param $value String
+ * @param string $value
*
- * @return String
+ * @return string
*/
function getInputHTML( $value ) {
$html = $this->formatOptions( $this->getOptions(), strval( $value ) );
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return Array("<overall message>","<select value>","<text field value>")
+ * @return array("<overall message>","<select value>","<text field value>")
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
}
/**
- * @param $request WebRequest
+ * @param WebRequest $request
*
- * @return String
+ * @return string
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
* This may add duplicate at insert time, but they will be
* removed later on, when the first one is popped.
*
- * @param array $jobs of Job objects
+ * @param array $jobs Array of Job objects
* @return bool
* @deprecated since 1.21
*/
* be rolled-back as part of a larger transaction. However,
* large batches of jobs can cause slave lag.
*
- * @param array $jobs of Job objects
+ * @param array $jobs Array of Job objects
* @return bool
* @deprecated since 1.21
*/
* actually find a job; it may be adversely affected by concurrent job
* runners.
*
- * @param $type string
+ * @param string $type
* @return Job|bool Returns false if there are no jobs
* @deprecated since 1.21
*/
*------------------------------------------------------------------------*/
/**
- * @param $command
- * @param $title
- * @param $params array|bool
+ * @param string $command
+ * @param Title $title
+ * @param array|bool $params
*/
public function __construct( $command, $title, $params = false ) {
$this->command = $command;
}
/**
- * @return integer Number of actually "work items" handled in this job
+ * @return int Number of actually "work items" handled in this job
* @see $wgJobBackoffThrottling
* @since 1.23
*/
/**
* @see JobQueue::batchPush()
* @param array $jobs
- * @param $flags
+ * @param array $flags
*/
abstract protected function doBatchPush( array $jobs, $flags );
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param $flags
+ * @param array $flags
* @throws DBError|Exception
* @return bool
*/
* Reserve a row with a single UPDATE without holding row locks over RTTs...
*
* @param string $uuid 32 char hex string
- * @param $rand integer Random unsigned integer (31 bits)
+ * @param int $rand Random unsigned integer (31 bits)
* @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
* @return stdClass|bool Row|false
*/
}
/**
- * @param $index integer (DB_SLAVE/DB_MASTER)
+ * @param int $index (DB_SLAVE/DB_MASTER)
* @return DBConnRef
*/
protected function getDB( $index ) {
}
/**
- * @param $property
+ * @param string $property
* @return string
*/
private function getCacheKey( $property ) {
}
/**
- * @param $params
+ * @param array|bool $params
* @return string
*/
protected static function makeBlob( $params ) {
}
/**
- * @param $blob
+ * @param string $blob
* @return bool|mixed
*/
protected static function extractBlob( $blob ) {
}
/**
- * @param $property
+ * @param string $property
* @return string
*/
private function getCacheKey( $property ) {
/**
* Check if there are any queues with jobs (this is cached)
*
- * @param integer $type JobQueueGroup::TYPE_* constant
+ * @param int $type JobQueueGroup::TYPE_* constant
* @return bool
* @since 1.23
*/
}
/**
- * @param $name string
+ * @param string $name
* @return mixed
*/
private function getCachedConfigVar( $name ) {
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param $flags
+ * @param array $flags
* @return bool
* @throws JobQueueError
*/
/**
* @param RedisConnRef $conn
- * @return array serialized string or false
+ * @return array Serialized string or false
* @throws RedisException
*/
protected function popAndDeleteBlob( RedisConnRef $conn ) {
/**
* @param RedisConnRef $conn
- * @return array serialized string or false
+ * @return array Serialized string or false
* @throws RedisException
*/
protected function popAndAcquireBlob( RedisConnRef $conn ) {
/**
* This function should not be called outside JobQueueRedis
*
- * @param $uid string
- * @param $conn RedisConnRef
+ * @param string $uid
+ * @param RedisConnRef $conn
* @return Job|bool Returns false if the job does not exist
* @throws MWException|JobQueueError
*/
}
/**
- * @param $fields array
+ * @param array $fields
* @return Job|bool
*/
protected function getJobFromFields( array $fields ) {
}
/**
- * @param $conn RedisConnRef
- * @param $e RedisException
+ * @param RedisConnRef $conn
+ * @param RedisException $e
* @throws JobQueueError
*/
protected function throwRedisException( RedisConnRef $conn, $e ) {
}
/**
- * @param $prop string
- * @param $type string|null
+ * @param string $prop
+ * @param string|null $type
* @return string
*/
private function getQueueKey( $prop, $type = null ) {
}
/**
- * @param $key string
+ * @param string $key
* @return void
*/
public function setTestingPrefix( $key ) {
/**
* Insert jobs into the job queue to fix redirects to the given title
- * @param string $reason the reason for the fix, see message
+ * @param string $reason The reason for the fix, see message
* "double-redirect-fixed-<reason>"
- * @param $redirTitle Title: the title which has changed, redirects
+ * @param Title $redirTitle The title which has changed, redirects
* pointing to this title are fixed
* @param bool $destTitle Not used
*/
/**
* Get the final destination of a redirect
*
- * @param $title Title
+ * @param Title $title
*
- * @return bool if the specified title is not a redirect, or if it is a circular redirect
+ * @return bool If the specified title is not a redirect, or if it is a circular redirect
*/
public static function getFinalDestination( $title ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Run a refreshLinks2 job
- * @return boolean success
+ * @return bool Success
*/
function run() {
global $wgUpdateRowsPerJob;
}
/**
- * @param $table string
- * @param $masterPos mixed
- * @return Array
+ * @param string $table
+ * @param mixed $masterPos
+ * @return array
*/
protected function getSingleTitleJobs( $table, $masterPos ) {
# The "start"/"end" fields are not set for the base jobs
}
/**
- * @return Array
+ * @return array
*/
public function getDeduplicationInfo() {
$info = parent::getDeduplicationInfo();
}
/**
- * @param $key
+ * @param string $key
* @return mixed
*/
public static function &getSessionData( $key ) {
/**
* Get width and height from the bmp header.
*
- * @param $image
+ * @param File $image
* @param string $filename
* @return array
*/
*/
class BitmapHandler_ClientOnly extends BitmapHandler {
/**
- * @param $image File
- * @param $params
+ * @param File $image
+ * @param array $params
* @return bool
*/
function normaliseParams( $image, &$params ) {
* Get metadata, unserializing it if neccessary.
*
* @param File $file The DjVu file in question
- * @return String XML metadata as a string.
+ * @return string XML metadata as a string.
*/
private function getUnserializedMetadata( File $file ) {
$metadata = $file->getMetadata();
/**
* Return data in the style of getimagesize()
- * @return array or false on failure
+ * @return array|bool Array or false on failure
*/
public function getImageSize() {
$data = $this->getInfo();
/**
* Hack to temporarily work around djvutoxml bug
- * @param $dump
+ * @param string $dump
* @return string
*/
function convertDumpToXML( $dump ) {
}
/**
- * @param $image
+ * @param File $image
* @param array $metadata
* @return bool|int
*/
* the width and height we normally work with is logical, and will match
* any produced output views.
*
- * @param $file File
+ * @param File $file
* @return int 0, 90, 180 or 270
*/
public function getRotation( $file ) {
* @param bool $noHtml If to avoid returning anything resembling HTML.
* (Ugly hack for backwards compatibility with old MediaWiki).
* @param bool|IContextSource $context
- * @return String single value (in wiki-syntax).
+ * @return string Single value (in wiki-syntax).
* @since 1.23
*/
public static function flattenArrayContentLang( $vals, $type = 'ul',
* lang = language assoc array with keys being the lang code
* ul = unordered list, ol = ordered list
* type can also come from the '_type' member of $vals.
- * @param $noHtml Boolean If to avoid returning anything resembling HTML.
+ * @param bool $noHtml If to avoid returning anything resembling HTML.
* (Ugly hack for backwards compatibility with old mediawiki).
- * @return String single value (in wiki-syntax).
+ * @return string Single value (in wiki-syntax).
* @since 1.23
*/
public function flattenArrayReal( $vals, $type = 'ul', $noHtml = false ) {
/** Helper function for creating lists of translations.
*
- * @param string $value value (this is not escaped)
- * @param string $lang lang code of item or false
+ * @param string $value Value (this is not escaped)
+ * @param string $lang Lang code of item or false
* @param bool $default If it is default value.
* @param bool $noHtml If to avoid html (for back-compat)
* @throws MWException
* This is used by the media handlers that use the FormatMetadata class
*
* @param array $metadataArray Metadata array
- * @return array for use displaying metadata.
+ * @return array Array for use displaying metadata.
*/
function formatMetadataHelper( $metadataArray ) {
$result = array(
* Get a list of metadata items which should be displayed when
* the metadata table is collapsed.
*
- * @return array of strings
+ * @return array Array of strings
*/
protected function visibleMetadataFields() {
return FormatMetadata::getVisibleFields();
* Shown in file history box on image description page.
*
* @param File $file
- * @return String Dimensions
+ * @return string Dimensions
*/
function getDimensionsString( $file ) {
return '';
* Get list of languages file can be viewed in.
*
* @param File $file
- * @return Array Array of language codes, or empty array if unsupported.
+ * @return array Array of language codes, or empty array if unsupported.
* @since 1.23
*/
public function getAvailableLanguages( File $file ) {
* type do not support alternative language renderings.
*
* @param File $file
- * @return String language code or null if multi-language not supported for filetype.
+ * @return string Language code or null if multi-language not supported for filetype.
* @since 1.23
*/
public function getDefaultRenderLanguage( File $file ) {
}
/**
- * @param $title string
+ * @param string $title
* @param string|array $params Query parameters to add
* @return array
*/
* this list.
*
* @param File $file
- * @return Array of language codes, or empty if no language switching supported.
+ * @return array Array of language codes, or empty if no language switching supported.
*/
public function getAvailableLanguages( File $file ) {
$metadata = $file->getMetadata();
/**
* What language to render file in if none selected.
*
- * @return String language code.
+ * @return string Language code.
*/
public function getDefaultRenderLanguage( File $file ) {
return 'en';
}
/**
- * @return Array with the known metadata
+ * @return array Array with the known metadata
*/
public function getMetadata() {
return $this->metadata;
/** Get the result array. Do some post-processing before returning
* the array, and transform any metadata that is special-cased.
*
- * @return Array array of results as an array of arrays suitable for
+ * @return array Array of results as an array of arrays suitable for
* FormatMetadata::getFormattedData().
*/
public function getResults() {
* This is generally where most properties start.
*
* @param string $ns Namespace
- * @param string $tag tag name (without namespace prefix)
- * @param array $attribs array of attributes
+ * @param string $tag Tag name (without namespace prefix)
+ * @param array $attribs Array of attributes
* @throws MWException
*/
private function startElementModeInitial( $ns, $tag, $attribs ) {
* Generally just calls a helper based on what MODE we're in.
* Also does some initial set up for the wrapper element
*
- * @param $parser XMLParser
+ * @param XMLParser $parser
* @param string $elm Namespace "<space>" element
* @param array $attribs Attribute name => value
* @throws MWException
* choices. (closed choice)
*
* @param array $info Information about current property
- * @param &$val Mixed current value to validate
+ * @param mixed &$val Current value to validate
* @param bool $standalone If this is a simple property or array
*/
public static function validateClosed( $info, &$val, $standalone ) {
* function to validate and modify flash structure
*
* @param array $info Information about current property
- * @param &$val Mixed current value to validate
+ * @param mixed &$val Current value to validate
* @param bool $standalone If this is a simple property or array
*/
public static function validateFlash( $info, &$val, $standalone ) {
* @see http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart1.pdf page 30 (section 8.2.2.5)
*
* @param array $info Information about current property
- * @param &$val Mixed current value to validate
+ * @param mixed &$val Current value to validate
* @param bool $standalone If this is a simple property or array
*/
public static function validateLangCode( $info, &$val, $standalone ) {
}
/**
- * @param $com bool
+ * @param bool $com
* @return bool
*/
function setContainsOldMagic( $com ) {
/**
* setCacheTime() sets the timestamp expressing when the page has been rendered.
* This does not control expiry, see updateCacheExpiry() for that!
- * @param $t string
+ * @param string $t
* @return string
*/
function setCacheTime( $t ) {
/**
* @since 1.23
- * @param $id int Revision id
+ * @param int $id Revision id
*/
function setCacheRevisionId( $id ) {
$this->mCacheRevisionId = $id;
* or equal to the smallest number that was provided as an argument to
* updateCacheExpiry().
*
- * @param $seconds number
+ * @param int $seconds
*/
function updateCacheExpiry( $seconds ) {
$seconds = (int)$seconds;
* per-article cache invalidation timestamps, or if it comes from
* an incompatible older version.
*
- * @param string $touched the affected article's last touched timestamp
- * @return Boolean
+ * @param string $touched The affected article's last touched timestamp
+ * @return bool
*/
public function expired( $touched ) {
global $wgCacheEpoch;
* deployed. Someday that should probably be changed.
*
* @since 1.23
- * @param int $id the affected article's current revision id
- * @return Boolean
+ * @param int $id The affected article's current revision id
+ * @return bool
*/
public function isDifferentRevision( $id ) {
$cached = $this->getCacheRevisionId();
*/
class CoreParserFunctions {
/**
- * @param $parser Parser
+ * @param Parser $parser
* @return void
*/
static function register( $parser ) {
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $part1
* @return array
*/
* Or to encode a value for the HTTP "path", spaces are encoded as '%20'.
* For links to "wiki"s, or similar software, spaces are encoded as '_',
*
- * @param $parser Parser object
+ * @param Parser $parser
* @param string $s The text to encode.
* @param string $arg (optional): The type of encoding.
* @return string
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $s
* @return
*/
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $s
* @return
*/
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $num
* @param string $arg
* @return string
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $case
* @param string $word
* @return
}
/**
- * @param $parser Parser
- * @param $username string
+ * @param Parser $parser
+ * @param string $username
* @return
*/
static function gender( $parser, $username ) {
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $text
* @return
*/
* Override the title of the page when viewed, provided we've been given a
* title which will normalise to the canonical title
*
- * @param $parser Parser: parent parser
- * @param string $text desired title text
- * @return String
+ * @param Parser $parser Parent parser
+ * @param string $text Desired title text
+ * @return string
*/
static function displaytitle( $parser, $text = '' ) {
global $wgRestrictDisplayTitle;
/**
* Matches the given value against the value of given magic word
*
- * @param string $magicword magic word key
- * @param mixed $value value to match
- * @return boolean true on successful match
+ * @param string $magicword Magic word key
+ * @param string $value Value to match
+ * @return bool True on successful match
*/
private static function matchAgainstMagicword( $magicword, $value ) {
$value = trim( strval( $value ) );
/**
* Functions to get and normalize pagenames, corresponding to the magic words
* of the same names
- * @return String
+ * @return string
*/
static function pagename( $parser, $title = null ) {
$t = Title::newFromText( $title );
* Return the size of the given page, or 0 if it's nonexistent. This is an
* expensive parser function and can't be called too many times per page.
*
- * @param $parser Parser
- * @param $page String Name of page to check (Default: empty string)
- * @param $raw String Should number be human readable with commas or just number
+ * @param Parser $parser
+ * @param string $page Name of page to check (Default: empty string)
+ * @param string $raw Should number be human readable with commas or just number
* @return string
*/
static function pagesize( $parser, $page = '', $raw = null ) {
/**
* Gives language names.
- * @param $parser Parser
- * @param string $code Language code (of which to get name)
- * @param string $inLanguage Language code (in which to get name)
- * @return String
+ * @param Parser $parser
+ * @param string $code Language code (of which to get name)
+ * @param string $inLanguage Language code (in which to get name)
+ * @return string
*/
static function language( $parser, $code = '', $inLanguage = '' ) {
$code = strtolower( $code );
/**
* Unicode-safe str_pad with the restriction that $length is forced to be <= 500
+ * @param Parser $parser
+ * @param string $string
+ * @param int $length
+ * @param string $padding
+ * @param int $direction
* @return string
*/
static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
}
/**
- * @param $parser Parser
- * @param $text
+ * @param Parser $parser
+ * @param string $text
* @return string
*/
static function anchorencode( $parser, $text ) {
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @param string $text The sortkey to use
* @param string $uarg Either "noreplace" or "noerror" (in en)
* both suppress errors, and noreplace does nothing if
/**
* Parser function to extension tag adaptor
+ * @param Parser $parser
+ * @param PPFrame $frame
+ * @param array $args
* @return string
*/
public static function tagObj( $parser, $frame, $args ) {
* For a given title, which is equal to the current parser title,
* the revision object from the parser is used, when that is the current one
*
- * @param $parser Parser
- * @param $title Title
+ * @param Parser $parser
+ * @param Title $title
* @return Revision
* @since 1.23
*/
/**
* Get the pageid of a specified page
- * @param $parser Parser
- * @param $title string Title to get the pageid from
+ * @param Parser $parser
+ * @param string $title Title to get the pageid from
* @since 1.23
*/
public static function pageid( $parser, $title = null ) {
/**
* Get the id from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the id from
+ * @param Parser $parser
+ * @param string $title Title to get the id from
* @since 1.23
*/
public static function revisionid( $parser, $title = null ) {
/**
* Get the day from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the day from
+ * @param Parser $parser
+ * @param string $title Title to get the day from
* @since 1.23
*/
public static function revisionday( $parser, $title = null ) {
/**
* Get the day with leading zeros from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the day from
+ * @param Parser $parser
+ * @param string $title Title to get the day from
* @since 1.23
*/
public static function revisionday2( $parser, $title = null ) {
/**
* Get the month with leading zeros from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the month from
+ * @param Parser $parser
+ * @param string $title Title to get the month from
* @since 1.23
*/
public static function revisionmonth( $parser, $title = null ) {
/**
* Get the month from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the month from
+ * @param Parser $parser
+ * @param string $title Title to get the month from
* @since 1.23
*/
public static function revisionmonth1( $parser, $title = null ) {
/**
* Get the year from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the year from
+ * @param Parser $parser
+ * @param string $title Title to get the year from
* @since 1.23
*/
public static function revisionyear( $parser, $title = null ) {
/**
* Get the timestamp from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the timestamp from
+ * @param Parser $parser
+ * @param string $title Title to get the timestamp from
* @since 1.23
*/
public static function revisiontimestamp( $parser, $title = null ) {
/**
* Get the user from the last revision of a specified page.
- * @param $parser Parser
- * @param $title string Title to get the user from
+ * @param Parser $parser
+ * @param string $title Title to get the user from
* @since 1.23
*/
public static function revisionuser( $parser, $title = null ) {
*/
class CoreTagHooks {
/**
- * @param $parser Parser
+ * @param Parser $parser
* @return void
*/
static function register( $parser ) {
*
* Uses undocumented extended tag hook return values, introduced in r61913.
*
- * @param $content string
- * @param $attributes array
- * @param $parser Parser
+ * @param string $content
+ * @param array $attributes
+ * @param Parser $parser
* @throws MWException
* @return array
*/
*
* Uses undocumented extended tag hook return values, introduced in r61913.
*
- * @param $content string
- * @param $attributes array
- * @param $parser Parser
+ * @param string $content
+ * @param array $attributes
+ * @param Parser $parser
* @return array
*/
static function nowiki( $content, $attributes, $parser ) {
const LAST = 8;
/**
- * @param $lang Language In which language to format the date
+ * @param Language $lang In which language to format the date
*/
function __construct( Language $lang ) {
$this->lang = $lang;
/**
* Get a DateFormatter object
*
- * @param $lang Language|string|null In which language to format the date
+ * @param Language|string|null $lang In which language to format the date
* Defaults to the site content language
* @return DateFormatter object
*/
/**
* @param string $preference User preference
* @param string $text Text to reformat
- * @param array $options can contain 'linked' and/or 'match-whole'
+ * @param array $options Array can contain 'linked' and/or 'match-whole'
*
* @return string
*/
}
/**
- * @param $matches
+ * @param array $matches
* @return string
*/
function replace( $matches ) {
}
/**
- * @param $bits array
- * @param $link bool
+ * @param array $bits
+ * @param bool $link
* @return string
*/
function formatDate( $bits, $link = true ) {
/**
* Makes an ISO month, e.g. 02, from a month name
- * @param string $monthName month name
+ * @param string $monthName Month name
* @return string ISO month name
*/
function makeIsoMonth( $monthName ) {
* serializing at present.
*
* Compact the titles, only serialize the text form.
- * @return array
- */
+ * @return array
+ */
function __sleep() {
foreach ( $this->internals as &$nsLinks ) {
foreach ( $nsLinks as &$entry ) {
/**
* Merge another LinkHolderArray into this one
- * @param $other LinkHolderArray
+ * @param LinkHolderArray $other
*/
function merge( $other ) {
foreach ( $other->internals as $ns => $entries ) {
* converted for use in the destination link holder. The resulting array of
* strings will be returned.
*
- * @param $other LinkHolderArray
- * @param array $texts of strings
- * @return Array
+ * @param LinkHolderArray $other
+ * @param array $texts Array of strings
+ * @return array
*/
function mergeForeign( $other, $texts ) {
$this->tempIdOffset = $idOffset = $this->parent->nextLinkID();
* parsing of interwiki links, and secondly to allow all existence checks and
* article length checks (for stub links) to be bundled into a single query.
*
- * @param $nt Title
- * @param $text String
+ * @param Title $nt
+ * @param string $text
* @param array $query [optional]
* @param string $trail [optional]
* @param string $prefix [optional]
/**
* Replace <!--LINK--> link placeholders with actual links, in the buffer
*
- * @return array of link CSS classes, indexed by PDBK.
+ * @return array Array of link CSS classes, indexed by PDBK.
*/
function replace( &$text ) {
wfProfileIn( __METHOD__ );
/**
* Replace internal links
+ * @param string $text
*/
protected function replaceInternal( &$text ) {
if ( !$this->internals ) {
/**
* Replace interwiki links
+ * @param string $text
*/
protected function replaceInterwiki( &$text ) {
if ( empty( $this->interwikis ) ) {
/**
* Modify $this->internals and $colours according to language variant linking rules
+ * @param array $colours
*/
protected function doVariants( &$colours ) {
global $wgContLang;
* Replace <!--LINK--> link placeholders with plain text of links
* (not HTML-formatted).
*
- * @param $text String
- * @return String
+ * @param string $text
+ * @return string
*/
function replaceText( $text ) {
wfProfileIn( __METHOD__ );
/**
* Callback for replaceText()
*
- * @param $matches Array
+ * @param array $matches
* @return string
* @private
*/
var $mUniqPrefix;
/**
- * @var Array with the language name of each language link (i.e. the
+ * @var array Array with the language name of each language link (i.e. the
* interwiki prefix) in the key, value arbitrary. Used to avoid sending
* duplicate language links to the ParserOutput.
*/
/**
* Constructor
*
- * @param $conf array
+ * @param array $conf
*/
public function __construct( $conf = array() ) {
$this->mConf = $conf;
* Do not call this function recursively.
*
* @param string $text text we want to parse
- * @param $title Title object
- * @param $options ParserOptions
- * @param $linestart boolean
- * @param $clearState boolean
- * @param int $revid number to pass in {{REVISIONID}}
- * @return ParserOutput a ParserOutput
+ * @param Title $title
+ * @param ParserOptions $options
+ * @param bool $linestart
+ * @param bool $clearState
+ * @param int $revid Number to pass in {{REVISIONID}}
+ * @return ParserOutput A ParserOutput
*/
public function parse( $text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null ) {
/**
*
* If $frame is not provided, then template variables (e.g., {{{1}}}) within $text are not expanded
*
- * @param string $text text extension wants to have parsed
+ * @param string $text Text extension wants to have parsed
* @param PPFrame $frame The frame to use for expanding any template variables
*
* @return string
/**
* Expand templates and variables in the text, producing valid, static wikitext.
* Also removes comments.
+ * @param string $text
+ * @param Title $title
+ * @param ParserOptions $options
+ * @param int|null $revid
* @return mixed|string
*/
function preprocess( $text, Title $title = null, ParserOptions $options, $revid = null ) {
* Recursive parser entry point that can be called from an extension tag
* hook.
*
- * @param string $text text to be expanded
+ * @param string $text Text to be expanded
* @param PPFrame $frame The frame to use for expanding any template variables
* @return string
* @since 1.19
* transclusion, comments, templates, arguments, tags hooks and parser
* functions are untouched.
*
- * @param $text String
- * @param $title Title
- * @param $options ParserOptions
- * @param $params Array
- * @return String
+ * @param string $text
+ * @param Title $title
+ * @param ParserOptions $options
+ * @param array $params
+ * @return string
*/
public function getPreloadText( $text, Title $title, ParserOptions $options, $params = array() ) {
$msg = new RawMessage( $text );
/**
* Accessor for mUniqPrefix.
*
- * @return String
+ * @return string
*/
public function uniqPrefix() {
if ( !isset( $this->mUniqPrefix ) ) {
/**
* Set the context title
*
- * @param $t Title
+ * @param Title $t
*/
function setTitle( $t ) {
if ( !$t ) {
/**
* Accessor for the Title object
*
- * @return Title object
+ * @return Title
*/
function getTitle() {
return $this->mTitle;
/**
* Accessor/mutator for the Title object
*
- * @param $x Title object or null to just get the current one
- * @return Title object
+ * @param Title $x Title object or null to just get the current one
+ * @return Title
*/
function Title( $x = null ) {
return wfSetVar( $this->mTitle, $x );
/**
* Set the output type
*
- * @param int $ot new value
+ * @param int $ot New value
*/
function setOutputType( $ot ) {
$this->mOutputType = $ot;
* Accessor/mutator for the output type
*
* @param int|null $x New value or null to just get the current one
- * @return Integer
+ * @return int
*/
function OutputType( $x = null ) {
return wfSetVar( $this->mOutputType, $x );
/**
* Get the ParserOutput object
*
- * @return ParserOutput object
+ * @return ParserOutput
*/
function getOutput() {
return $this->mOutput;
/**
* Accessor/mutator for the ParserOptions object
*
- * @param $x ParserOptions New value or null to just get the current one
+ * @param ParserOptions $x New value or null to just get the current one
* @return ParserOptions Current ParserOptions object
*/
function Options( $x = null ) {
}
/**
- * @param $id int
+ * @param int $id
*/
function setLinkID( $id ) {
$this->mLinkID = $id;
/**
* Get the language object for language conversion
+ * @return Language|null
*/
function getConverterLanguage() {
return $this->getTargetLanguage();
* Get a User object either from $this->mUser, if set, or from the
* ParserOptions object otherwise
*
- * @return User object
+ * @return User
*/
function getUser() {
if ( !is_null( $this->mUser ) ) {
/**
* Get a preprocessor object
*
- * @return Preprocessor instance
+ * @return Preprocessor
*/
function getPreprocessor() {
if ( !isset( $this->mPreprocessor ) ) {
* Returns the unique tag which must be inserted into the stripped text
* The tag will be replaced with the original text in unstrip()
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
* parse the wiki syntax used to render tables
*
* @private
+ * @param string $text
* @return string
*/
function doTableStuff( $text ) {
*
* @private
*
- * @param $text string
- * @param $isMain bool
- * @param $frame bool
+ * @param string $text
+ * @param bool $isMain
+ * @param bool $frame
*
* @return string
*/
* DML
* @private
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
/**
* @throws MWException
- * @param $m array
+ * @param array $m
* @return HTML|string
*/
function magicLinkCallback( $m ) {
/**
* Make a free external link, given a user-supplied URL
*
- * @param $url string
+ * @param string $url
*
* @return string HTML
* @private
*
* @private
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
* Replace single quotes with HTML markup
* @private
*
- * @param $text string
+ * @param string $text
*
* @return string the altered text
*/
/**
* Helper function for doAllQuotes()
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
*
* @private
*
- * @param $text string
+ * @param string $text
*
* @throws MWException
* @return string
* Get the rel attribute for a particular external link.
*
* @since 1.21
- * @param string|bool $url optional URL, to extract the domain from for rel =>
+ * @param string|bool $url Optional URL, to extract the domain from for rel =>
* nofollow if appropriate
- * @param $title Title optional Title, for wgNoFollowNsExceptions lookups
- * @return string|null rel attribute for $url
+ * @param Title $title Optional Title, for wgNoFollowNsExceptions lookups
+ * @return string|null Rel attribute for $url
*/
public static function getExternalLinkRel( $url = false, $title = null ) {
global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions;
* (depending on configuration, namespace, and the URL's domain) and/or a
* target attribute (depending on configuration).
*
- * @param string|bool $url optional URL, to extract the domain from for rel =>
+ * @param string|bool $url Optional URL, to extract the domain from for rel =>
* nofollow if appropriate
- * @return Array associative array of HTML attributes
+ * @return array Associative array of HTML attributes
*/
function getExternalLinkAttribs( $url = false ) {
$attribs = array();
/**
* Replace unusual URL escape codes with their equivalent characters
*
- * @param $url String
- * @return String
+ * @param string $url
+ * @return string
*
* @todo This can merge genuinely required bits in the path or query string,
* breaking legit URLs. A proper fix would treat the various parts of
* Callback function used in replaceUnusualEscapes().
* Replaces unusual URL escape codes with their equivalent character
*
- * @param $matches array
+ * @param array $matches
*
* @return string
*/
* option, through the exception, or through the on-wiki whitelist
* @private
*
- * $param $url string
+ * $param string $url
*
* @return string
*/
/**
* Process [[ ]] wikilinks (RIL)
- * @param $s
+ * @param string $s
* @throws MWException
* @return LinkHolderArray
*
/**
* Return true if subpage links should be expanded on this page.
- * @return Boolean
+ * @return bool
*/
function areSubpagesAllowed() {
# Some namespaces don't allow subpages
* of both arguments, starting at the beginning of both.
* @private
*
- * @param $st1 string
- * @param $st2 string
+ * @param string $st1
+ * @param string $st2
*
* @return int
*/
* element appropriate to the prefix character passed into them.
* @private
*
- * @param $char string
+ * @param string $char
*
* @return string
*/
/**
* TODO: document
- * @param $char String
+ * @param string $char
* @private
*
* @return string
/**
* TODO: document
- * @param $char String
+ * @param string $char
* @private
*
* @return string
* Split up a string on ':', ignoring any occurrences inside tags
* to prevent illegal overlapping.
*
- * @param string $str the string to split
- * @param &$before String set to everything before the ':'
- * @param &$after String set to everything after the ':'
+ * @param string $str The string to split
+ * @param string &$before Set to everything before the ':'
+ * @param string &$after Set to everything after the ':'
* @throws MWException
- * @return String the position of the ':', or false if none found
+ * @return string The position of the ':', or false if none found
*/
function findColonNoLinks( $str, &$before, &$after ) {
wfProfileIn( __METHOD__ );
*
* @private
*
- * @param $index integer
- * @param bool|\PPFrame $frame
+ * @param int $index
+ * @param bool|PPFrame $frame
*
* @throws MWException
* @return string
/**
* Return a three-element array: leading whitespace, string contents, trailing whitespace
*
- * @param $s string
+ * @param string $s
*
* @return array
*/
* self::OT_PREPROCESS: templates but not extension tags
* self::OT_HTML: all templates and extension tags
*
- * @param string $text the text to transform
- * @param $frame PPFrame Object describing the arguments passed to the template.
+ * @param string $text The text to transform
+ * @param PPFrame $frame Object describing the arguments passed to the template.
* Arguments may also be provided as an associative array, as was the usual case before MW1.12.
* Providing arguments this way may be useful for extensions wishing to perform variable replacement explicitly.
- * @param $argsOnly Boolean only do argument (triple-brace) expansion, not double-brace expansion
+ * @param bool $argsOnly Only do argument (triple-brace) expansion, not double-brace expansion
* @private
*
* @return string
/**
* Clean up argument array - refactored in 1.9 so parserfunctions can use it, too.
*
- * @param $args array
+ * @param array $args
*
* @return array
*/
* Warn the user when a parser limitation is reached
* Will warn at most once the user per limitation type
*
- * @param string $limitationType should be one of:
+ * @param string $limitationType Should be one of:
* 'expensive-parserfunction' (corresponding messages:
* 'expensive-parserfunction-warning',
* 'expensive-parserfunction-category')
* nowiki: bool, wiki markup in $text should be escaped
*
* @since 1.21
- * @param $frame PPFrame The current frame, contains template arguments
- * @param $function string Function name
- * @param $args array Arguments to the function
+ * @param PPFrame $frame The current frame, contains template arguments
+ * @param string $function Function name
+ * @param array $args Arguments to the function
* @return array
*/
public function callParserFunction( $frame, $function, array $args = array() ) {
* Get the semi-parsed DOM representation of a template with a given title,
* and its redirect destination title. Cached.
*
- * @param $title Title
+ * @param Title $title
*
* @return array
*/
/**
* Fetch the unparsed text of a template and register a reference to it.
* @param Title $title
- * @return Array ( string or false, Title )
+ * @return array ( string or false, Title )
*/
function fetchTemplateAndTitle( $title ) {
$templateCb = $this->mOptions->getTemplateCallback(); # Defaults to Parser::statelessFetchTemplate()
/**
* Fetch the unparsed text of a template and register a reference to it.
* @param Title $title
- * @return mixed string or false
+ * @return string|bool
*/
function fetchTemplate( $title ) {
$rv = $this->fetchTemplateAndTitle( $title );
* If 'broken' is a key in $options then the file will appear as a broken thumbnail.
* @param Title $title
* @param array $options Array of options to RepoGroup::findFile
- * @return Array ( File or false, Title of file )
+ * @return array ( File or false, Title of file )
*/
function fetchFileAndTitle( $title, $options = array() ) {
$file = $this->fetchFileNoRegister( $title, $options );
*
* @param Title $title
* @param array $options Array of options to RepoGroup::findFile
- * @return File or false
+ * @return File|bool
*/
protected function fetchFileNoRegister( $title, $options = array() ) {
if ( isset( $options['broken'] ) ) {
/**
* Transclude an interwiki link.
*
- * @param $title Title
- * @param $action
+ * @param Title $title
+ * @param string $action
*
* @return string
*/
}
/**
- * @param $url string
- * @return Mixed|String
+ * @param string $url
+ * @return mixed|string
*/
function fetchScaryTemplateMaybeFromCache( $url ) {
global $wgTranscludeCacheExpiry;
* Triple brace replacement -- used for template arguments
* @private
*
- * @param $piece array
- * @param $frame PPFrame
+ * @param array $piece
+ * @param PPFrame $frame
*
* @return array
*/
* attributes Optional associative array of parsed attributes
* inner Contents of extension element
* noClose Original text did not have a close tag
- * @param $frame PPFrame
+ * @param PPFrame $frame
*
* @throws MWException
* @return string
*
* @param string $type The type of expansion
* @param int $size The size of the text
- * @return bool false if this inclusion would take it over the maximum, true otherwise
+ * @return bool False if this inclusion would take it over the maximum, true otherwise
*/
function incrementIncludeSize( $type, $size ) {
if ( $this->mIncludeSizes[$type] + $size > $this->mOptions->getMaxIncludeSize() ) {
/**
* Increment the expensive function count
*
- * @return bool false if the limit has been exceeded
+ * @return bool False if the limit has been exceeded
*/
function incrementExpensiveFunctionCount() {
$this->mExpensiveFunctionCount++;
* Strip double-underscore items like __NOGALLERY__ and __NOTOC__
* Fills $this->mDoubleUnderscores, returns the modified text
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
* It loops through all headlines, collects the necessary data, then splits up the
* string and re-inserts the newly formatted headlines.
*
- * @param $text String
- * @param string $origText original, untouched wikitext
- * @param $isMain Boolean
+ * @param string $text
+ * @param string $origText Original, untouched wikitext
+ * @param bool $isMain
* @return mixed|string
* @private
*/
/**
* Pre-save transform helper function
*
- * @param $text string
- * @param $user User
+ * @param string $text
+ * @param User $user
*
* @return string
*/
* Do not reuse this parser instance after calling getUserSig(),
* as it may have changed if it's the $wgParser.
*
- * @param $user User
- * @param string|bool $nickname nickname to use or false to use user's default nickname
- * @param $fancySig Boolean|null whether the nicknname is the complete signature
- * or null to use default value
+ * @param User $user
+ * @param string|bool $nickname Nickname to use or false to use user's default nickname
+ * @param bool|null $fancySig whether the nicknname is the complete signature
+ * or null to use default value
* @return string
*/
function getUserSig( &$user, $nickname = false, $fancySig = null ) {
/**
* Check that the user's signature contains no bad XML
*
- * @param $text String
- * @return mixed An expanded string, or false if invalid.
+ * @param string $text
+ * @return string|bool An expanded string, or false if invalid.
*/
function validateSig( $text ) {
return Xml::isWellFormedXmlFragment( $text ) ? $text : false;
* Set up some variables which are usually set up in parse()
* so that an external function can call some class members with confidence
*
- * @param $title Title|null
- * @param $options ParserOptions
- * @param $outputType
- * @param $clearState bool
+ * @param Title|null $title
+ * @param ParserOptions $options
+ * @param int $outputType
+ * @param bool $clearState
*/
public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) {
$this->startParse( $title, $options, $outputType, $clearState );
}
/**
- * @param $title Title|null
- * @param $options ParserOptions
- * @param $outputType
- * @param $clearState bool
+ * @param Title|null $title
+ * @param ParserOptions $options
+ * @param int $outputType
+ * @param bool $clearState
*/
private function startParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) {
$this->setTitle( $title );
/**
* Get all registered function hook identifiers
*
- * @return Array
+ * @return array
*/
function getFunctionHooks() {
return array_keys( $this->mFunctionHooks );
* Create a tag function, e.g. "<test>some stuff</test>".
* Unlike tag hooks, tag functions are parsed at preprocessor level.
* Unlike parser functions, their content is not preprocessed.
- * @param $tag
- * @param $callback
- * @param $flags
+ * @param string $tag
+ * @param callable $callback
+ * @param int $flags
* @throws MWException
* @return null
*/
* Replace "<!--LINK-->" link placeholders with actual links, in the buffer
* Placeholders created in Skin::makeLinkObj()
*
- * @param $text string
- * @param $options int
+ * @param string $text
+ * @param int $options
*
- * @return array of link CSS classes, indexed by PDBK.
+ * @return array Array of link CSS classes, indexed by PDBK.
*/
function replaceLinkHolders( &$text, $options = 0 ) {
return $this->mLinkHolders->replace( $text );
* Replace "<!--LINK-->" link placeholders with plain text of links
* (not HTML-formatted).
*
- * @param $text String
- * @return String
+ * @param string $text
+ * @return string
*/
function replaceLinkHoldersText( $text ) {
return $this->mLinkHolders->replaceText( $text );
}
/**
- * @param $handler
+ * @param string $handler
* @return array
*/
function getImageParams( $handler ) {
/**
* Parse image options text and use it to make an image
*
- * @param $title Title
- * @param $options String
- * @param $holders LinkHolderArray|bool
+ * @param Title $title
+ * @param string $options
+ * @param LinkHolderArray|bool $holders
* @return string HTML
*/
function makeImage( $title, $options, $holders = false ) {
}
/**
- * @param $caption
- * @param $holders LinkHolderArray
- * @return mixed|String
+ * @param string $caption
+ * @param LinkHolderArray $holders
+ * @return mixed|string
*/
protected function stripAltText( $caption, $holders ) {
# Strip bad stuff out of the title (tooltip). We can't just use
* Callback from the Sanitizer for expanding items found in HTML attribute
* values, so they can be safely tested and escaped.
*
- * @param $text String
- * @param $frame PPFrame
- * @return String
+ * @param string $text
+ * @param PPFrame $frame
+ * @return string
*/
function attributeStripCallback( &$text, $frame = false ) {
$text = $this->replaceVariables( $text, $frame );
* Transparent tag hooks are like regular XML-style tag hooks, except they
* operate late in the transformation sequence, on HTML instead of wikitext.
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
* External callers should use the getSection and replaceSection methods.
*
* @param string $text Page wikitext
- * @param string $section a section identifier string of the form:
+ * @param string $section A section identifier string of the form:
* "<flag1> - <flag2> - ... - <section number>"
*
* Currently the only recognised flag is "T", which means the target section number
*
* If a section contains subsections, these are also returned.
*
- * @param string $text text to look in
- * @param string $section section identifier
- * @param string $deftext default to return if section is not found
- * @return string text of the requested section
+ * @param string $text Text to look in
+ * @param string $section Section identifier
+ * @param string $deftext Default to return if section is not found
+ * @return string Text of the requested section
*/
public function getSection( $text, $section, $deftext = '' ) {
return $this->extractSections( $text, $section, "get", $deftext );
/**
* Get the revision object for $this->mRevisionId
*
- * @return Revision|null either a Revision object or null
+ * @return Revision|null Either a Revision object or null
* @since 1.23 (public since 1.23)
*/
public function getRevisionObject() {
/**
* Get the timestamp associated with the current revision, adjusted for
* the default server-local timestamp
+ * @return string
*/
function getRevisionTimestamp() {
if ( is_null( $this->mRevisionTimestamp ) ) {
/**
* Get the size of the revision
*
- * @return int|null revision size
+ * @return int|null Revision size
*/
function getRevisionSize() {
if ( is_null( $this->mRevisionSize ) ) {
* Accessor for $mDefaultSort
* Unlike getDefaultSort(), will return false if none is set
*
- * @return string or false
+ * @return string|bool
*/
public function getCustomDefaultSort() {
return $this->mDefaultSort;
* presumably extracted from a heading, for example "Header" from
* "== Header ==".
*
- * @param $text string
+ * @param string $text
*
* @return string
*/
* to create valid section anchors by mimicing the output of the
* parser when headings are parsed.
*
- * @param string $text text string to be stripped of wikitext
+ * @param string $text Text string to be stripped of wikitext
* for use in a Section anchor
* @return string Filtered text string
*/
/**
* strip/replaceVariables/unstrip for preprocessor regression testing
*
- * @param $text string
- * @param $title Title
- * @param $options ParserOptions
- * @param $outputType int
+ * @param string $text
+ * @param Title $title
+ * @param ParserOptions $options
+ * @param int $outputType
*
* @return string
*/
}
/**
- * @param $text string
- * @param $title Title
- * @param $options ParserOptions
+ * @param string $text
+ * @param Title $title
+ * @param ParserOptions $options
* @return string
*/
function testPst( $text, Title $title, ParserOptions $options ) {
}
/**
- * @param $text
- * @param $title Title
- * @param $options ParserOptions
+ * @param string $text
+ * @param Title $title
+ * @param ParserOptions $options
* @return string
*/
function testPreprocess( $text, Title $title, ParserOptions $options ) {
* two strings will be replaced with the value returned by the callback in
* each case.
*
- * @param $s string
- * @param $callback
+ * @param string $s
+ * @param callable $callback
*
* @return string
*/
/**
* Remove any strip markers found in the given text.
*
- * @param $text Input string
+ * @param string $text Input string
* @return string
*/
function killMarkers( $text ) {
* unserializeHalfParsedText(). The text can then be safely incorporated into
* the return value of a parser hook.
*
- * @param $text string
+ * @param string $text
*
* @return array
*/
*
* @param array $data Serialized data
* @throws MWException
- * @return String
+ * @return string
*/
function unserializeHalfParsedText( $data ) {
if ( !isset( $data['version'] ) || $data['version'] != self::HALF_PARSED_VERSION ) {
* serializeHalfParsedText(), is compatible with the current version of the
* parser.
*
- * @param $data Array
+ * @param array $data
*
* @return bool
*/
/**
* Parsed a width param of imagelink like 300px or 200x300px
*
- * @param $value String
+ * @param string $value
*
* @return array
* @since 1.20
* Setup a cache pathway with a given back-end storage mechanism.
* May be a memcached client or a BagOStuff derivative.
*
- * @param $memCached Object
+ * @param MWMemcached $memCached
* @throws MWException
*/
protected function __construct( $memCached ) {
}
/**
- * @param $article Article
- * @param $hash string
+ * @param Article $article
+ * @param string $hash
* @return mixed|string
*/
protected function getParserOutputKey( $article, $hash ) {
}
/**
- * @param $article Article
+ * @param Article $article
* @return mixed|string
*/
protected function getOptionsKey( $article ) {
* English preferences. That's why we take into account *all* user
* options. (r70809 CR)
*
- * @param $article Article
- * @param $popts ParserOptions
+ * @param Article $article
+ * @param ParserOptions $popts
* @return string
*/
function getETag( $article, $popts ) {
/**
* Retrieve the ParserOutput from ParserCache, even if it's outdated.
- * @param $article Article
- * @param $popts ParserOptions
+ * @param Article $article
+ * @param ParserOptions $popts
* @return ParserOutput|bool False on failure
*/
public function getDirty( $article, $popts ) {
*
* {{int: }} uses this which used to produce inconsistent link tables (bug 14404).
*
- * @return Language object
+ * @return Language
* @since 1.19
*/
function getUserLangObj() {
/**
* Same as getUserLangObj() but returns a string instead.
*
- * @return String Language code
+ * @return string Language code
* @since 1.17
*/
function getUserLang() {
/**
* Constructor
- * @param $user User object
- * @param $lang Language object
+ * @param User $user
+ * @param Language $lang
*/
function __construct( $user = null, $lang = null ) {
if ( $user === null ) {
* Get a ParserOptions object from a given user.
* Language will be taken from $wgLang.
*
- * @param $user User object
- * @return ParserOptions object
+ * @param User $user
+ * @return ParserOptions
*/
public static function newFromUser( $user ) {
return new ParserOptions( $user );
/**
* Get a ParserOptions object from a given user and language
*
- * @param $user User object
- * @param $lang Language object
- * @return ParserOptions object
+ * @param User $user
+ * @param Language $lang
+ * @return ParserOptions
*/
public static function newFromUserAndLang( User $user, Language $lang ) {
return new ParserOptions( $user, $lang );
/**
* Get a ParserOptions object from a IContextSource object
*
- * @param $context IContextSource object
- * @return ParserOptions object
+ * @param IContextSource $context
+ * @return ParserOptions
*/
public static function newFromContext( IContextSource $context ) {
return new ParserOptions( $context->getUser(), $context->getLanguage() );
/**
* Get user options
*
- * @param $user User object
- * @param $lang Language object
+ * @param User $user
+ * @param Language $lang
*/
private function initialiseFromUser( $user, $lang ) {
global $wgInterwikiMagic, $wgAllowExternalImages,
/**
* Registers a callback for tracking which ParserOptions which are used.
* This is a private API with the parser.
+ * @param callable $callback
*/
function registerWatcher( $callback ) {
$this->onAccessCallback = $callback;
/**
* Called when an option is accessed.
- * @param string $optionName name of the option
+ * @param string $optionName Name of the option
*/
public function optionUsed( $optionName ) {
if ( $this->onAccessCallback ) {
/**
* callback used by getText to replace editsection tokens
* @private
- * @param $m
+ * @param array $m
* @throws MWException
* @return mixed
*/
/**
* Checks, if a url is pointing to the own server
*
- * @param string $internal the server to check against
- * @param string $url the url to check
+ * @param string $internal The server to check against
+ * @param string $url The url to check
* @return bool
*/
static function isLinkInternal( $internal, $url ) {
/**
* Record a local or interwiki inline link for saving in future link tables.
*
- * @param $title Title object
- * @param $id Mixed: optional known page_id so we can skip the lookup
+ * @param Title $title
+ * @param int|null $id Optional known page_id so we can skip the lookup
*/
function addLink( Title $title, $id = null ) {
if ( $title->isExternal() ) {
* Register a file dependency for this output
* @param string $name Title dbKey
* @param string $timestamp MW timestamp of file creation (or false if non-existing)
- * @param string $sha1 base 36 SHA-1 of file (or false if non-existing)
+ * @param string $sha1 Base 36 SHA-1 of file (or false if non-existing)
* @return void
*/
function addImage( $name, $timestamp = null, $sha1 = null ) {
/**
* Register a template dependency for this output
- * @param $title Title
- * @param $page_id
- * @param $rev_id
+ * @param Title $title
+ * @param int $page_id
+ * @param int $rev_id
* @return void
*/
function addTemplate( $title, $page_id, $rev_id ) {
}
/**
- * @param $title Title object, must be an interwiki link
+ * @param Title $title Title object, must be an interwiki link
* @throws MWException if given invalid input
*/
function addInterwikiLink( $title ) {
* Add some text to the "<head>".
* If $tag is set, the section with that tag will only be included once
* in a given page.
+ * @param string $section
+ * @param string|bool $tag
*/
function addHeadItem( $section, $tag = false ) {
if ( $tag !== false ) {
/**
* Add one or more variables to be set in mw.config in JavaScript.
*
- * @param $keys {String|Array} Key or array of key/value pairs.
- * @param $value {Mixed} [optional] Value of the configuration variable.
+ * @param string|array $keys Key or array of key/value pairs.
+ * @param mixed $value [optional] Value of the configuration variable.
* @since 1.23
*/
public function addJsConfigVars( $keys, $value = null ) {
/**
* Copy items from the OutputPage object into this one
*
- * @param $out OutputPage object
+ * @param OutputPage $out
*/
public function addOutputPageMetadata( OutputPage $out ) {
$this->addModules( $out->getModules() );
/**
* Get the title to be used for display
*
- * @return String
+ * @return string
*/
public function getDisplayTitle() {
$t = $this->getTitleText();
/**
* Returns the options from its ParserOptions which have been taken
* into account to produce this output or false if not available.
- * @return mixed Array
+ * @return array
*/
public function getUsedOptions() {
if ( !isset( $this->mAccessedOptions ) ) {
* @see ParserCache::save
* @see ParserOptions::addExtraKey
* @see ParserOptions::optionsHash
+ * @param string $option
*/
public function recordOption( $option ) {
$this->mAccessedOptions[$option] = true;
*
* @since 1.20
*
- * @param $title Title The title of the page we're updating. If not given, a title object will be created
- * based on $this->getTitleText()
- * @param $recursive Boolean: queue jobs for recursive updates?
+ * @param Title $title The title of the page we're updating. If not given, a title object will
+ * be created based on $this->getTitleText()
+ * @param bool $recursive Queue jobs for recursive updates?
*
- * @return Array. An array of instances of DataUpdate
+ * @return array An array of instances of DataUpdate
*/
public function getSecondaryDataUpdates( Title $title = null, $recursive = true ) {
if ( is_null( $title ) ) {
* @since 1.21
*
* @param string $key The key for accessing the data. Extensions should take care to avoid
- * conflicts in naming keys. It is suggested to use the extension's name as a
- * prefix.
+ * conflicts in naming keys. It is suggested to use the extension's name as a prefix.
*
* @param mixed $value The value to set. Setting a value to null is equivalent to removing
- * the value.
+ * the value.
*/
public function setExtensionData( $key, $value ) {
if ( $value === null ) {
}
/**
- * @param $parser Parser
+ * @param Parser $parser
* @return bool
*/
function onClearState( &$parser ) {
/**
* Create a new preprocessor object based on an initialised Parser object
*
- * @param $parser Parser
+ * @param Parser $parser
*/
function __construct( $parser );
/**
* Create a new custom frame for programmatic use of parameter replacement as used in some extensions
*
- * @param $args array
+ * @param array $args
*
* @return PPFrame
*/
/**
* Create a new custom node for programmatic use of parameter replacement as used in some extensions
*
- * @param $values
+ * @param array $values
*/
function newPartNodeArray( $values );
/**
* Preprocess text to a PPNode
*
- * @param $text
- * @param $flags
+ * @param string $text
+ * @param int $flags
*
* @return PPNode
*/
/**
* Returns true if the infinite loop check is OK, false if a loop is detected
*
- * @param $title
- *
+ * @param Title $title
* @return bool
*/
function loopCheck( $title );
}
/**
- * @param $args array
+ * @param array $args
* @return PPCustomFrame_DOM
*/
function newCustomFrame( $args ) {
}
/**
- * @param $values
+ * @param array $values
* @return PPNode_DOM
*/
function newPartNodeArray( $values ) {
* Preprocess some wikitext and return the document tree.
* This is the ghost of Parser::replace_variables().
*
- * @param string $text the text to parse
- * @param $flags Integer: bitwise combination of:
- * Parser::PTD_FOR_INCLUSION Handle "<noinclude>" and "<includeonly>" as if the text is being
- * included. Default is to assume a direct page view.
+ * @param string $text The text to parse
+ * @param int $flags Bitwise combination of:
+ * Parser::PTD_FOR_INCLUSION Handle "<noinclude>" and "<includeonly>" as if the text is being
+ * included. Default is to assume a direct page view.
*
* The generated DOM tree must depend only on the input text and the flags.
* The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899.
}
/**
- * @param $text string
- * @param $flags int
+ * @param string $text
+ * @param int $flags
* @return string
*/
function preprocessToXml( $text, $flags = 0 ) {
/**
* Construct a new preprocessor frame.
- * @param $preprocessor Preprocessor The parent preprocessor
+ * @param Preprocessor $preprocessor The parent preprocessor
*/
function __construct( $preprocessor ) {
$this->preprocessor = $preprocessor;
* Create a new child frame
* $args is optionally a multi-root PPNode or array containing the template arguments
*
+ * @param bool|array $args
+ * @param Title|bool $title
+ * @param int $indexOffset
* @return PPTemplateFrame_DOM
*/
function newChild( $args = false, $title = false, $indexOffset = 0 ) {
/**
* @throws MWException
- * @param $root
- * @param $flags int
+ * @param string|PPNode_DOM|DOMDocument $root
+ * @param int $flags
* @return string
*/
function expand( $root, $flags = 0 ) {
}
/**
- * @param $sep
- * @param $flags
+ * @param string $sep
+ * @param int $flags
* @return string
*/
function implodeWithFlags( $sep, $flags /*, ... */ ) {
* Implode with no flags specified
* This previously called implodeWithFlags but has now been inlined to reduce stack depth
*
+ * @param string $sep
* @return string
*/
function implode( $sep /*, ... */ ) {
* Makes an object that, when expand()ed, will be the same as one obtained
* with implode()
*
+ * @param string $sep
* @return array
*/
function virtualImplode( $sep /*, ... */ ) {
/**
* Virtual implode with brackets
+ * @param string $start
+ * @param string $sep
+ * @param string $end
* @return array
*/
function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
/**
* Returns true if the infinite loop check is OK, false if a loop is detected
*
+ * @param Title $title
* @return bool
*/
function loopCheck( $title ) {
var $numberedExpansionCache, $namedExpansionCache;
/**
- * @param $preprocessor
- * @param $parent PPFrame_DOM
- * @param $numberedArgs array
- * @param $namedArgs array
- * @param $title Title
+ * @param Preprocessor $preprocessor
+ * @param PPFrame_DOM $parent
+ * @param array $numberedArgs
+ * @param array $namedArgs
+ * @param Title $title
*/
function __construct( $preprocessor, $parent = false, $numberedArgs = array(), $namedArgs = array(), $title = false ) {
parent::__construct( $preprocessor );
}
/**
- * @param $type
+ * @param string $type
*
* @return bool|PPNode_DOM
*/
}
/**
- * @param $i
+ * @param int $i
* @return bool|PPNode_DOM
*/
function item( $i ) {
}
/**
- * @param $args array
+ * @param array $args
* @return PPCustomFrame_Hash
*/
function newCustomFrame( $args ) {
}
/**
- * @param $values array
+ * @param array $values
* @return PPNode_Hash_Array
*/
function newPartNodeArray( $values ) {
* Preprocess some wikitext and return the document tree.
* This is the ghost of Parser::replace_variables().
*
- * @param string $text the text to parse
- * @param $flags Integer: bitwise combination of:
- * Parser::PTD_FOR_INCLUSION Handle "<noinclude>" and "<includeonly>" as if the text is being
- * included. Default is to assume a direct page view.
+ * @param string $text The text to parse
+ * @param int $flags Bitwise combination of:
+ * Parser::PTD_FOR_INCLUSION Handle "<noinclude>" and "<includeonly>" as if the text is being
+ * included. Default is to assume a direct page view.
*
* The generated DOM tree must depend only on the input text and the flags.
* The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899.
/**
* Get the accumulator that would result if the close is not found.
*
+ * @param int|bool $openingCount
* @return PPDAccum_Hash
*/
function breakSyntax( $openingCount = false ) {
/**
* Append a string literal
+ * @param string $s
*/
function addLiteral( $s ) {
if ( $this->lastNode === false ) {
/**
* Append a PPNode
+ * @param PPNode $node
*/
function addNode( PPNode $node ) {
if ( $this->lastNode === false ) {
/**
* Append a tree node with text contents
+ * @param string $name
+ * @param string $value
*/
function addNodeWithText( $name, $value ) {
$node = PPNode_Hash_Tree::newWithText( $name, $value );
* Append a PPAccum_Hash
* Takes over ownership of the nodes in the source argument. These nodes may
* subsequently be modified, especially nextSibling.
+ * @param PPAccum_Hash $accum
*/
function addAccum( $accum ) {
if ( $accum->lastNode === false ) {
/**
* Construct a new preprocessor frame.
- * @param $preprocessor Preprocessor: the parent preprocessor
+ * @param Preprocessor $preprocessor The parent preprocessor
*/
function __construct( $preprocessor ) {
$this->preprocessor = $preprocessor;
* Create a new child frame
* $args is optionally a multi-root PPNode or array containing the template arguments
*
- * @param array|bool|\PPNode_Hash_Array $args PPNode_Hash_Array|array
- * @param $title Title|bool
- *
+ * @param array|bool|PPNode_Hash_Array $args
+ * @param Title|bool $title
* @param int $indexOffset
* @throws MWException
* @return PPTemplateFrame_Hash
/**
* @throws MWException
- * @param $root
- * @param $flags int
+ * @param string|PPNode$root
+ * @param int $flags
* @return string
*/
function expand( $root, $flags = 0 ) {
}
/**
- * @param $sep
- * @param $flags
+ * @param string $sep
+ * @param int $flags
* @return string
*/
function implodeWithFlags( $sep, $flags /*, ... */ ) {
/**
* Implode with no flags specified
* This previously called implodeWithFlags but has now been inlined to reduce stack depth
+ * @param string $sep
* @return string
*/
function implode( $sep /*, ... */ ) {
* Makes an object that, when expand()ed, will be the same as one obtained
* with implode()
*
+ * @param string $sep
* @return PPNode_Hash_Array
*/
function virtualImplode( $sep /*, ... */ ) {
/**
* Virtual implode with brackets
*
+ * @param string $start
+ * @param string $sep
+ * @param string $end
* @return PPNode_Hash_Array
*/
function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
}
/**
- * @param $level bool
- * @return array|bool|String
+ * @param bool $level
+ * @return array|bool|string
*/
function getPDBK( $level = false ) {
if ( $level === false ) {
}
/**
- * @param $name
+ * @param string $name
* @return bool
*/
function getArgument( $name ) {
/**
* Returns true if the infinite loop check is OK, false if a loop is detected
*
- * @param $title Title
+ * @param Title $title
*
* @return bool
*/
var $numberedExpansionCache, $namedExpansionCache;
/**
- * @param $preprocessor
- * @param $parent
- * @param $numberedArgs array
- * @param $namedArgs array
- * @param $title Title
+ * @param Preprocessor $preprocessor
+ * @param bool|PPFrame $parent
+ * @param array $numberedArgs
+ * @param array $namedArgs
+ * @param Title $title
*/
function __construct( $preprocessor, $parent = false, $numberedArgs = array(), $namedArgs = array(), $title = false ) {
parent::__construct( $preprocessor );
}
/**
- * @param $index
+ * @param int $index
* @return array|bool
*/
function getNumberedArgument( $index ) {
}
/**
- * @param $name
+ * @param string $name
* @return bool
*/
function getNamedArgument( $name ) {
}
/**
- * @param $name
+ * @param string $name
* @return array|bool
*/
function getArgument( $name ) {
}
/**
- * @param $index
+ * @param int $index
* @return bool
*/
function getArgument( $index ) {
}
/**
- * @param $name
- * @param $text
+ * @param string $name
+ * @param string $text
* @return PPNode_Hash_Tree
*/
static function newWithText( $name, $text ) {
}
/**
- * @param $i
+ * @param int $i
* @return bool
*/
function item( $i ) {
const UNSTRIP_RECURSION_LIMIT = 20;
/**
- * @param $prefix string
+ * @param string $prefix
*/
function __construct( $prefix ) {
$this->prefix = $prefix;
/**
* Add a nowiki strip item
- * @param $marker
- * @param $value
+ * @param string $marker
+ * @param string $value
*/
function addNoWiki( $marker, $value ) {
$this->addItem( 'nowiki', $marker, $value );
}
/**
- * @param $marker
- * @param $value
+ * @param string $marker
+ * @param string $value
*/
function addGeneral( $marker, $value ) {
$this->addItem( 'general', $marker, $value );
/**
* @throws MWException
- * @param $type
- * @param $marker
- * @param $value
+ * @param string $type
+ * @param string $marker
+ * @param string $value
*/
protected function addItem( $type, $marker, $value ) {
if ( !preg_match( $this->regex, $marker, $m ) ) {
}
/**
- * @param $text
+ * @param string $text
* @return mixed
*/
function unstripGeneral( $text ) {
}
/**
- * @param $text
+ * @param string $text
* @return mixed
*/
function unstripNoWiki( $text ) {
}
/**
- * @param $text
+ * @param string $text
* @return mixed
*/
function unstripBoth( $text ) {
}
/**
- * @param $type
- * @param $text
+ * @param string $type
+ * @param string $text
* @return mixed
*/
protected function unstripType( $type, $text ) {
}
/**
- * @param $m array
+ * @param array $m
* @return array
*/
protected function unstripCallback( $m ) {
* Get a StripState object which is sufficient to unstrip the given text.
* It will contain the minimum subset of strip items necessary.
*
- * @param $text string
+ * @param string $text
*
* @return StripState
*/
* will not be preserved. The strings in the $texts array will have their
* strip markers rewritten, the resulting array of strings will be returned.
*
- * @param $otherState StripState
- * @param $texts Array
- * @return Array
+ * @param StripState $otherState
+ * @param array $texts
+ * @return array
*/
function merge( $otherState, $texts ) {
$mergePrefix = Parser::getRandomString();
}
/**
- * @param $m
+ * @param array $m
* @return string
*/
protected function mergeCallback( $m ) {
/**
* Remove any strip markers found in the given text.
*
- * @param $text Input string
+ * @param string $text Input string
* @return string
*/
function killMarkers( $text ) {
}
/**
- * @param $text string
+ * @param string $text
* @return string
*/
public function getWrapped( $text ) {
}
/**
- * @param $m array
+ * @param array $m
*
* @return string
*/
}
/**
- * @param $text string
+ * @param string $text
* @return string
*/
public function postprocess( $text ) {
* If tidy isn't able to correct the markup, the original will be
* returned in all its glory with a warning comment appended.
*
- * @param string $text hideous HTML input
- * @return String: corrected HTML output
+ * @param string $text Hideous HTML input
+ * @return string Corrected HTML output
*/
public static function tidy( $text ) {
global $wgTidyInternal;
/**
* Check HTML for errors, used if $wgValidateAllHtml = true.
*
- * @param $text String
- * @param &$errorStr String: return the error string
- * @return Boolean: whether the HTML is valid
+ * @param string $text
+ * @param string &$errorStr Return the error string
+ * @return bool Whether the HTML is valid
*/
public static function checkErrors( $text, &$errorStr = null ) {
global $wgTidyInternal;
* Also called in OutputHandler.php for full page validation
*
* @param string $text HTML to check
- * @param $stderr Boolean: Whether to read result from STDERR rather than STDOUT
- * @param &$retval int Exit code (-1 on internal error)
- * @return mixed String or null
+ * @param bool $stderr Whether to read result from STDERR rather than STDOUT
+ * @param int &$retval Exit code (-1 on internal error)
+ * @return string|null
*/
private static function execExternalTidy( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
* saving the overhead of spawning a new process.
*
* @param string $text HTML to check
- * @param $stderr Boolean: Whether to read result from error status instead of output
- * @param &$retval int Exit code (-1 on internal error)
- * @return mixed String or null
+ * @param bool $stderr Whether to read result from error status instead of output
+ * @param int &$retval Exit code (-1 on internal error)
+ * @return string|null
*/
private static function execInternalTidy( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgDebugTidy;
class TransactionProfiler {
/** @var float seconds */
protected $mDBLockThreshold = 5.0;
- /** @var Array DB/server name => (active trx count,timestamp) */
+ /** @var array DB/server name => (active trx count,timestamp) */
protected $mDBTrxHoldingLocks = array();
- /** @var Array DB/server name => list of (function name, elapsed time) */
+ /** @var array DB/server name => list of (function name, elapsed time) */
protected $mDBTrxMethodTimes = array();
/**
/**
* Return whether this a stub profiler
*
- * @return Boolean
+ * @return bool
*/
public function isStub() {
return false;
* Return whether this profiler stores data
*
* @see Profiler::logData()
- * @return Boolean
+ * @return bool
*/
public function isPersistent() {
return false;
* Only doing collation saves memory overhead but limits the use of certain
* features like that of graph generation for the debug toolbar.
*
- * @return boolean
+ * @return bool
*/
protected function collateOnly() {
return false;
* @param string $name
* @param float $elapsedCpu
* @param float $elapsedReal
- * @param integer $memChange
- * @param integer $subcalls
+ * @param int $memChange
+ * @param int $subcalls
* @param array|null $period Map of ('start','end','memory','subcalls')
*/
protected function updateEntry(
/**
* Called by wfProfieIn()
*
- * @param $functionname String
+ * @param string $functionname
*/
public function profileIn( $functionname ) {
global $wgDebugFunctionEntry;
/**
* Called by wfProfieOut()
*
- * @param $functionname String
+ * @param string $functionname
*/
public function profileOut( $functionname ) {
global $wgDebugFunctionEntry;
/**
* Returns a profiling output to be stored in debug file
*
- * @return String
+ * @return string
*/
public function getOutput() {
global $wgDebugFunctionEntry, $wgProfileCallTree;
* Counts the number of profiled function calls sitting under
* the given point in the call graph. Not the most efficient algo.
*
- * @param $stack Array:
- * @param $start Integer:
- * @return Integer
+ * @param array $stack
+ * @param int $start
+ * @return int
*/
protected function calltreeCount( $stack, $start ) {
$level = $stack[$start][1];
* @param array $info Module info array. For backwards compatibility with 1.17alpha,
* this may also be a ResourceLoaderModule object. Optional when using
* multiple-registration calling style.
- * @throws MWException: If a duplicate module registration is attempted
- * @throws MWException: If a module name contains illegal characters (pipes or commas)
- * @throws MWException: If something other than a ResourceLoaderModule is being registered
- * @return boolean False if there were any errors, in which case one or more modules were
+ * @throws MWException If a duplicate module registration is attempted
+ * @throws MWException If a module name contains illegal characters (pipes or commas)
+ * @throws MWException If something other than a ResourceLoaderModule is being registered
+ * @return bool False if there were any errors, in which case one or more modules were
* not registered
*/
public function register( $name, $info = null ) {
*
* @param string $framework Get only the test module names for one
* particular framework (optional)
- * @return Array
+ * @return array
*/
public function getTestModuleNames( $framework = 'all' ) {
/// @todo api siteinfo prop testmodulenames modulenames
* If there's an If-Modified-Since header, respond with a 304 appropriately
* and clear out the output buffer. If the client cache is too old then do nothing.
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @param string $mtime The TS_MW timestamp to check the header against
* @return bool True if 304 header sent and output handled
*/
/**
* Handle exception display.
*
- * @param Exception $e to be shown to the user
- * @return string sanitized text that can be returned to the user
+ * @param Exception $e Exception to be shown to the user
+ * @return string Sanitized text that can be returned to the user
*/
public static function formatException( $e ) {
global $wgShowExceptionDetails;
/**
* Generate code for a response.
*
- * @param $context ResourceLoaderContext Context in which to generate a response
+ * @param ResourceLoaderContext $context Context in which to generate a response
* @param array $modules List of module objects keyed by module name
* @param array $missing List of requested module names that are unregistered (optional)
* @return string Response data
* Set the state of modules with the given names to the given states
*
* @param string $name
- * @param $state
+ * @param string $state
* @return string
*/
public static function makeLoaderStateScript( $name, $state = null ) {
* - ResourceLoader::makeLoaderSourcesScript( array( $id1 => $props1, $id2 => $props2, ... ) );
* Register sources with the given IDs and properties.
*
- * @param string $id source ID
- * @param array $properties source properties (see addSource())
+ * @param string $id Source ID
+ * @param array $properties Source properties (see addSource())
* @return string
*/
public static function makeLoaderSourcesScript( $id, $properties = null ) {
/**
* Build a load.php URL
- * @param array $modules of module names (strings)
+ * @param array $modules Array of module names (strings)
* @param string $lang Language code
* @param string $skin Skin name
* @param string|null $user User name. If null, the &user= parameter is omitted
* Get global LESS variables.
*
* $since 1.22
- * @return array: Map of variable names to string CSS values.
+ * @return array Map of variable names to string CSS values.
*/
public static function getLESSVars() {
global $wgResourceLoaderLESSVars;
/* Methods */
/**
- * @param $resourceLoader ResourceLoader
- * @param $request WebRequest
+ * @param ResourceLoader $resourceLoader
+ * @param WebRequest $request
*/
public function __construct( $resourceLoader, WebRequest $request ) {
global $wgDefaultSkin, $wgResourceLoaderDebug;
* an array of module names like array( 'jquery.foo', 'jquery.bar',
* 'jquery.ui.baz', 'jquery.ui.quux' )
* @param string $modules Packed module name list
- * @return array of module names
+ * @return array Array of module names
*/
public static function expandModuleNames( $modules ) {
$retval = array();
}
/**
- * @return String|null
+ * @return string|null
*/
public function getOnly() {
return $this->only;
}
/**
- * @return String|null
+ * @return string|null
*/
public function getVersion() {
return $this->version;
/* Protected Members */
- /** String: Local base path, see __construct() */
+ /** @var string Local base path, see __construct() */
protected $localBasePath = '';
- /** String: Remote base path, see __construct() */
+ /** @var string Remote base path, see __construct() */
protected $remoteBasePath = '';
/**
- * Array: List of paths to JavaScript files to always include
+ * @var array List of paths to JavaScript files to always include
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $scripts = array();
/**
- * Array: List of JavaScript files to include when using a specific language
+ * @var array List of JavaScript files to include when using a specific language
* @par Usage:
* @code
* array( [language-code] => array( [file-path], [file-path], ... ), ... )
*/
protected $languageScripts = array();
/**
- * Array: List of JavaScript files to include when using a specific skin
+ * @var array List of JavaScript files to include when using a specific skin
* @par Usage:
* @code
* array( [skin-name] => array( [file-path], [file-path], ... ), ... )
*/
protected $skinScripts = array();
/**
- * Array: List of paths to JavaScript files to include in debug mode
+ * @var array List of paths to JavaScript files to include in debug mode
* @par Usage:
* @code
* array( [skin-name] => array( [file-path], [file-path], ... ), ... )
*/
protected $debugScripts = array();
/**
- * Array: List of paths to JavaScript files to include in the startup module
+ * @var array List of paths to JavaScript files to include in the startup module
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $loaderScripts = array();
/**
- * Array: List of paths to CSS files to always include
+ * @var array List of paths to CSS files to always include
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $styles = array();
/**
- * Array: List of paths to CSS files to include when using specific skins
+ * @var array List of paths to CSS files to include when using specific skins
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $skinStyles = array();
/**
- * Array: List of modules this module depends on
+ * @var array List of modules this module depends on
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
*/
protected $dependencies = array();
/**
- * Array: List of message keys used by this module
+ * @var array List of message keys used by this module
* @par Usage:
* @code
* array( [message-key], [message-key], ... )
* @endcode
*/
protected $messages = array();
- /** String: Name of group to load this module in */
+ /** @var string Name of group to load this module in */
protected $group;
- /** String: Position on the page to load this module at */
+ /** @var string Position on the page to load this module at */
protected $position = 'bottom';
- /** Boolean: Link to raw files in debug mode */
+ /** @var bool Link to raw files in debug mode */
protected $debugRaw = true;
- /** Boolean: Whether mw.loader.state() call should be omitted */
+ /** @var bool Whether mw.loader.state() call should be omitted */
protected $raw = false;
protected $targets = array( 'desktop' );
/**
- * Boolean: Whether getStyleURLsForDebug should return raw file paths,
+ * @var bool Whether getStyleURLsForDebug should return raw file paths,
* or return load.php urls
*/
protected $hasGeneratedStyles = false;
/**
- * Array: Cache for mtime
+ * @var array Cache for mtime
* @par Usage:
* @code
* array( [hash] => [mtime], [hash] => [mtime], ... )
*/
protected $modifiedTime = array();
/**
- * Array: Place where readStyleFile() tracks file dependencies
+ * @var array Place where readStyleFile() tracks file dependencies
* @par Usage:
* @code
* array( [file-path], [file-path], ... )
* Gets all scripts for a given context concatenated together.
*
* @param ResourceLoaderContext $context Context in which to generate script
- * @return string: JavaScript code for $context
+ * @return string JavaScript code for $context
*/
public function getScript( ResourceLoaderContext $context ) {
$files = $this->getScriptFiles( $context );
/**
* Gets loader script.
*
- * @return string: JavaScript code to be added to startup module
+ * @return string JavaScript code to be added to startup module
*/
public function getLoaderScript() {
if ( count( $this->loaderScripts ) == 0 ) {
* Gets all styles for a given context concatenated together.
*
* @param ResourceLoaderContext $context Context in which to generate styles
- * @return string: CSS code for $context
+ * @return string CSS code for $context
*/
public function getStyles( ResourceLoaderContext $context ) {
$styles = $this->readStyleFiles(
/**
* Gets list of message keys used by this module.
*
- * @return array: List of message keys
+ * @return array List of message keys
*/
public function getMessages() {
return $this->messages;
/**
* Gets the name of the group this module should be loaded in.
*
- * @return string: Group name
+ * @return string Group name
*/
public function getGroup() {
return $this->group;
/**
* Gets list of names of modules this module depends on.
*
- * @return array: List of module names
+ * @return array List of module names
*/
public function getDependencies() {
return $this->dependencies;
*
* @param ResourceLoaderContext $context Context in which to calculate
* the modified time
- * @return int: UNIX timestamp
+ * @return int UNIX timestamp
* @see ResourceLoaderModule::getFileDependencies
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
/**
* Get the definition summary for this module.
*
- * @return Array
+ * @return array
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
$summary = array(
*
* @since 1.22
* @param string $path
- * @return string: the stylesheet language name
+ * @return string The stylesheet language name
*/
public function getStyleSheetLang( $path ) {
return preg_match( '/\.less$/i', $path ) ? 'less' : 'css';
*
* @param array $list List of file paths in any combination of index/path
* or path/options pairs
- * @param string $option option name
- * @param mixed $default default value if the option isn't set
- * @return array: List of file paths, collated by $option
+ * @param string $option Option name
+ * @param mixed $default Default value if the option isn't set
+ * @return array List of file paths, collated by $option
*/
protected static function collateFilePathListByOption( array $list, $option, $default ) {
$collatedFiles = array();
* @param array $list List of lists to select from
* @param string $key Key to look for in $map
* @param string $fallback Key to look for in $list if $key doesn't exist
- * @return array: List of elements from $map which matched $key or $fallback,
+ * @return array List of elements from $map which matched $key or $fallback,
* or an empty list in case of no match
*/
protected static function tryForKey( array $list, $key, $fallback = null ) {
* Gets a list of file paths for all scripts in this module, in order of propper execution.
*
* @param ResourceLoaderContext $context
- * @return array: List of file paths
+ * @return array List of file paths
*/
protected function getScriptFiles( ResourceLoaderContext $context ) {
$files = array_merge(
* Gets a list of file paths for all styles in this module, in order of propper inclusion.
*
* @param ResourceLoaderContext $context
- * @return array: List of file paths
+ * @return array List of file paths
*/
protected function getStyleFiles( ResourceLoaderContext $context ) {
return array_merge_recursive(
*
* @param array $scripts List of file paths to scripts to read, remap and concetenate
* @throws MWException
- * @return string: Concatenated and remapped JavaScript data from $scripts
+ * @return string Concatenated and remapped JavaScript data from $scripts
*/
protected function readScriptFiles( array $scripts ) {
global $wgResourceLoaderValidateStaticJS;
* @param bool $flip
*
* @throws MWException
- * @return array: List of concatenated and remapped CSS data from $styles,
+ * @return array List of concatenated and remapped CSS data from $styles,
* keyed by media type
*/
protected function readStyleFiles( array $styles, $flip ) {
* @param string $path File path of style file to read
* @param bool $flip
*
- * @return string: CSS data in script file
+ * @return string CSS data in script file
* @throws MWException if the file doesn't exist
*/
protected function readStyleFile( $path, $flip ) {
/**
* Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
*
- * @return array of strings
+ * @return array Array of strings
*/
public function getTargets() {
return $this->targets;
*
* @since 1.22
* @param string $fileName File name of root LESS file.
- * @return string: Cache key
+ * @return string Cache key
*/
protected static function getLESSCacheKey( $fileName ) {
$vars = json_encode( ResourceLoader::getLESSVars() );
* @throws Exception If Less encounters a parse error
* @throws MWException If Less compilation returns unexpection result
* @param string $fileName File path of LESS source
- * @return string: CSS source
+ * @return string CSS source
*/
protected function compileLESSFile( $fileName ) {
$key = self::getLESSCacheKey( $fileName );
class ResourceLoaderFilePageModule extends ResourceLoaderWikiModule {
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
protected function getPages( ResourceLoaderContext $context ) {
}
/**
- * @param $context ResourceLoaderContext
- * @return string: JavaScript code
+ * @param ResourceLoaderContext $context
+ * @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
$this->language = Language::factory( $context->getLanguage() );
}
/**
- * @param $context ResourceLoaderContext
- * @return int: UNIX timestamp
+ * @param ResourceLoaderContext $context
+ * @return int UNIX timestamp
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
return max( 1, $this->getHashMtime( $context ) );
}
/**
- * @param $context ResourceLoaderContext
- * @return string: Hash
+ * @param ResourceLoaderContext $context
+ * @return string Hash
*/
public function getModifiedHash( ResourceLoaderContext $context ) {
$this->language = Language::factory( $context->getLanguage() );
* Get this module's name. This is set when the module is registered
* with ResourceLoader::register()
*
- * @return mixed: Name (string) or null if no name was set
+ * @return string|null Name (string) or null if no name was set
*/
public function getName() {
return $this->name;
* Get this module's origin. This is set when the module is registered
* with ResourceLoader::register()
*
- * @return int: ResourceLoaderModule class constant, the subclass default
+ * @return int ResourceLoaderModule class constant, the subclass default
* if not set manually
*/
public function getOrigin() {
* Set this module's origin. This is called by ResourceLoader::register()
* when registering the module. Other code should not call this.
*
- * @param int $origin origin
+ * @param int $origin Origin
*/
public function setOrigin( $origin ) {
$this->origin = $origin;
* Includes all relevant JS except loader scripts.
*
* @param ResourceLoaderContext $context
- * @return string: JavaScript code
+ * @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
// Stub, override expected
* MUST return either an only= URL or a non-load.php URL.
*
* @param ResourceLoaderContext $context
- * @return array: Array of URLs
+ * @return array Array of URLs
*/
public function getScriptURLsForDebug( ResourceLoaderContext $context ) {
$url = ResourceLoader::makeLoaderURL(
* Get all CSS for this module for a given skin.
*
* @param ResourceLoaderContext $context
- * @return array: List of CSS strings or array of CSS strings keyed by media type.
+ * @return array List of CSS strings or array of CSS strings keyed by media type.
* like array( 'screen' => '.foo { width: 0 }' );
* or array( 'screen' => array( '.foo { width: 0 }' ) );
*/
* load the files directly. See also getScriptURLsForDebug()
*
* @param ResourceLoaderContext $context
- * @return array: array( mediaType => array( URL1, URL2, ... ), ... )
+ * @return array array( mediaType => array( URL1, URL2, ... ), ... )
*/
public function getStyleURLsForDebug( ResourceLoaderContext $context ) {
$url = ResourceLoader::makeLoaderURL(
*
* To get a JSON blob with messages, use MessageBlobStore::get()
*
- * @return array: List of message keys. Keys may occur more than once
+ * @return array List of message keys. Keys may occur more than once
*/
public function getMessages() {
// Stub, override expected
/**
* Get the group this module is in.
*
- * @return string: Group name
+ * @return string Group name
*/
public function getGroup() {
// Stub, override expected
/**
* Get the origin of this module. Should only be overridden for foreign modules.
*
- * @return string: Origin name, 'local' for local modules
+ * @return string Origin name, 'local' for local modules
*/
public function getSource() {
// Stub, override expected
/**
* Get the loader JS for this module, if set.
*
- * @return mixed: JavaScript loader code as a string or boolean false if no custom loader set
+ * @return mixed JavaScript loader code as a string or boolean false if no custom loader set
*/
public function getLoaderScript() {
// Stub, override expected
*
* To add dependencies dynamically on the client side, use a custom
* loader script, see getLoaderScript()
- * @return array: List of module names as strings
+ * @return array List of module names as strings
*/
public function getDependencies() {
// Stub, override expected
/**
* Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']
*
- * @return array: Array of strings
+ * @return array Array of strings
*/
public function getTargets() {
return $this->targets;
* Currently these are only image files referenced by the module's CSS.
*
* @param string $skin Skin name
- * @return array: List of files
+ * @return array List of files
*/
public function getFileDependencies( $skin ) {
// Try in-object cache first
* Get the last modification timestamp of the message blob for this
* module in a given language.
* @param string $lang Language code
- * @return int: UNIX timestamp, or 0 if the module doesn't have messages
+ * @return int UNIX timestamp, or 0 if the module doesn't have messages
*/
public function getMsgBlobMtime( $lang ) {
if ( !isset( $this->msgBlobMtime[$lang] ) ) {
* Set a preloaded message blob last modification timestamp. Used so we
* can load this information for all modules at once.
* @param string $lang Language code
- * @param $mtime Integer: UNIX timestamp or 0 if there is no such blob
+ * @param int $mtime UNIX timestamp or 0 if there is no such blob
*/
public function setMsgBlobMtime( $lang, $mtime ) {
$this->msgBlobMtime[$lang] = $mtime;
* yourself and take its result into consideration.
*
* @param ResourceLoaderContext $context Context object
- * @return integer UNIX timestamp
+ * @return int UNIX timestamp
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
// 0 would mean now
* Helper method for calculating when the module's hash (if it has one) changed.
*
* @param ResourceLoaderContext $context
- * @return integer: UNIX timestamp or 0 if no hash was provided
+ * @return int UNIX timestamp or 0 if no hash was provided
* by getModifiedHash()
*/
public function getHashMtime( ResourceLoaderContext $context ) {
* use of getHashMTime() inside getModifiedTime().
*
* @param ResourceLoaderContext $context
- * @return string|null: Hash
+ * @return string|null Hash
*/
public function getModifiedHash( ResourceLoaderContext $context ) {
return null;
/**
* Helper method for calculating when this module's definition summary was last changed.
*
- * @return integer: UNIX timestamp or 0 if no definition summary was provided
+ * @return int UNIX timestamp or 0 if no definition summary was provided
* by getDefinitionSummary()
*/
public function getDefinitionMtime( ResourceLoaderContext $context ) {
* contain arrays and scalars as values (avoid object instances) which means
* it requires abstraction.
*
- * @return Array|null
+ * @return array|null
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
return array(
*
* @param string $fileName
* @param string $contents
- * @return string: JS with the original, or a replacement error
+ * @return string JS with the original, or a replacement error
*/
protected function validateScriptFile( $fileName, $contents ) {
global $wgResourceLoaderValidateJS;
* Gets list of pages used by this module. Obviously, it makes absolutely no
* sense to include JavaScript files here... :D
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
*
- * @return Array: List of pages
+ * @return array List of pages
*/
protected function getPages( ResourceLoaderContext $context ) {
return array( 'MediaWiki:Noscript.css' => array( 'type' => 'style' ) );
/**
* Gets group name
*
- * @return String: Name of group
+ * @return string Name of group
*/
public function getGroup() {
return 'noscript';
/**
* Gets list of pages used by this module
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
*
- * @return Array: List of pages
+ * @return array List of pages
*/
protected function getPages( ResourceLoaderContext $context ) {
global $wgUseSiteJs, $wgUseSiteCss;
/**
* Gets group name
*
- * @return String: Name of group
+ * @return string Name of group
*/
public function getGroup() {
return 'site';
/**
* Get registration code for all modules.
*
- * @param ResourceLoaderContext $context object
+ * @param ResourceLoaderContext $context
* @return string JavaScript code for registering all modules with the client loader
*/
public static function getModuleRegistrations( ResourceLoaderContext $context ) {
*
* Detect changes to mw.config settings embedded in #getScript (bug 28899).
*
- * @param $context ResourceLoaderContext
- * @return string: Hash
+ * @param ResourceLoaderContext $context
+ * @return string Hash
*/
public function getModifiedHash( ResourceLoaderContext $context ) {
global $wgLegacyJavaScriptGlobals;
/* Methods */
/**
- * @param $context ResourceLoaderContext
- * @return array|int|Mixed
+ * @param ResourceLoaderContext $context
+ * @return array|int|mixed
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
$hash = $context->getHash();
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
public function getStyles( ResourceLoaderContext $context ) {
/* Protected Methods */
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
protected function getPages( ResourceLoaderContext $context ) {
/* Protected Methods */
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
protected function getPages( ResourceLoaderContext $context ) {
/* Methods */
/**
- * @param $context ResourceLoaderContext
- * @return array|int|Mixed
+ * @param ResourceLoaderContext $context
+ * @return array|int|mixed
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
$hash = $context->getHash();
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return string
*/
public function getScript( ResourceLoaderContext $context ) {
/**
* Fetch the tokens for the current user.
*
- * @return array: List of tokens keyed by token type
+ * @return array List of tokens keyed by token type
*/
protected function contextUserTokens() {
global $wgUser;
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return string
*/
public function getScript( ResourceLoaderContext $context ) {
* There is an optional media key, the value of which can be the
* medium ('screen', 'print', etc.) of the stylesheet.
*
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
abstract protected function getPages( ResourceLoaderContext $context );
}
/**
- * @param $title Title
+ * @param Title $title
* @return null|string
*/
protected function getContent( $title ) {
/* Methods */
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return string
*/
public function getScript( ResourceLoaderContext $context ) {
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return array
*/
public function getStyles( ResourceLoaderContext $context ) {
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return int|mixed
*/
public function getModifiedTime( ResourceLoaderContext $context ) {
/**
* Get the definition summary for this module.
*
- * @return Array
+ * @return array
*/
public function getDefinitionSummary( ResourceLoaderContext $context ) {
return array(
}
/**
- * @param $context ResourceLoaderContext
+ * @param ResourceLoaderContext $context
* @return bool
*/
public function isKnownEmpty( ResourceLoaderContext $context ) {
/**
* Get the modification times of all titles that would be loaded for
* a given context.
- * @param $context ResourceLoaderContext: Context object
+ * @param ResourceLoaderContext $context Context object
* @return array( prefixed DB key => UNIX timestamp ), nonexistent titles are dropped
*/
protected function getTitleMtimes( ResourceLoaderContext $context ) {
var $namespaces = array( NS_MAIN );
protected $showSuggestion = true;
- /** @var Array Feature values */
+ /** @var array Feature values */
protected $features = array();
/**
* If title searches are not supported or disabled, return null.
* STUB
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SearchResultSet|Status|null
*/
function searchText( $term ) {
* If title searches are not supported or disabled, return null.
* STUB
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SearchResultSet|null
*/
function searchTitle( $term ) {
/**
* @since 1.18
- * @param $feature String
- * @return Boolean
+ * @param string $feature
+ * @return bool
*/
public function supports( $feature ) {
switch ( $feature ) {
/**
* Way to pass custom data for engines
* @since 1.18
- * @param $feature String
- * @param $data Mixed
+ * @param string $feature
+ * @param mixed $data
* @return bool
*/
public function setFeatureData( $feature, $data ) {
* If an exact title match can be found, or a very slightly close match,
* return the title. If no match, returns NULL.
*
- * @param $searchterm String
+ * @param string $searchterm
* @return Title
*/
public static function getNearMatch( $searchterm ) {
* Do a near match (see SearchEngine::getNearMatch) and wrap it into a
* SearchResultSet.
*
- * @param $searchterm string
+ * @param string $searchterm
* @return SearchResultSet
*/
public static function getNearMatchResultSet( $searchterm ) {
* Set the maximum number of results to return
* and how many to skip before returning the first.
*
- * @param $limit Integer
- * @param $offset Integer
+ * @param int $limit
+ * @param int $offset
*/
function setLimitOffset( $limit, $offset = 0 ) {
$this->limit = intval( $limit );
* Set which namespaces the search should include.
* Give an array of namespace index numbers.
*
- * @param $namespaces Array
+ * @param array $namespaces
*/
function setNamespaces( $namespaces ) {
$this->namespaces = $namespaces;
* don't support building a suggestion in the first place and others don't respect
* this flag.
*
- * @param boolean $showSuggestion should the searcher try to build suggestions
+ * @param bool $showSuggestion Should the searcher try to build suggestions
*/
function setShowSuggestion( $showSuggestion ) {
$this->showSuggestion = $showSuggestion;
* Parse some common prefixes: all (search everything)
* or namespace names
*
- * @param $query String
+ * @param string $query
* @return string
*/
function replacePrefixes( $query ) {
/**
* Make a list of searchable namespaces and their canonical names.
- * @return Array
+ * @return array
*/
public static function searchableNamespaces() {
global $wgContLang;
* Extract default namespaces to search from the given user's
* settings, returning a list of index numbers.
*
- * @param $user User
- * @return Array
+ * @param user $user
+ * @return array
*/
public static function userNamespaces( $user ) {
global $wgSearchEverythingOnlyLoggedIn;
/**
* Find snippet highlight settings for all users
*
- * @return Array contextlines, contextchars
+ * @return array Contextlines, contextchars
*/
public static function userHighlightPrefs() {
$contextlines = 2; // Hardcode this. Old defaults sucked. :)
/**
* An array of namespaces indexes to be searched by default
*
- * @return Array
+ * @return array
*/
public static function defaultNamespaces() {
global $wgNamespacesToBeSearchedDefault;
* Get a list of namespace names useful for showing in tooltips
* and preferences
*
- * @param $namespaces Array
+ * @param array $namespaces
* @return array
*/
public static function namespacesAsText( $namespaces ) {
/**
* Return the help namespaces to be shown on Special:Search
*
- * @return Array
+ * @return array
*/
public static function helpNamespaces() {
global $wgNamespacesToBeSearchedHelp;
/**
* Return a 'cleaned up' search string
*
- * @param $text String
- * @return String
+ * @param string $text
+ * @return string
*/
function filter( $text ) {
$lc = $this->legalSearchChars();
* Load up the appropriate search engine class for the currently
* active database backend, and return a configured instance.
*
- * @param String $type Type of search backend, if not the default
+ * @param string $type Type of search backend, if not the default
* @return SearchEngine
*/
public static function create( $type = null ) {
* Title and text should be pre-processed.
* STUB
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
// no-op
* Title should be pre-processed.
* STUB
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
// no-op
* Title should be pre-processed.
* STUB
*
- * @param Integer $id Page id that was deleted
- * @param String $title Title of page that was deleted
+ * @param int $id Page id that was deleted
+ * @param string $title Title of page that was deleted
*/
function delete( $id, $title ) {
// no-op
/**
* Get OpenSearch suggestion template
*
- * @return String
+ * @return string
*/
public static function getOpenSearchTemplate() {
global $wgOpenSearchTemplate, $wgCanonicalServer;
/**
* Default implementation of wikitext highlighting
*
- * @param $text String
- * @param array $terms terms to highlight (unescaped)
- * @param $contextlines Integer
- * @param $contextchars Integer
- * @return String
+ * @param string $text
+ * @param array $terms Terms to highlight (unescaped)
+ * @param int $contextlines
+ * @param int $contextchars
+ * @return tring
*/
public function highlightText( $text, $terms, $contextlines, $contextchars ) {
global $wgContLang;
* Split text into lines and add it to extracts array
*
* @param array $extracts index -> $line
- * @param $count Integer
- * @param $text String
+ * @param int $count
+ * @param string $text
*/
function splitAndAdd( &$extracts, &$count, $text ) {
$split = explode( "\n", $this->mCleanWikitext ? $this->removeWiki( $text ) : $text );
/**
* Do manual case conversion for non-ascii chars
*
- * @param $matches Array
+ * @param array $matches
* @return string
*/
function caseCallback( $matches ) {
/**
* Extract part of the text from start to end, but by
* not chopping up words
- * @param $text String
- * @param $start Integer
- * @param $end Integer
- * @param $posStart Integer: (out) actual start position
- * @param $posEnd Integer: (out) actual end position
- * @return String
+ * @param string $text
+ * @param int $start
+ * @param int $end
+ * @param int $posStart (out) actual start position
+ * @param int $posEnd (out) actual end position
+ * @return string
*/
function extract( $text, $start, $end, &$posStart = null, &$posEnd = null ) {
if ( $start != 0 ) {
/**
* Find a nonletter near a point (index) in the text
*
- * @param $text String
- * @param $point Integer
- * @param $offset Integer: offset to found index
- * @return Integer: nearest nonletter index, or beginning of utf8 char if none
+ * @param string $text
+ * @param int $point
+ * @param int $offset Offset to found index
+ * @return int Nearest nonletter index, or beginning of utf8 char if none
*/
function position( $text, $point, $offset = 0 ) {
$tolerance = 10;
/**
* Search extracts for a pattern, and return snippets
*
- * @param string $pattern regexp for matching lines
- * @param array $extracts extracts to search
- * @param $linesleft Integer: number of extracts to make
- * @param $contextchars Integer: length of snippet
- * @param array $out map for highlighted snippets
- * @param array $offsets map of starting points of snippets
+ * @param string $pattern Regexp for matching lines
+ * @param array $extracts Extracts to search
+ * @param int $linesleft Number of extracts to make
+ * @param int $contextchars Length of snippet
+ * @param array $out Map for highlighted snippets
+ * @param array $offsets Map of starting points of snippets
* @protected
*/
function process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets ) {
* callback to replace [[target|caption]] kind of links, if
* the target is category or image, leave it
*
- * @param $matches Array
+ * @param array $matches
*/
function linkReplace( $matches ) {
$colon = strpos( $matches[1], ':' );
* Simple & fast snippet extraction, but gives completely unrelevant
* snippets
*
- * @param $text String
- * @param $terms Array
- * @param $contextlines Integer
- * @param $contextchars Integer
- * @return String
+ * @param string $text
+ * @param array $terms
+ * @param int $contextlines
+ * @param int $contextchars
+ * @return string
*/
public function highlightSimple( $text, $terms, $contextlines, $contextchars ) {
global $wgContLang;
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MssqlSearchResultSet
* @access public
*/
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MssqlSearchResultSet
* @access public
*/
/**
* Return a partial WHERE clause to limit the search to the given namespaces
*
- * @return String
+ * @return string
* @private
*/
function queryNamespaces() {
/**
* Return a LIMIT clause to limit results on the query.
*
- * @param $sql string
+ * @param string $sql
*
- * @return String
+ * @return string
*/
function queryLimit( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
* Does not do anything for generic search engine
* subclasses may define this though
*
- * @return String
+ * @return string
*/
function queryRanking( $filteredTerm, $fulltext ) {
return ' ORDER BY ftindex.[RANK] DESC'; // return ' ORDER BY score(1)';
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
/**
* Picks which field to index on, depending on what type of query.
*
- * @param $fulltext Boolean
+ * @param bool $fulltext
* @return string
*/
function getIndexField( $fulltext ) {
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
* @private
*/
function queryMain( $filteredTerm, $fulltext ) {
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
* @return bool|ResultWrapper
*/
function update( $id, $title, $text ) {
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
* @return bool|ResultWrapper
*/
function updateTitle( $id, $title ) {
* Parse the user's query and transform it into an SQL fragment which will
* become part of a WHERE clause
*
- * @param $filteredText string
- * @param $fulltext string
+ * @param string $filteredText
+ * @param string $fulltext
*
* @return string
*/
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MySQLSearchResultSet
*/
function searchText( $term ) {
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return MySQLSearchResultSet
*/
function searchTitle( $term ) {
/**
* Add special conditions
- * @param $query Array
+ * @param array $query
* @since 1.18
*/
protected function queryFeatures( &$query ) {
/**
* Add namespace conditions
- * @param $query Array
+ * @param array $query
* @since 1.18 (changed)
*/
function queryNamespaces( &$query ) {
/**
* Add limit options
- * @param $query Array
+ * @param array $query
* @since 1.18
*/
protected function limitResult( &$query ) {
/**
* Construct the SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return Array
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return array
* @since 1.18 (changed)
*/
function getQuery( $filteredTerm, $fulltext ) {
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param &$query array Search query array
- * @param $filteredTerm String
- * @param $fulltext Boolean
+ * @param array &$query Search query array
+ * @param string $filteredTerm
+ * @param bool $fulltext
* @since 1.18 (changed)
*/
function queryMain( &$query, $filteredTerm, $fulltext ) {
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
$dbw = wfGetDB( DB_MASTER );
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
$dbw = wfGetDB( DB_MASTER );
* Delete an indexed page
* Title should be pre-processed.
*
- * @param Integer $id Page id that was deleted
- * @param String $title Title of page that was deleted
+ * @param int $id Page id that was deleted
+ * @param string $title Title of page that was deleted
*/
function delete( $id, $title ) {
$dbw = wfGetDB( DB_MASTER );
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqlSearchResultSet
*/
function searchText( $term ) {
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqlSearchResultSet
*/
function searchTitle( $term ) {
/**
* Return a partial WHERE clause to limit the search to the given namespaces
- * @return String
+ * @return string
*/
function queryNamespaces() {
if ( is_null( $this->namespaces ) ) {
/**
* Return a LIMIT clause to limit results on the query.
*
- * @param $sql string
+ * @param string $sql
*
- * @return String
+ * @return string
*/
function queryLimit( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
* Does not do anything for generic search engine
* subclasses may define this though
*
- * @return String
+ * @return string
*/
function queryRanking( $filteredTerm, $fulltext ) {
return ' ORDER BY score(1)';
/**
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function queryMain( $filteredTerm, $fulltext ) {
$match = $this->parseQuery( $filteredTerm, $fulltext );
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
$dbw = wfGetDB( DB_MASTER );
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
$dbw = wfGetDB( DB_MASTER );
* Currently searches a page's current title (page.page_title) and
* latest revision article text (pagecontent.old_text)
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return PostgresSearchResultSet
*/
function searchTitle( $term ) {
* Transform the user's search string into a better form for tsearch2
* Returns an SQL fragment consisting of quoted text to search for.
*
- * @param $term string
+ * @param string $term
*
* @return string
*/
/**
* Construct the full SQL query to do the search.
- * @param $term String
- * @param $fulltext String
- * @param $colname
+ * @param string $term
+ * @param string $fulltext
+ * @param string $colname
* @return string
*/
function searchQuery( $term, $fulltext, $colname ) {
protected $mTitle;
/**
- * @var String
+ * @var string
*/
protected $mText;
/**
* Return a new SearchResult and initializes it with a title.
*
- * @param $title Title
+ * @param Title $title
* @return SearchResult
*/
public static function newFromTitle( $title ) {
/**
* Return a new SearchResult and initializes it with a row.
*
- * @param $row object
+ * @param object $row
* @return SearchResult
*/
public static function newFromRow( $row ) {
* Initialize from a database row. Makes a Title and passes that to
* initFromTitle.
*
- * @param $row object
+ * @param object $row
*/
protected function initFromRow( $row ) {
$this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) );
* Initialize from a Title and if possible initializes a corresponding
* Revision and File.
*
- * @param $title Title
+ * @param Title $title
*/
protected function initFromTitle( $title ) {
$this->mTitle = $title;
/**
* Check if this is result points to an invalid title
*
- * @return Boolean
+ * @return bool
*/
function isBrokenTitle() {
return is_null( $this->mTitle );
/**
* Check if target page is missing, happens when index is out of date
*
- * @return Boolean
+ * @return bool
*/
function isMissingRevision() {
return !$this->mRevision && !$this->mImage;
}
/**
- * @return float|null if not supported
+ * @return float|null If not supported
*/
function getScore() {
return null;
}
/**
- * @param array $terms terms to highlight
- * @return String: highlighted text snippet, null (and not '') if not supported
+ * @param array $terms Terms to highlight
+ * @return string Highlighted text snippet, null (and not '') if not supported
*/
function getTextSnippet( $terms ) {
global $wgAdvancedSearchHighlighting;
}
/**
- * @return String: highlighted title, '' if not supported
+ * @return string Highlighted title, '' if not supported
*/
function getTitleSnippet() {
return '';
}
/**
- * @return String: highlighted redirect name (redirect to this page), '' if none or not supported
+ * @return string Highlighted redirect name (redirect to this page), '' if none or not supported
*/
function getRedirectSnippet() {
return '';
}
/**
- * @return Title object for the redirect to this page, null if none or not supported
+ * @return Title Title object for the redirect to this page, null if none or not supported
*/
function getRedirectTitle() {
return null;
}
/**
- * @return string highlighted relevant section name, null if none or not supported
+ * @return string Highlighted relevant section name, null if none or not supported
*/
function getSectionSnippet() {
return '';
}
/**
- * @return Title object (pagename+fragment) for the section, null if none or not supported
+ * @return Title Title object (pagename+fragment) for the section, null if none or not supported
*/
function getSectionTitle() {
return null;
}
/**
- * @return String: timestamp
+ * @return string timestamp
*/
function getTimestamp() {
if ( $this->mRevision ) {
}
/**
- * @return Integer: number of words
+ * @return int Number of words
*/
function getWordCount() {
$this->initText();
}
/**
- * @return Integer: size in bytes
+ * @return int Size in bytes
*/
function getByteSize() {
$this->initText();
}
/**
- * @return Boolean if hit has related articles
+ * @return bool If hit has related articles
*/
function hasRelated() {
return false;
}
/**
- * @return String: interwiki prefix of the title (return iw even if title is broken)
+ * @return string Interwiki prefix of the title (return iw even if title is broken)
*/
function getInterwikiPrefix() {
return '';
}
/**
- * @return string interwiki namespace of the title (since we likely can't resolve it locally)
+ * @return string Interwiki namespace of the title (since we likely can't resolve it locally)
*/
function getInterwikiNamespaceText() {
return '';
/**
* Did this match file contents (eg: PDF/DJVU)?
+ * @return bool
*/
function isFileMatch() {
return false;
* the search terms as parsed by this engine in a text extract.
* STUB
*
- * @return Array
+ * @return array
*/
function termMatches() {
return array();
* Return true if results are included in this result set.
* STUB
*
- * @return Boolean
+ * @return bool
*/
function hasResults() {
return false;
*
* Return null if no total hits number is supported.
*
- * @return Integer
+ * @return int
*/
function getTotalHits() {
return null;
* Some search modes return a suggested alternate term if there are
* no exact hits. Returns true if there is one on this set.
*
- * @return Boolean
+ * @return bool
*/
function hasSuggestion() {
return false;
}
/**
- * @return String: suggested query, null if none
+ * @return string Suggested query, null if none
*/
function getSuggestionQuery() {
return null;
}
/**
- * @return String: HTML highlighted suggested query, '' if none
+ * @return string HTML highlighted suggested query, '' if none
*/
function getSuggestionSnippet() {
return '';
/**
* Check if there are results on other wikis
*
- * @return Boolean
+ * @return bool
*/
function hasInterwikiResults() {
return $this->getInterwikiResults() != null;
* Did the search contain search syntax? If so, Special:Search won't offer
* the user a link to a create a page named by the search string because the
* name would contain the search syntax.
+ * @return bool
*/
public function searchContainedSyntax() {
return false;
private $fetched = false;
/**
- * @param $match mixed Title if matched, else null
+ * @param Title|null $match Title if matched, else null
*/
public function __construct( $match ) {
$this->result = $match;
class SearchSqlite extends SearchDatabase {
/**
* Whether fulltext search is supported by current schema
- * @return Boolean
+ * @return bool
*/
function fulltextSearchSupported() {
return $this->db->checkForEnabledSearch();
/**
* Perform a full text search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqliteSearchResultSet
*/
function searchText( $term ) {
/**
* Perform a title-only search query and return a result set.
*
- * @param string $term raw search term
+ * @param string $term Raw search term
* @return SqliteSearchResultSet
*/
function searchTitle( $term ) {
/**
* Return a partial WHERE clause to limit the search to the given namespaces
- * @return String
+ * @return string
*/
function queryNamespaces() {
if ( is_null( $this->namespaces ) ) {
/**
* Returns a query with limit for number of results set.
- * @param $sql String:
- * @return String
+ * @param string $sql
+ * @return string
*/
function limitResult( $sql ) {
return $this->db->limitResult( $sql, $this->limit, $this->offset );
/**
* Construct the full SQL query to do the search.
* The guts shoulds be constructed in queryMain()
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function getQuery( $filteredTerm, $fulltext ) {
return $this->limitResult(
/**
* Picks which field to index on, depending on what type of query.
- * @param $fulltext Boolean
- * @return String
+ * @param bool $fulltext
+ * @return string
*/
function getIndexField( $fulltext ) {
return $fulltext ? 'si_text' : 'si_title';
/**
* Get the base part of the search query.
*
- * @param $filteredTerm String
- * @param $fulltext Boolean
- * @return String
+ * @param string $filteredTerm
+ * @param bool $fulltext
+ * @return string
*/
function queryMain( $filteredTerm, $fulltext ) {
$match = $this->parseQuery( $filteredTerm, $fulltext );
* Create or update the search index record for the given page.
* Title and text should be pre-processed.
*
- * @param $id Integer
- * @param $title String
- * @param $text String
+ * @param int $id
+ * @param string $title
+ * @param string $text
*/
function update( $id, $title, $text ) {
if ( !$this->fulltextSearchSupported() ) {
* Update a search index record's title only.
* Title should be pre-processed.
*
- * @param $id Integer
- * @param $title String
+ * @param int $id
+ * @param string $title
*/
function updateTitle( $id, $title ) {
if ( !$this->fulltextSearchSupported() ) {
$profile = new ProfileSection( __METHOD__ );
if ( $result->isBrokenTitle() ) {
- return "<!-- Broken link in search result -->\n";
+ return '';
}
$title = $result->getTitle();
// The least confusing at this point is to drop the result.
// You may get less results, but... oh well. :P
if ( $result->isMissingRevision() ) {
- return "<!-- missing page " . htmlspecialchars( $title->getPrefixedText() ) . "-->\n";
+ return '';
}
// format redirects / relevant sections
$profile = new ProfileSection( __METHOD__ );
if ( $result->isBrokenTitle() ) {
- return "<!-- Broken link in search result -->\n";
+ return '';
}
$title = $result->getTitle();
--- /dev/null
+<?php
+/**
+ * Internationalisation code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Language
+ */
+
+/**
+ * A fake language converter
+ *
+ * @ingroup Language
+ */
+class FakeConverter {
+ /**
+ * @var Language
+ */
+ public $mLang;
+
+ function __construct( $langobj ) {
+ $this->mLang = $langobj;
+ }
+
+ function autoConvert( $text, $variant = false ) {
+ return $text;
+ }
+
+ function autoConvertToAllVariants( $text ) {
+ return array( $this->mLang->getCode() => $text );
+ }
+
+ function convert( $t ) {
+ return $t;
+ }
+
+ function convertTo( $text, $variant ) {
+ return $text;
+ }
+
+ /**
+ * @param Title $t
+ * @return mixed
+ */
+ function convertTitle( $t ) {
+ return $t->getPrefixedText();
+ }
+
+ function convertNamespace( $ns ) {
+ return $this->mLang->getFormattedNsText( $ns );
+ }
+
+ function getVariants() {
+ return array( $this->mLang->getCode() );
+ }
+
+ function getVariantFallbacks( $variant ) {
+ return $this->mLang->getCode();
+ }
+
+ function getPreferredVariant() {
+ return $this->mLang->getCode();
+ }
+
+ function getDefaultVariant() {
+ return $this->mLang->getCode();
+ }
+
+ function getURLVariant() {
+ return '';
+ }
+
+ function getConvRuleTitle() {
+ return false;
+ }
+
+ function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) {
+ }
+
+ function getExtraHashOptions() {
+ return '';
+ }
+
+ function getParsedTitle() {
+ return '';
+ }
+
+ function markNoConversion( $text, $noParse = false ) {
+ return $text;
+ }
+
+ function convertCategoryKey( $key ) {
+ return $key;
+ }
+
+ /** @deprecated since 1.22 is no longer used */
+ function armourMath( $text ) {
+ return $text;
+ }
+
+ function validateVariant( $variant = null ) {
+ return $variant === $this->mLang->getCode() ? $variant : null;
+ }
+
+ function translate( $text, $variant ) {
+ return $text;
+ }
+}
mb_internal_encoding( 'UTF-8' );
}
-/**
- * a fake language converter
- *
- * @ingroup Language
- */
-class FakeConverter {
- /**
- * @var Language
- */
- public $mLang;
- function __construct( $langobj ) { $this->mLang = $langobj; }
- function autoConvert( $text, $variant = false ) { return $text; }
- function autoConvertToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
- function convert( $t ) { return $t; }
- function convertTo( $text, $variant ) { return $text; }
- function convertTitle( $t ) { return $t->getPrefixedText(); }
- function convertNamespace( $ns ) { return $this->mLang->getFormattedNsText( $ns ); }
- function getVariants() { return array( $this->mLang->getCode() ); }
- function getVariantFallbacks( $variant ) { return $this->mLang->getCode(); }
- function getPreferredVariant() { return $this->mLang->getCode(); }
- function getDefaultVariant() { return $this->mLang->getCode(); }
- function getURLVariant() { return ''; }
- function getConvRuleTitle() { return false; }
- function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) { }
- function getExtraHashOptions() { return ''; }
- function getParsedTitle() { return ''; }
- function markNoConversion( $text, $noParse = false ) { return $text; }
- function convertCategoryKey( $key ) { return $key; }
- /** @deprecated since 1.22 is no longer used */
- function armourMath( $text ) { return $text; }
- function validateVariant( $variant = null ) { return $variant === $this->mLang->getCode() ? $variant : null; }
- function translate( $text, $variant ) { return $text; }
-}
-
/**
* Internationalisation code
* @ingroup Language
*/
class Language {
-
/**
* @var LanguageConverter
*/
* Hook which will be called if this is the content language.
* Descendants can use this to register hook functions or modify globals
*/
- function initContLang() { }
+ function initContLang() {
+ }
/**
* Same as getFallbacksFor for current language.
*/
function getFallbackLanguageCode() {
wfDeprecated( __METHOD__, '1.19' );
+
return self::getFallbackFor( $this->mCode );
}
wfRunHooks( 'LanguageGetNamespaces', array( &$this->namespaceNames ) );
}
+
return $this->namespaceNames;
}
*/
function getNsText( $index ) {
$ns = $this->getNamespaces();
+
return isset( $ns[$index] ) ? $ns[$index] : false;
}
*/
function getFormattedNsText( $index ) {
$ns = $this->getNsText( $index );
+
return strtr( $ns, '_', ' ' );
}
function getGenderNsText( $index, $gender ) {
global $wgExtraGenderNamespaces;
- $ns = $wgExtraGenderNamespaces + self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
+ $ns = $wgExtraGenderNamespaces +
+ self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
+
return isset( $ns[$index][$gender] ) ? $ns[$index][$gender] : $this->getNsText( $index );
}
}
global $wgExtraGenderNamespaces;
- $genders = $wgExtraGenderNamespaces + (array)self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
+ $genders = $wgExtraGenderNamespaces +
+ (array)self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
foreach ( $genders as $index => $forms ) {
foreach ( $forms as $alias ) {
$aliases[$alias] = $index;
$this->namespaceAliases = $aliases + $convertedNames;
}
+
return $this->namespaceAliases;
}
throw new MWException( __METHOD__ . ": The timestamp $ts should be a number" );
}
- for ( $p = 0; $p < strlen( $format ); $p++ ) {
+ $formatLength = strlen( $format );
+ for ( $p = 0; $p < $formatLength; $p++ ) {
$num = false;
$code = $format[$p];
- if ( $code == 'x' && $p < strlen( $format ) - 1 ) {
+ if ( $code == 'x' && $p < $formatLength - 1 ) {
$code .= $format[++$p];
}
- if ( ( $code === 'xi' || $code == 'xj' || $code == 'xk' || $code == 'xm' || $code == 'xo' || $code == 'xt' ) && $p < strlen( $format ) - 1 ) {
+ if ( ( $code === 'xi'
+ || $code === 'xj'
+ || $code === 'xk'
+ || $code === 'xm'
+ || $code === 'xo'
+ || $code === 'xt' )
+ && $p < $formatLength - 1 ) {
$code .= $format[++$p];
}
break;
case '\\':
# Backslash escaping
- if ( $p < strlen( $format ) - 1 ) {
+ if ( $p < $formatLength - 1 ) {
$s .= $format[++$p];
} else {
$s .= '\\';
break;
case '"':
# Quoted literal
- if ( $p < strlen( $format ) - 1 ) {
+ if ( $p < $formatLength - 1 ) {
$endQuote = strpos( $format, '"', $p + 1 );
if ( $endQuote === false ) {
# No terminating quote, assume literal "
}
}
}
+
return $s;
}
$zl = $zjd -1948440 + 10632;
$zn = (int)( ( $zl - 1 ) / 10631 );
$zl = $zl - 10631 * $zn + 354;
- $zj = ( (int)( ( 10985 - $zl ) / 5316 ) ) * ( (int)( ( 50 * $zl ) / 17719 ) ) + ( (int)( $zl / 5670 ) ) * ( (int)( ( 43 * $zl ) / 15238 ) );
- $zl = $zl - ( (int)( ( 30 - $zj ) / 15 ) ) * ( (int)( ( 17719 * $zj ) / 50 ) ) - ( (int)( $zj / 16 ) ) * ( (int)( ( 15238 * $zj ) / 43 ) ) + 29;
+ $zj = ( (int)( ( 10985 - $zl ) / 5316 ) ) * ( (int)( ( 50 * $zl ) / 17719 ) ) +
+ ( (int)( $zl / 5670 ) ) * ( (int)( ( 43 * $zl ) / 15238 ) );
+ $zl = $zl - ( (int)( ( 30 - $zj ) / 15 ) ) * ( (int)( ( 17719 * $zj ) / 50 ) ) -
+ ( (int)( $zj / 16 ) ) * ( (int)( ( 15238 * $zj ) / 43 ) ) + 29;
$zm = (int)( ( 24 * $zl ) / 709 );
$zd = $zl - (int)( ( 709 * $zm ) / 24 );
$zy = 30 * $zn + $zj - 30;
# Deduct years from the Gregorian calendar
# depending on the nengo periods
# Months and days are identical
- if ( ( $gy < 1912 ) || ( ( $gy == 1912 ) && ( $gm < 7 ) ) || ( ( $gy == 1912 ) && ( $gm == 7 ) && ( $gd < 31 ) ) ) {
+ if ( ( $gy < 1912 )
+ || ( ( $gy == 1912 ) && ( $gm < 7 ) )
+ || ( ( $gy == 1912 ) && ( $gm == 7 ) && ( $gd < 31 ) )
+ ) {
# Meiji period
$gy_gannen = $gy - 1868 + 1;
$gy_offset = $gy_gannen;
array( '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X' ),
array( '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', 'C' ),
array( '', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', 'M' ),
- array( '', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM', 'MMMMMM', 'MMMMMMM', 'MMMMMMMM', 'MMMMMMMMM', 'MMMMMMMMMM' )
+ array( '', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM', 'MMMMMM', 'MMMMMMM',
+ 'MMMMMMMM', 'MMMMMMMMM', 'MMMMMMMMMM' )
);
$num = intval( $num );
*/
public function getDurationIntervals( $seconds, array $chosenIntervals = array() ) {
if ( empty( $chosenIntervals ) ) {
- $chosenIntervals = array( 'millennia', 'centuries', 'decades', 'years', 'days', 'hours', 'minutes', 'seconds' );
+ $chosenIntervals = array(
+ 'millennia',
+ 'centuries',
+ 'decades',
+ 'years',
+ 'days',
+ 'hours',
+ 'minutes',
+ 'seconds'
+ );
}
$intervals = array_intersect_key( self::$durationIntervals, array_flip( $chosenIntervals ) );
*/
public function getHumanTimestamp( MWTimestamp $ts, MWTimestamp $relativeTo, User $user ) {
$diff = $ts->diff( $relativeTo );
- $diffDay = (bool)( (int)$ts->timestamp->format( 'w' ) - (int)$relativeTo->timestamp->format( 'w' ) );
+ $diffDay = (bool)( (int)$ts->timestamp->format( 'w' ) -
+ (int)$relativeTo->timestamp->format( 'w' ) );
$days = $diff->days ?: (int)$diffDay;
- if ( $diff->invert || $days > 5 && $ts->timestamp->format( 'Y' ) !== $relativeTo->timestamp->format( 'Y' ) ) {
+ if ( $diff->invert || $days > 5
+ && $ts->timestamp->format( 'Y' ) !== $relativeTo->timestamp->format( 'Y' )
+ ) {
// Timestamps are in different years: use full timestamp
// Also do full timestamp for future dates
/**
$breaks = "[ \-\(\)\}\{\.,\?!]";
// find first letter after word break
- $replaceRegexp = "/^([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)|$breaks([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)/";
+ $replaceRegexp = "/^([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)|" .
+ "$breaks([a-z]|[\\xc0-\\xff][\\x80-\\xbf]*)/";
if ( function_exists( 'mb_strtoupper' ) ) {
return preg_replace_callback(
/**
* An arrow, depending on the language direction.
*
- * @param string $direction The direction of the arrow: forwards (default), backwards, left, right, up, down.
+ * @param string $direction The direction of the arrow: forwards (default),
+ * backwards, left, right, up, down.
* @return string
*/
function getArrow( $direction = 'forwards' ) {
if ( isset( $wgGrammarForms[$this->getCode()][$case][$word] ) ) {
return $wgGrammarForms[$this->getCode()][$case][$word];
}
+
return $word;
}
/**
*/
function getGrammarForms() {
global $wgGrammarForms;
- if ( isset( $wgGrammarForms[$this->getCode()] ) && is_array( $wgGrammarForms[$this->getCode()] ) ) {
+ if ( isset( $wgGrammarForms[$this->getCode()] )
+ && is_array( $wgGrammarForms[$this->getCode()] )
+ ) {
return $wgGrammarForms[$this->getCode()];
}
+
return array();
}
/**
throw new MWException( "Invalid language code \"$code\"" );
}
- return "$IP/languages/i18n/$code.json" ;
+ return "$IP/languages/i18n/$code.json";
}
/**
* @todo Document
* @param int|float $seconds
* @param array $format Optional
- * If $format['avoid'] == 'avoidseconds' - don't mention seconds if $seconds >= 1 hour
- * If $format['avoid'] == 'avoidminutes' - don't mention seconds/minutes if $seconds > 48 hours
- * If $format['noabbrevs'] is true - use 'seconds' and friends instead of 'seconds-abbrev' and friends
- * For backwards compatibility, $format may also be one of the strings 'avoidseconds' or 'avoidminutes'
+ * If $format['avoid'] === 'avoidseconds': don't mention seconds if $seconds >= 1 hour.
+ * If $format['avoid'] === 'avoidminutes': don't mention seconds/minutes if $seconds > 48 hours.
+ * If $format['noabbrevs'] is true: use 'seconds' and friends instead of 'seconds-abbrev'
+ * and friends.
+ * For backwards compatibility, $format may also be one of the strings 'avoidseconds'
+ * or 'avoidminutes'.
* @return string
*/
function formatTimePeriod( $seconds, $format = array() ) {
/**
* Format a bitrate for output, using an appropriate
- * unit (bps, kbps, Mbps, Gbps, Tbps, Pbps, Ebps, Zbps or Ybps) according to the magnitude in question
+ * unit (bps, kbps, Mbps, Gbps, Tbps, Pbps, Ebps, Zbps or Ybps) according to
+ * the magnitude in question.
*
* This use base 1000. For base 1024 use formatSize(), for another base
- * see formatComputingNumbers()
+ * see formatComputingNumbers().
*
* @param int $bps
* @return string
* @param bool $atend Optional param for specified if this is the last page
* @return string
*/
- public function viewPrevNext( Title $title, $offset, $limit, array $query = array(), $atend = false ) {
+ public function viewPrevNext( Title $title, $offset, $limit,
+ array $query = array(), $atend = false
+ ) {
// @todo FIXME: Why on earth this needs one message for the text and another one for tooltip?
# Make 'previous' link
* @param string $class Value of the "class" attribute of the link
* @return string HTML fragment
*/
- private function numLink( Title $title, $offset, $limit, array $query, $link, $tooltipMsg, $class ) {
+ private function numLink( Title $title, $offset, $limit, array $query, $link,
+ $tooltipMsg, $class
+ ) {
$query = array( 'limit' => $limit, 'offset' => $offset ) + $query;
- $tooltip = wfMessage( $tooltipMsg )->inLanguage( $this )->title( $title )->numParams( $limit )->text();
+ $tooltip = wfMessage( $tooltipMsg )->inLanguage( $this )->title( $title )
+ ->numParams( $limit )->text();
+
return Html::element( 'a', array( 'href' => $title->getLocalURL( $query ),
'title' => $tooltip, 'class' => $class ), $link );
}
* @ingroup Language
*
* @author Zhengzhu Feng <zhengzhu@gmail.com>
- * @maintainers fdcn <fdcn64@gmail.com>, shinjiman <shinjiman@gmail.com>, PhiLiP <philip.npc@gmail.com>
+ * @author fdcn <fdcn64@gmail.com>
+ * @author shinjiman <shinjiman@gmail.com>
+ * @author PhiLiP <philip.npc@gmail.com>
*/
class LanguageConverter {
-
/**
* languages supporting variants
* @since 1.20
*/
public function getExtraHashOptions() {
$variant = $this->getPreferredVariant();
+
return '!' . $variant;
}
*/
function loadDefaultTables() {
$name = get_class( $this );
+
throw new MWException( "Must implement loadDefaultTables() method in class $name" );
}
/**
* Hook for post processing after conversion tables are loaded.
*/
- function postLoadTables() { }
+ function postLoadTables() {
+ }
/**
* Reload the conversion tables.
if ( $this->mTables ) {
unset( $this->mTables );
}
+
$this->mTablesLoaded = false;
$this->loadTables( false );
}
"readonly_lag": "The database has been automatically locked while the slave database servers catch up to the master",
"internalerror": "Internal error",
"internalerror_info": "Internal error: $1",
- "fileappenderrorread": "Could not read \"$1\" during append.",
- "fileappenderror": "Could not append \"$1\" to \"$2\".",
"filecopyerror": "Could not copy file \"$1\" to \"$2\".",
"filerenameerror": "Could not rename file \"$1\" to \"$2\".",
"filedeleteerror": "Could not delete file \"$1\".",
"directorycreateerror": "Could not create directory \"$1\".",
"filenotfound": "Could not find file \"$1\".",
- "fileexistserror": "Unable to write to file \"$1\": File exists.",
"unexpected": "Unexpected value: \"$1\"=\"$2\".",
"formerror": "Error: Could not submit form.",
"badarticleerror": "This action cannot be performed on this page.",
"savearticle": "Save page",
"preview": "Preview",
"showpreview": "Show preview",
- "showlivepreview": "Live preview",
"showdiff": "Show changes",
"anoneditwarning": "<strong>Warning:</strong> You are not logged in.\nYour IP address will be recorded in this page's edit history.",
"anonpreviewwarning": "<em>You are not logged in. Saving will record your IP address in this page's edit history.</em>",
"group-bot.js": "/* Any JavaScript here will be loaded for bots only */",
"group-sysop.js": "/* Any JavaScript here will be loaded for sysops only */",
"group-bureaucrat.js": "/* Any JavaScript here will be loaded for bureaucrats only */",
- "notacceptable": "The wiki server cannot provide data in a format your client can read.",
"anonymous": "Anonymous {{PLURAL:$1|user|users}} of {{SITENAME}}",
"siteuser": "{{SITENAME}} user $1",
"anonuser": "{{SITENAME}} anonymous user $1",
"bitrate-zetabits": "$1 Zbps",
"bitrate-yottabits": "$1 Ybps",
"livepreview-loading": "Loading...",
- "livepreview-ready": "Loading... Ready!",
- "livepreview-failed": "Live preview failed!\nTry normal preview.",
- "livepreview-error": "Failed to connect: $1 \"$2\".\nTry normal preview.",
"lag-warn-normal": "Changes newer than $1 {{PLURAL:$1|second|seconds}} may not be shown in this list.",
"lag-warn-high": "Due to high database server lag, changes newer than $1 {{PLURAL:$1|second|seconds}} may not be shown in this list.",
"editwatchlist-summary": "",
"compare-invalid-title": "The title you specified is invalid.",
"compare-title-not-exists": "The title you specified does not exist.",
"compare-revision-not-exists": "The revision you specified does not exist.",
- "dberr-header": "This wiki has a problem",
"dberr-problems": "Sorry! This site is experiencing technical difficulties.",
"dberr-again": "Try waiting a few minutes and reloading.",
"dberr-info": "(Cannot contact the database server: $1)",
parent::__construct();
$this->mDescription = "Build JSON messages files from a PHP messages file";
$this->addArg( 'phpfile', 'PHP file defining a $messages array', true );
- $this->addArg( 'jsondir', 'Directory to write JSON files to', true );
+ $this->addArg( 'jsondir', 'Directory to write JSON files to. ' .
+ 'Required unless <phpfile> exists and --shim-only is specified', false );
$this->addOption( 'langcode', 'Language code; only needed for converting core i18n files',
false, true );
+ $this->addOption( 'shim-only', 'Only create or update the backward-compatibility shim' );
}
public function execute() {
$phpfile = $this->getArg( 0 );
$jsondir = $this->getArg( 1 );
+ if ( $this->hasOption( 'shim-only' ) ) {
+ $this->shimOnly( $phpfile, $jsondir );
+ return;
+ }
+
+ if ( $jsondir === null ) {
+ $this->error( 'Argument [jsondir] is required unless --shim-only is specified.' );
+ $this->maybeHelp( true );
+ }
+
if ( !is_readable( $phpfile ) ) {
$this->error( "Error reading $phpfile\n", 1 );
}
$jsonfile = "$jsondir/$langcode.json";
$success = file_put_contents(
$jsonfile,
- FormatJson::encode( $langmsgs, true, FormatJson::ALL_OK ) . "\n"
+ FormatJson::encode( $langmsgs, "\t", FormatJson::ALL_OK ) . "\n"
);
if ( $success === false ) {
$this->error( "FAILED to write $jsonfile", 1 );
$this->output( "Also add \$wgMessagesDirs['YourExtension'] = __DIR__ . '/i18n';\n" );
}
+ protected function shimOnly( $phpfile, $jsondir ) {
+ if ( file_exists( $phpfile ) ) {
+ if ( !is_readable( $phpfile ) ) {
+ $this->error( "Error reading $phpfile\n", 1 );
+ }
+
+ $phpfileContents = file_get_contents( $phpfile );
+ $m = array();
+ if ( !preg_match( '!"/([^"$]+)/\$csCode.json";!', $phpfileContents, $m ) ) {
+ $this->error( "Cannot recognize $phpfile as a shim.\n", 1 );
+ }
+
+ if ( $jsondir === null ) {
+ $jsondir = $m[1];
+ }
+
+ $this->output( "Updating existing shim $phpfile\n" );
+ } elseif ( $jsondir === null ) {
+ $this->error( "$phpfile does not exist.\n" .
+ "Argument [jsondir] is required in order to create a new shim.\n", 1 );
+ } else {
+ $this->output( "Creating new shim $phpfile\n" );
+ }
+
+ $shim = $this->doShim( $jsondir );
+ file_put_contents( $phpfile, $shim );
+ $this->output( "All done.\n" );
+ }
+
protected function doShim( $jsondir ) {
$shim = <<<'PHP'
<?php
* This shim maintains compatibility back to MediaWiki 1.17.
*/
$messages = array();
-$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) {
- $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
- foreach ( $codeSequence as $csCode ) {
- $fileName = __DIR__ . "/{{OUT}}/$csCode.json";
- if ( is_readable( $fileName ) ) {
- $data = FormatJson::decode( file_get_contents( $fileName ), true );
- foreach ( array_keys( $data ) as $key ) {
- if ( $key === '' || $key[0] === '@' ) {
- unset( $data[$key] );
+if ( !function_exists( '{{FUNC}}' ) ) {
+ function {{FUNC}}( $cache, $code, &$cachedData ) {
+ $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
+ foreach ( $codeSequence as $csCode ) {
+ $fileName = dirname( __FILE__ ) . "/{{OUT}}/$csCode.json";
+ if ( is_readable( $fileName ) ) {
+ $data = FormatJson::decode( file_get_contents( $fileName ), true );
+ foreach ( array_keys( $data ) as $key ) {
+ if ( $key === '' || $key[0] === '@' ) {
+ unset( $data[$key] );
+ }
}
+ $cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
}
- $cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
- }
- $cachedData['deps'][] = new FileDependency( $fileName );
+ $cachedData['deps'][] = new FileDependency( $fileName );
+ }
+ return true;
}
- return true;
-};
+
+ $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = '{{FUNC}}';
+}
PHP;
$jsondir = str_replace( '\\', '/', $jsondir );
$shim = str_replace( '{{OUT}}', $jsondir, $shim );
+ $shim = str_replace( '{{FUNC}}', 'wfJsonI18nShim' . wfRandomString( 16 ), $shim );
return $shim;
}