* 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 $frame PPFrame: The frame to use for expanding any template variables
+ * @param PPFrame $frame The frame to use for expanding any template variables
*
* @return string
*/
* hook.
*
* @param string $text text to be expanded
- * @param $frame PPFrame: The frame to use for expanding any template variables
- * @return String
+ * @param PPFrame $frame The frame to use for expanding any template variables
+ * @return string
* @since 1.19
*/
public function recursivePreprocess( $text, $frame = false ) {
* @param $text String
* @param $title Title
* @param $options ParserOptions
+ * @param $params Array
* @return String
*/
- public function getPreloadText( $text, Title $title, ParserOptions $options ) {
+ public function getPreloadText( $text, Title $title, ParserOptions $options, $params = array() ) {
+ $msg = new RawMessage( $text );
+ $text = $msg->params( $params )->plain();
+
# Parser (re)initialisation
$this->startParse( $title, $options, self::OT_PLAIN, true );
* Set the current user.
* Should only be used when doing pre-save transform.
*
- * @param $user Mixed: User object or null (to reset)
+ * @param User|null $user User object or null (to reset)
*/
function setUser( $user ) {
$this->mUser = $user;
/**
* Set the output type
*
- * @param $ot Integer: new value
+ * @param int $ot new value
*/
function setOutputType( $ot ) {
$this->mOutputType = $ot;
* '<element param="x">tag content</element>' ) )
* @endcode
*
- * @param array $elements list of element names. Comments are always extracted.
+ * @param array $elements List of element names. Comments are always extracted.
* @param string $text Source text string.
* @param array $matches Out parameter, Array: extracted tags
- * @param $uniq_prefix string
- * @return String: stripped text
+ * @param string $uniq_prefix
+ * @return string Stripped text
*/
public static function extractTagsAndParams( $elements, $text, &$matches, $uniq_prefix = '' ) {
static $n = 1;
* @param $url String
* @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
- * the URL differently; as a workaround, just use the output for
- * statistical records, not for actual linking/output.
+ * @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
+ * the URL differently; as a workaround, just use the output for
+ * statistical records, not for actual linking/output.
*/
static function replaceUnusualEscapes( $url ) {
return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
/**
* Process [[ ]] wikilinks
*
- * @param $s string
+ * @param string $s
*
- * @return String: processed text
+ * @return string Processed text
*
* @private
*/
* breaking URLs in the following text without breaking trails on the
* wiki links, it's been made into a horrible function.
*
- * @param $nt Title
- * @param $text String
- * @param array $query or String
- * @param $trail String
- * @param $prefix String
- * @return String: HTML-wikitext mix oh yuck
+ * @param Title $nt
+ * @param string $text
+ * @param array|string $query
+ * @param string $trail
+ * @param string $prefix
+ * @return string HTML-wikitext mix oh yuck
*/
function makeKnownLinkHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
list( $inside, $trail ) = Linker::splitTrail( $trail );
* Not needed quite as much as it used to be since free links are a bit
* more sensible these days. But bracketed links are still an issue.
*
- * @param string $text more-or-less HTML
- * @return String: less-or-more HTML with NOPARSE bits
+ * @param string $text More-or-less HTML
+ * @return string Less-or-more HTML with NOPARSE bits
*/
function armorLinks( $text ) {
return preg_replace( '/\b((?i)' . $this->mUrlProtocols . ')/',
/**
* Handle link to subpage if necessary
*
- * @param string $target the source of the link
- * @param &$text String: the link text, modified as necessary
- * @return string the full name of the link
+ * @param string $target The source of the link
+ * @param string &$text The link text, modified as necessary
+ * @return string The full name of the link
* @private
*/
function maybeDoSubpageLink( $target, &$text ) {
/**
* Make lists from lines starting with ':', '*', '#', etc. (DBL)
*
- * @param $text String
- * @param $linestart Boolean: whether or not this is at the start of a line.
+ * @param string $text
+ * @param bool $linestart Whether or not this is at the start of a line.
* @private
- * @return string the lists rendered as HTML
+ * @return string The lists rendered as HTML
*/
function doBlockLevels( $text, $linestart ) {
wfProfileIn( __METHOD__ );
* This is the ghost of replace_variables().
*
* @param string $text The text to parse
- * @param $flags Integer: bitwise combination of:
- * self::PTD_FOR_INCLUSION Handle "<noinclude>" and "<includeonly>" as if the text is being
- * included. Default is to assume a direct page view.
+ * @param int $flags Bitwise combination of:
+ * - self::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.
* Return the text of a template, after recursively
* replacing any variables or templates within the template.
*
- * @param array $piece the parts of the template
+ * @param array $piece The parts of the template
* $piece['title']: the title, i.e. the part before the |
* $piece['parts']: the parameter array
* $piece['lineStart']: whether the brace was at the start of a line
- * @param $frame PPFrame The current frame, contains template arguments
+ * @param PPFrame $frame The current frame, contains template arguments
* @throws MWException
- * @return String: the text of the template
+ * @return string The text of the template
* @private
*/
function braceSubstitution( $piece, $frame ) {
}
} elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
$found = false; # access denied
- wfDebug( __METHOD__ . ": template inclusion denied for " . $title->getPrefixedDBkey() );
+ wfDebug( __METHOD__ . ": template inclusion denied for " .
+ $title->getPrefixedDBkey() . "\n" );
} else {
list( $text, $title ) = $this->getTemplateDom( $title );
if ( $text !== false ) {
* Static function to get a template
* Can be overridden via ParserOptions::setTemplateCallback().
*
- * @param $title Title
- * @param $parser Parser
+ * @param Title $title
+ * @param Parser $parser
*
* @return array
*/
/**
* Increment an include size counter
*
- * @param string $type the type of expansion
- * @param $size Integer: the size of the text
- * @return Boolean: false if this inclusion would take it over the maximum, true otherwise
+ * @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
*/
function incrementIncludeSize( $type, $size ) {
if ( $this->mIncludeSizes[$type] + $size > $this->mOptions->getMaxIncludeSize() ) {
/**
* Increment the expensive function count
*
- * @return Boolean: false if the limit has been exceeded
+ * @return bool false if the limit has been exceeded
*/
function incrementExpensiveFunctionCount() {
$this->mExpensiveFunctionCount++;
* Add a tracking category, getting the title from a system message,
* or print a debug message if the title is invalid.
*
- * @param string $msg message key
- * @return Boolean: whether the addition was successful
+ * Please add any message that you use with this function to
+ * $wgTrackingCategories. That way they will be listed on
+ * Special:TrackingCategories.
+ *
+ * @param string $msg Message key
+ * @return bool Whether the addition was successful
*/
public function addTrackingCategory( $msg ) {
if ( $this->mTitle->getNamespace() === NS_SPECIAL ) {
* Transform wiki markup when saving a page by doing "\r\n" -> "\n"
* conversion, substitting signatures, {{subst:}} templates, etc.
*
- * @param string $text the text to transform
- * @param $title Title: the Title object for the current article
- * @param $user User: the User object describing the current user
- * @param $options ParserOptions: parsing options
- * @param $clearState Boolean: whether to clear the parser state first
- * @return String: the altered wiki markup
+ * @param string $text The text to transform
+ * @param Title $title The Title object for the current article
+ * @param User $user The User object describing the current user
+ * @param ParserOptions $options Parsing options
+ * @param bool $clearState Whether to clear the parser state first
+ * @return string The altered wiki markup
*/
public function preSaveTransform( $text, Title $title, User $user, ParserOptions $options, $clearState = true ) {
$this->startParse( $title, $options, self::OT_WIKI, $clearState );
* 1) Strip ~~~, ~~~~ and ~~~~~ out of signatures @see cleanSigInSig
* 2) Substitute all transclusions
*
- * @param $text String
+ * @param string $text
* @param bool $parsing Whether we're cleaning (preferences save) or parsing
- * @return String: signature text
+ * @return string Signature text
*/
public function cleanSig( $text, $parsing = false ) {
if ( !$parsing ) {
/**
* Strip ~~~, ~~~~ and ~~~~~ out of signatures
*
- * @param $text String
- * @return String: signature text with /~{3,5}/ removed
+ * @param string $text
+ * @return string Signature text with /~{3,5}/ removed
*/
public static function cleanSigInSig( $text ) {
$text = preg_replace( '/~{3,5}/', '', $text );
/**
* Wrapper for preprocess()
*
- * @param string $text the text to preprocess
- * @param $options ParserOptions: options
- * @param $title Title object or null to use $wgTitle
- * @return String
+ * @param string $text The text to preprocess
+ * @param ParserOptions $options Options
+ * @param Title|null $title Title object or null to use $wgTitle
+ * @return string
*/
public function transformMsg( $text, $options, $title = null ) {
static $executing = false;
* this interface, as it is not documented and injudicious use could smash
* private variables.**
*
- * @param $tag Mixed: the tag to use, e.g. 'hook' for "<hook>"
- * @param $callback Mixed: the callback function (and object) to use for the tag
+ * @param string $tag The tag to use, e.g. 'hook' for "<hook>"
+ * @param mixed $callback The callback function (and object) to use for the tag
* @throws MWException
- * @return Mixed|null The old value of the mTagHooks array associated with the hook
+ * @return mixed|null The old value of the mTagHooks array associated with the hook
*/
public function setHook( $tag, $callback ) {
$tag = strtolower( $tag );
* @since 1.10
* @todo better document or deprecate this
*
- * @param $tag Mixed: the tag to use, e.g. 'hook' for "<hook>"
- * @param $callback Mixed: the callback function (and object) to use for the tag
+ * @param string $tag The tag to use, e.g. 'hook' for "<hook>"
+ * @param mixed $callback The callback function (and object) to use for the tag
* @throws MWException
- * @return Mixed|null The old value of the mTagHooks array associated with the hook
+ * @return mixed|null The old value of the mTagHooks array associated with the hook
*/
function setTransparentTagHook( $tag, $callback ) {
$tag = strtolower( $tag );
* isHTML The returned text is HTML, armour it against wikitext transformation
*
* @param string $id The magic word ID
- * @param $callback Mixed: the callback function (and object) to use
- * @param $flags Integer: a combination of the following flags:
+ * @param mixed $callback The callback function (and object) to use
+ * @param int $flags A combination of the following flags:
* SFH_NO_HASH No leading hash, i.e. {{plural:...}} instead of {{#if:...}}
*
* SFH_OBJECT_ARGS Pass the template arguments as PPNode objects instead of text. This
$handlerOptions[$paramName] = $match;
} else {
// Guess not. Append it to the caption.
- wfDebug( "$parameterMatch failed parameter validation" );
+ wfDebug( "$parameterMatch failed parameter validation\n" );
$label .= '|' . $parameterMatch;
}
}
* string. If $text is the empty string and section 0 is replaced, $newText is
* returned.
*
- * @param string $mode one of "get" or "replace"
- * @param string $newText replacement text for section data.
- * @return String: for "get", the extracted section text.
- * for "replace", the whole page with the section replaced.
+ * @param string $mode One of "get" or "replace"
+ * @param string $newText Replacement text for section data.
+ * @return string For "get", the extracted section text.
+ * for "replace", the whole page with the section replaced.
*/
private function extractSections( $text, $section, $mode, $newText = '' ) {
global $wgTitle; # not generally used but removes an ugly failure mode
* specified by $section has been replaced with $text. If the target
* section does not exist, $oldtext is returned unchanged.
*
- * @param string $oldtext former text of the article
- * @param int $section section identifier
- * @param string $text replacing text
- * @return String: modified text
+ * @param string $oldtext Former text of the article
+ * @param int $section Section identifier
+ * @param string $text Replacing text
+ * @return string Modified text
*/
public function replaceSection( $oldtext, $section, $text ) {
return $this->extractSections( $oldtext, $section, "replace", $text );
/**
* Get the ID of the revision we are parsing
*
- * @return Mixed: integer or null
+ * @return int|null
*/
function getRevisionId() {
return $this->mRevisionId;
/**
* Get the name of the user that edited the last revision
*
- * @return String: user name
+ * @return string User name
*/
function getRevisionUser() {
if ( is_null( $this->mRevisionUser ) ) {