*/
const CHECK_USER_RIGHTS = 1;
- var $mTitle, $mUser, $mCheckRights;
- private $loaded = false, $watched, $timestamp;
+ /** @var Title */
+ public $mTitle;
+
+ /** @var User */
+ public $mUser;
+
+ /** @var int */
+ public $mCheckRights;
+
+ /** @var bool */
+ private $loaded = false;
+
+ /** @var bool */
+ private $watched;
+
+ /** @var string */
+ private $timestamp;
/**
* Create a WatchedItem object with the given user and title
* Pass either WatchedItem::IGNORE_USER_RIGHTS or WatchedItem::CHECK_USER_RIGHTS.
* @return WatchedItem
*/
- public static function fromUserTitle( $user, $title, $checkRights = WatchedItem::CHECK_USER_RIGHTS ) {
+ public static function fromUserTitle( $user, $title,
+ $checkRights = WatchedItem::CHECK_USER_RIGHTS
+ ) {
$wl = new WatchedItem;
$wl->mUser = $user;
$wl->mTitle = $title;
# Perform replace
# Note that multi-row replace is very efficient for MySQL but may be inefficient for
# some other DBMSes, mostly due to poor simulation by us
- $dbw->replace( 'watchlist', array( array( 'wl_user', 'wl_namespace', 'wl_title' ) ), $values, __METHOD__ );
+ $dbw->replace(
+ 'watchlist',
+ array( array( 'wl_user', 'wl_namespace', 'wl_title' ) ),
+ $values,
+ __METHOD__
+ );
+
return true;
}
}
public function getRequestURL() {
if ( isset( $_SERVER['REQUEST_URI'] ) && strlen( $_SERVER['REQUEST_URI'] ) ) {
$base = $_SERVER['REQUEST_URI'];
- } elseif ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) && strlen( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
+ } elseif ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] )
+ && strlen( $_SERVER['HTTP_X_ORIGINAL_URL'] )
+ ) {
// Probably IIS; doesn't set REQUEST_URI
$base = $_SERVER['HTTP_X_ORIGINAL_URL'];
} elseif ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
We can't serve non-HTML content from the URL you have requested, because
Internet Explorer would interpret it as an incorrect and potentially dangerous
content type.</p>
-<p>Instead, please use <a href="$encUrl">this URL</a>, which is the same as the URL you have requested, except that
-"&*" is appended. This prevents Internet Explorer from seeing a bogus file
-extension.
+<p>Instead, please use <a href="$encUrl">this URL</a>, which is the same as the
+URL you have requested, except that "&*" is appended. This prevents Internet
+Explorer from seeing a bogus file extension.
</p>
</body>
</html>
/**
* Parse the Accept-Language header sent by the client into an array
- * @return array array( languageCode => q-value ) sorted by q-value in descending order then
- * appearing time in the header in ascending order.
+ *
+ * @return array array( languageCode => q-value ) sorted by q-value in
+ * descending order then appearing time in the header in ascending order.
* May contain the "language" '*', which applies to languages other than those explicitly listed.
* This is aligned with rfc2616 section 14.4
* Preference for earlier languages appears in rfc3282 as an extension to HTTP/1.1.
*/
public function getAcceptLang() {
- // Modified version of code found at http://www.thefutureoftheweb.com/blog/use-accept-language-header
+ // Modified version of code found at
+ // http://www.thefutureoftheweb.com/blog/use-accept-language-header
$acceptLang = $this->getHeader( 'Accept-Language' );
if ( !$acceptLang ) {
return array();
// Break up string into pieces (languages and q factors)
$lang_parse = null;
- preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/',
- $acceptLang, $lang_parse );
+ preg_match_all(
+ '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/',
+ $acceptLang,
+ $lang_parse
+ );
if ( !count( $lang_parse[1] ) ) {
return array();
}
if ( is_array( $_SERVER['REMOTE_ADDR'] ) || strpos( $_SERVER['REMOTE_ADDR'], ',' ) !== false ) {
- throw new MWException( __METHOD__ . " : Could not determine the remote IP address due to multiple values." );
+ throw new MWException( __METHOD__
+ . " : Could not determine the remote IP address due to multiple values." );
} else {
$ipchain = $_SERVER['REMOTE_ADDR'];
}
* @param string $protocol 'http' or 'https'
* @throws MWException
*/
- public function __construct( $data = array(), $wasPosted = false, $session = null, $protocol = 'http' ) {
+ public function __construct( $data = array(), $wasPosted = false,
+ $session = null, $protocol = 'http'
+ ) {
if ( is_array( $data ) ) {
$this->data = $data;
} else {
# This must be done before any globals are set by the code
if ( ini_get( 'register_globals' ) ) {
if ( isset( $_REQUEST['GLOBALS'] ) || isset( $_FILES['GLOBALS'] ) ) {
- die( '<a href="http://www.hardened-php.net/globals-problem">$GLOBALS overwrite vulnerability</a>' );
+ die( '<a href="http://www.hardened-php.net/globals-problem">'
+ . '$GLOBALS overwrite vulnerability</a>' );
}
+
$verboten = array(
'GLOBALS',
'_SERVER',
'_SESSION',
'HTTP_SESSION_VARS'
);
+
foreach ( $_REQUEST as $name => $value ) {
if ( in_array( $name, $verboten ) ) {
header( "HTTP/1.1 500 Internal Server Error" );
* @internal documentation reviewed 15 Mar 2010
*/
class MediaWiki {
-
/**
- * TODO: fold $output, etc, into this
+ * @todo Fold $output, etc, into this
* @var IContextSource
*/
private $context;
}
// Use the main page as default title if nothing else has been provided
- if ( $ret === null && strval( $title ) === '' && !$request->getCheck( 'curid' ) && $action !== 'delete' ) {
+ if ( $ret === null
+ && strval( $title ) === ''
+ && !$request->getCheck( 'curid' )
+ && $action !== 'delete'
+ ) {
$ret = Title::newMainPage();
}
$this->mFile->upgradeRow();
$this->mFile->purgeCache( array( 'forThumbRefresh' => true ) );
} else {
- wfDebug( 'ImagePage::doPurge no image for ' . $this->mFile->getName() . "; limiting purge to cache only\n" );
+ wfDebug( 'ImagePage::doPurge no image for '
+ . $this->mFile->getName() . "; limiting purge to cache only\n" );
// even if the file supposedly doesn't exist, force any cached information
// to be updated (in case the cached information is wrong)
$this->mFile->purgeCache( array( 'forThumbRefresh' => true ) );
* some source.
*
* @param object|string|int $from One of the following:
- * - A DB query result object
- * - "fromdb" or WikiPage::READ_NORMAL to get from a slave DB
- * - "fromdbmaster" or WikiPage::READ_LATEST to get from the master DB
- * - "forupdate" or WikiPage::READ_LOCKING to get from the master DB using SELECT FOR UPDATE
+ * - A DB query result object.
+ * - "fromdb" or WikiPage::READ_NORMAL to get from a slave DB.
+ * - "fromdbmaster" or WikiPage::READ_LATEST to get from the master DB.
+ * - "forupdate" or WikiPage::READ_LOCKING to get from the master DB
+ * using SELECT FOR UPDATE.
*
* @return void
*/
* @return string|bool The text of the current revision
* @deprecated since 1.21, getContent() should be used instead.
*/
- public function getText( $audience = Revision::FOR_PUBLIC, User $user = null ) { // @todo deprecated, replace usage!
+ public function getText( $audience = Revision::FOR_PUBLIC, User $user = null ) {
ContentHandler::deprecated( __METHOD__, '1.21' );
$this->loadLastEdit();
* @param bool $lastRevIsRedirect If given, will optimize adding and
* removing rows in redirect table.
* @return bool true on success, false on failure
- * @private
*/
- public function updateRevisionOn( $dbw, $revision, $lastRevision = null, $lastRevIsRedirect = null ) {
+ public function updateRevisionOn( $dbw, $revision, $lastRevision = null,
+ $lastRevIsRedirect = null
+ ) {
global $wgContentHandlerUseDB;
wfProfileIn( __METHOD__ );
*
* @deprecated since 1.21, use replaceSectionContent() instead
*/
- public function replaceSection( $section, $text, $sectionTitle = '', $edittime = null ) {
+ public function replaceSection( $section, $text, $sectionTitle = '',
+ $edittime = null
+ ) {
ContentHandler::deprecated( __METHOD__, '1.21' );
- if ( strval( $section ) == '' ) { //NOTE: keep condition in sync with condition in replaceSectionContent!
+ //NOTE: keep condition in sync with condition in replaceSectionContent!
+ if ( strval( $section ) == '' ) {
// Whole-page edit; let the whole text through
return $text;
}
*
* @return bool
*
- * @todo The skin should check this and not offer section functionality if sections are not supported.
- * @todo The EditPage should check this and not offer section functionality if sections are not supported.
+ * @todo The skin should check this and not offer section functionality if
+ * sections are not supported.
+ * @todo The EditPage should check this and not offer section functionality
+ * if sections are not supported.
*/
public function supportsSections() {
return $this->getContentHandler()->supportsSections();
* EDIT_AUTOSUMMARY
* Fill in blank summaries with generated text where possible
*
- * If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected.
- * If EDIT_UPDATE is specified and the article doesn't exist, the function will return an
- * edit-gone-missing error. If EDIT_NEW is specified and the article does exist, an
- * edit-already-exists error will be returned. These two conditions are also possible with
+ * If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the
+ * article will be detected. If EDIT_UPDATE is specified and the article
+ * doesn't exist, the function will return an edit-gone-missing error. If
+ * EDIT_NEW is specified and the article does exist, an edit-already-exists
+ * error will be returned. These two conditions are also possible with
* auto-detection due to MediaWiki's performance-optimised locking strategy.
*
* @param bool|int $baseRevId The revision ID this edit was based off, if any
*
* @throws MWException
* @return Status object. Possible errors:
- * edit-hook-aborted: The ArticleSave hook aborted the edit but didn't set the fatal flag of $status
- * edit-gone-missing: In update mode, but the article didn't exist
- * edit-conflict: In update mode, the article changed unexpectedly
- * edit-no-change: Warning that the text was the same as before
- * edit-already-exists: In creation mode, but the article already exists
+ * edit-hook-aborted: The ArticleSave hook aborted the edit but didn't
+ * set the fatal flag of $status
+ * edit-gone-missing: In update mode, but the article didn't exist.
+ * edit-conflict: In update mode, the article changed unexpectedly.
+ * edit-no-change: Warning that the text was the same as before.
+ * edit-already-exists: In creation mode, but the article already exists.
*
- * Extensions may define additional errors.
+ * Extensions may define additional errors.
*
- * $return->value will contain an associative array with members as follows:
- * new: Boolean indicating if the function attempted to create a new article
- * revision: The revision object for the inserted revision, or null
+ * $return->value will contain an associative array with members as follows:
+ * new: Boolean indicating if the function attempted to create a new article.
+ * revision: The revision object for the inserted revision, or null.
*
- * Compatibility note: this function previously returned a boolean value indicating success/failure
+ * Compatibility note: this function previously returned a boolean value
+ * indicating success/failure
*
* @deprecated since 1.21: use doEditContent() instead.
*/
* EDIT_AUTOSUMMARY
* Fill in blank summaries with generated text where possible
*
- * If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected.
- * If EDIT_UPDATE is specified and the article doesn't exist, the function will return an
- * edit-gone-missing error. If EDIT_NEW is specified and the article does exist, an
- * edit-already-exists error will be returned. These two conditions are also possible with
+ * If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the
+ * article will be detected. If EDIT_UPDATE is specified and the article
+ * doesn't exist, the function will return an edit-gone-missing error. If
+ * EDIT_NEW is specified and the article does exist, an edit-already-exists
+ * error will be returned. These two conditions are also possible with
* auto-detection due to MediaWiki's performance-optimised locking strategy.
*
* @param bool|int $baseRevId The revision ID this edit was based off, if any
* @param User $user The user doing the edit
- * @param string $serialisation_format Format for storing the content in the database
+ * @param string $serialisation_format Format for storing the content in the
+ * database.
*
* @throws MWException
* @return Status object. Possible errors:
- * edit-hook-aborted: The ArticleSave hook aborted the edit but didn't set the fatal flag of $status
- * edit-gone-missing: In update mode, but the article didn't exist
- * edit-conflict: In update mode, the article changed unexpectedly
- * edit-no-change: Warning that the text was the same as before
- * edit-already-exists: In creation mode, but the article already exists
+ * edit-hook-aborted: The ArticleSave hook aborted the edit but didn't
+ * set the fatal flag of $status.
+ * edit-gone-missing: In update mode, but the article didn't exist.
+ * edit-conflict: In update mode, the article changed unexpectedly.
+ * edit-no-change: Warning that the text was the same as before.
+ * edit-already-exists: In creation mode, but the article already exists.
*
* Extensions may define additional errors.
*
* $return->value will contain an associative array with members as follows:
- * new: Boolean indicating if the function attempted to create a new article
- * revision: The revision object for the inserted revision, or null
+ * new: Boolean indicating if the function attempted to create a new article.
+ * revision: The revision object for the inserted revision, or null.
*
* @since 1.21
*/
$options = $this->getContentHandler()->makeParserOptions( $context );
if ( $this->getTitle()->isConversionTable() ) {
- // @todo ConversionTable should become a separate content model, so we don't need special cases like this one.
+ // @todo ConversionTable should become a separate content model, so
+ // we don't need special cases like this one.
$options->disableContentConversion();
}
$edit->format = $serialization_format;
$edit->popts = $this->makeParserOptions( 'canonical' );
- $edit->output = $edit->pstContent ? $edit->pstContent->getParserOutput( $this->mTitle, $revid, $edit->popts ) : null;
+ $edit->output = $edit->pstContent
+ ? $edit->pstContent->getParserOutput( $this->mTitle, $revid, $edit->popts )
+ : null;
$edit->newContent = $content;
$edit->oldContent = $this->getContent( Revision::RAW );
* @param User $user The user updating the restrictions
* @return Status
*/
- public function doUpdateRestrictions( array $limit, array $expiry, &$cascade, $reason, User $user ) {
+ public function doUpdateRestrictions( array $limit, array $expiry,
+ &$cascade, $reason, User $user
+ ) {
global $wgCascadingRestrictionLevels, $wgContLang;
if ( wfReadOnly() ) {
}
// Only certain restrictions can cascade...
- $editrestriction = isset( $limit['edit'] ) ? array( $limit['edit'] ) : $this->mTitle->getRestrictions( 'edit' );
+ $editrestriction = isset( $limit['edit'] )
+ ? array( $limit['edit'] )
+ : $this->mTitle->getRestrictions( 'edit' );
foreach ( array_keys( $editrestriction, 'sysop' ) as $key ) {
$editrestriction[$key] = 'editprotected'; // backwards compatibility
}
// insert null revision to identify the page protection change as edit summary
$latest = $this->getLatest();
- $nullRevision = $this->insertProtectNullRevision( $revCommentMsg, $limit, $expiry, $cascade, $reason, $user );
+ $nullRevision = $this->insertProtectNullRevision(
+ $revCommentMsg,
+ $limit,
+ $expiry,
+ $cascade,
+ $reason,
+ $user
+ );
+
if ( $nullRevision === null ) {
return Status::newFatal( 'no-null-revision', $this->mTitle->getPrefixedText() );
}
* @param User|null $user
* @return Revision|null Null on error
*/
- public function insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user = null ) {
+ public function insertProtectNullRevision( $revCommentMsg, array $limit,
+ array $expiry, $cascade, $reason, $user = null
+ ) {
global $wgContLang;
$dbw = wfGetDB( DB_MASTER );
$protectDescription = $this->protectDescription( $limit, $expiry );
if ( $protectDescription ) {
$editComment .= wfMessage( 'word-separator' )->inContentLanguage()->text();
- $editComment .= wfMessage( 'parentheses' )->params( $protectDescription )->inContentLanguage()->text();
+ $editComment .= wfMessage( 'parentheses' )->params( $protectDescription )
+ ->inContentLanguage()->text();
}
if ( $cascade ) {
$editComment .= wfMessage( 'word-separator' )->inContentLanguage()->text();
* Do some database updates after deletion
*
* @param int $id page_id value of the page being deleted
- * @param Content $content Optional page content to be used when determining the required updates.
- * This may be needed because $this->getContent() may already return null when the page proper was deleted.
+ * @param Content $content Optional page content to be used when determining
+ * the required updates. This may be needed because $this->getContent()
+ * may already return null when the page proper was deleted.
*/
public function doDeleteUpdates( $id, Content $content = null ) {
// update site status
if ( $s === false ) {
// No one else ever edited this page
return array( array( 'cantrollback' ) );
- } elseif ( $s->rev_deleted & Revision::DELETED_TEXT || $s->rev_deleted & Revision::DELETED_USER ) {
+ } elseif ( $s->rev_deleted & Revision::DELETED_TEXT
+ || $s->rev_deleted & Revision::DELETED_USER
+ ) {
// Only admins can see this text
return array( array( 'notvisiblerev' ) );
}
}
// Actually store the edit
- $status = $this->doEditContent( $target->getContent(), $summary, $flags, $target->getId(), $guser );
+ $status = $this->doEditContent(
+ $target->getContent(),
+ $summary,
+ $flags,
+ $target->getId(),
+ $guser
+ );
if ( !$status->isOK() ) {
return $status->getErrorsArray();
* Purge caches on page update etc
*
* @param Title $title
- * @todo Verify that $title is always a Title object (and never false or null), add Title hint to parameter $title
+ * @todo Verify that $title is always a Title object (and never false or
+ * null), add Title hint to parameter $title.
*/
public static function onArticleEdit( $title ) {
// Invalidate caches of articles which include this page
* @deprecated since 1.21, use ContentHandler::getAutosummary() instead
*/
public static function getAutosummary( $oldtext, $newtext, $flags ) {
- // NOTE: stub for backwards-compatibility. assumes the given text is wikitext. will break horribly if it isn't.
+ // NOTE: stub for backwards-compatibility. assumes the given text is
+ // wikitext. will break horribly if it isn't.
ContentHandler::deprecated( __METHOD__, '1.21' );
if ( count( $links_diff ) > 0 ) {
// Whee, link updates time.
- // Note: we are only interested in links here. We don't need to get other DataUpdate items from the parser output.
+ // Note: we are only interested in links here. We don't need to get
+ // other DataUpdate items from the parser output.
$u = new LinksUpdate( $this->mTitle, $parserOutput, false );
$u->doUpdate();
}
}
/**
- * Returns a list of updates to be performed when this page is deleted. The updates should remove any information
- * about this page from secondary data stores such as links tables.
+ * Returns a list of updates to be performed when this page is deleted. The
+ * updates should remove any information about this page from secondary data
+ * stores such as links tables.
*
- * @param Content|null $content Optional Content object for determining the necessary updates
+ * @param Content|null $content Optional Content object for determining the
+ * necessary updates.
* @return array An array of DataUpdates objects
*/
public function getDeletionUpdates( Content $content = null ) {
}
class PoolWorkArticleView extends PoolCounterWork {
-
- /**
- * @var Page
- */
+ /** @var Page */
private $page;
- /**
- * @var string
- */
+ /** @var string */
private $cacheKey;
- /**
- * @var int
- */
+ /** @var int */
private $revid;
- /**
- * @var ParserOptions
- */
+ /** @var ParserOptions */
private $parserOptions;
- /**
- * @var Content|null
- */
+ /** @var Content|null */
private $content = null;
- /**
- * @var ParserOutput|bool
- */
+ /** @var ParserOutput|bool */
private $parserOutput = false;
- /**
- * @var bool
- */
+ /** @var bool */
private $isDirty = false;
- /**
- * @var Status|bool
- */
+ /** @var Status|bool */
private $error = false;
/**
- * Constructor
- *
* @param Page $page
- * @param int $revid ID of the revision being parsed
- * @param bool $useParserCache Whether to use the parser cache
- * @param ParserOptions $parserOptions ParserOptions to use for the parse operation
- * @param Content|string $content Content to parse or null to load it; may also be given as a wikitext string, for BC
- */
- public function __construct( Page $page, ParserOptions $parserOptions, $revid, $useParserCache, $content = null ) {
+ * @param int $revid ID of the revision being parsed.
+ * @param bool $useParserCache Whether to use the parser cache.
+ * @param ParserOptions $parserOptions ParserOptions to use for the parse
+ * operation.
+ * @param Content|string $content Content to parse or null to load it; may
+ * also be given as a wikitext string, for BC.
+ */
+ public function __construct( Page $page, ParserOptions $parserOptions,
+ $revid, $useParserCache, $content = null
+ ) {
if ( is_string( $content ) ) { // BC: old style call
$modelId = $page->getRevision()->getContentModel();
$format = $page->getRevision()->getContentFormat();
$cacheTime = wfTimestampNow();
$time = - microtime( true );
- $this->parserOutput = $content->getParserOutput( $this->page->getTitle(), $this->revid, $this->parserOptions );
+ $this->parserOutput = $content->getParserOutput(
+ $this->page->getTitle(),
+ $this->revid,
+ $this->parserOptions
+ );
$time += microtime( true );
// Timing hack
* @param bool $allowShortTag Whether '' in $contents will result in a contentless closed tag
* @return string
*/
- public static function element( $element, $attribs = null, $contents = '', $allowShortTag = true ) {
+ public static function element( $element, $attribs = null, $contents = '',
+ $allowShortTag = true
+ ) {
$out = '<' . $element;
if ( !is_null( $attribs ) ) {
$out .= self::expandAttributes( $attribs );
* @return string
* @deprecated since 1.19
*/
- public static function namespaceSelector( $selected = '', $all = null, $element_name = 'namespace', $label = null ) {
+ public static function namespaceSelector( $selected = '', $all = null,
+ $element_name = 'namespace', $label = null
+ ) {
wfDeprecated( __METHOD__, '1.19' );
return Html::namespaceSelector( array(
'selected' => $selected,
/**
* Create a date selector
*
- * @param string $selected The month which should be selected, default ''
- * @param string $allmonths Value of a special item denoting all month. Null to not include (default)
+ * @param string $selected The month which should be selected, default ''.
+ * @param string $allmonths Value of a special item denoting all month.
+ * Null to not include (default).
* @param string $id Element identifier
* @return string Html string containing the month selector
*/
$selected = '';
}
if ( !is_null( $allmonths ) ) {
- $options[] = self::option( wfMessage( 'monthsall' )->text(), $allmonths, $selected === $allmonths );
+ $options[] = self::option(
+ wfMessage( 'monthsall' )->text(),
+ $allmonths,
+ $selected === $allmonths
+ );
}
for ( $i = 1; $i < 13; $i++ ) {
$options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i );
}
- return self::openElement( 'select', array( 'id' => $id, 'name' => 'month', 'class' => 'mw-month-selector' ) )
+ return self::openElement( 'select', array(
+ 'id' => $id,
+ 'name' => 'month',
+ 'class' => 'mw-month-selector'
+ ) )
. implode( "\n", $options )
. self::closeElement( 'select' );
}
* @param Message|null $msg Label message key (since 1.20)
* @return array containing 2 items: label HTML and select list HTML
*/
- public static function languageSelector( $selected, $customisedOnly = true, $inLanguage = null, $overrideAttrs = array(), Message $msg = null ) {
+ public static function languageSelector( $selected, $customisedOnly = true,
+ $inLanguage = null, $overrideAttrs = array(), Message $msg = null
+ ) {
global $wgLanguageCode;
$include = $customisedOnly ? 'mwfile' : 'mw';
* @param array $attribs Other attributes
* @return string HTML
*/
- public static function password( $name, $size = false, $value = false, $attribs = array() ) {
- return self::input( $name, $size, $value, array_merge( $attribs, array( 'type' => 'password' ) ) );
+ public static function password( $name, $size = false, $value = false,
+ $attribs = array()
+ ) {
+ return self::input( $name, $size, $value,
+ array_merge( $attribs, array( 'type' => 'password' ) ) );
}
/**
* @param array $attribs Other attributes
* @return string HTML
*/
- public static function inputLabel( $label, $name, $id, $size = false, $value = false, $attribs = array() ) {
+ public static function inputLabel( $label, $name, $id, $size = false,
+ $value = false, $attribs = array()
+ ) {
list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
return $label . ' ' . $input;
}
*
* @return array
*/
- public static function inputLabelSep( $label, $name, $id, $size = false, $value = false, $attribs = array() ) {
+ public static function inputLabelSep( $label, $name, $id, $size = false,
+ $value = false, $attribs = array()
+ ) {
return array(
Xml::label( $label, $id, $attribs ),
self::input( $name, $size, $value, array( 'id' => $id ) + $attribs )
*
* @return string HTML
*/
- public static function radioLabel( $label, $name, $value, $id, $checked = false, $attribs = array() ) {
+ public static function radioLabel( $label, $name, $value, $id,
+ $checked = false, $attribs = array()
+ ) {
return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) .
' ' .
self::label( $label, $id, $attribs );
* Build a drop-down box from a textual list.
*
* @param string $name Name and id for the drop-down
- * @param string $list Correctly formatted text (newline delimited) to be used to generate the options
+ * @param string $list Correctly formatted text (newline delimited) to be
+ * used to generate the options.
* @param string $other Text for the "Other reasons" option
* @param string $selected Option which should be pre-selected
* @param string $class CSS classes for the drop-down
* @param int $tabindex Value of the tabindex attribute
* @return string
*/
- public static function listDropDown( $name = '', $list = '', $other = '', $selected = '', $class = '', $tabindex = null ) {
+ public static function listDropDown( $name = '', $list = '', $other = '',
+ $selected = '', $class = '', $tabindex = null
+ ) {
$optgroup = false;
$options = self::option( $other, 'other', $selected === 'other' );
/**
* Shortcut for creating fieldsets.
*
- * @param string|bool $legend Legend of the fieldset. If evaluates to false, legend is not added.
- * @param string $content Pre-escaped content for the fieldset. If false, only open fieldset is returned.
+ * @param string|bool $legend Legend of the fieldset. If evaluates to false,
+ * legend is not added.
+ * @param string $content Pre-escaped content for the fieldset. If false,
+ * only open fieldset is returned.
* @param array $attribs Any attributes to fieldset-element.
*
* @return string
/**
* Generate a form (without the opening form element).
* Output optionally includes a submit button.
- * @param array $fields Associative array, key is the name of a message that contains a description for the field, value is an HTML string containing the appropriate input.
- * @param string $submitLabel The name of a message containing a label for the submit button.
+ * @param array $fields Associative array, key is the name of a message that
+ * contains a description for the field, value is an HTML string
+ * containing the appropriate input.
+ * @param string $submitLabel The name of a message containing a label for
+ * the submit button.
* @param array $submitAttribs The attributes to add to the submit button
* @return string HTML form.
*/
// the input somehow.
$form .= Xml::tags( 'td', array( 'class' => 'mw-label' ), wfMessage( $labelmsg )->parse() );
- $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) . $input . Xml::closeElement( 'td' );
+ $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) )
+ . $input . Xml::closeElement( 'td' );
$form .= Xml::closeElement( 'tr' );
}
if ( $submitLabel ) {
$form .= Xml::openElement( 'tr' );
$form .= Xml::tags( 'td', array(), '' );
- $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs ) . Xml::closeElement( 'td' );
+ $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) )
+ . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs )
+ . Xml::closeElement( 'td' );
$form .= Xml::closeElement( 'tr' );
}
return $psModule->getParamDescription() + array(
'title' => 'The page to (un)watch. use titles instead',
'unwatch' => 'If set the page will be unwatched rather than watched',
- 'entirewatchlist' => 'Work on all watched pages without returning a list; can only be used together with \'unwatch\' option.',
+ 'entirewatchlist' => 'Work on all watched pages without returning a list; '
+ . 'can only be used together with \'unwatch\' option.',
'uselang' => 'Language to show the message in',
'token' => 'A token previously acquired via prop=info',
);
$dbw->insertSelect( 'filearchive', 'image',
array(
'fa_storage_group' => $encGroup,
- 'fa_storage_key' => $dbw->conditional( array( 'img_sha1' => '' ), $dbw->addQuotes( '' ), $concat ),
+ 'fa_storage_key' => $dbw->conditional(
+ array( 'img_sha1' => '' ),
+ $dbw->addQuotes( '' ),
+ $concat
+ ),
'fa_deleted_user' => $encUserId,
'fa_deleted_timestamp' => $encTimestamp,
'fa_deleted_reason' => $encReason,
$dbw->insertSelect( 'filearchive', 'oldimage',
array(
'fa_storage_group' => $encGroup,
- 'fa_storage_key' => $dbw->conditional( array( 'oi_sha1' => '' ), $dbw->addQuotes( '' ), $concat ),
+ 'fa_storage_key' => $dbw->conditional(
+ array( 'oi_sha1' => '' ),
+ $dbw->addQuotes( '' ),
+ $concat
+ ),
'fa_deleted_user' => $encUserId,
'fa_deleted_timestamp' => $encTimestamp,
'fa_deleted_reason' => $encReason,
array( 'addPgField', 'recentchanges', 'rc_source', "TEXT NOT NULL DEFAULT ''" ),
array( 'addPgField', 'page', 'page_links_updated', "TIMESTAMPTZ NULL" ),
array( 'addPgField', 'mwuser', 'user_password_expires', 'TIMESTAMPTZ NULL' ),
- array( 'changeFieldPurgeTable', 'l10n_cache', 'lc_value', 'bytea', "replace(lc_value,'\','\\\\')::bytea" ),
+ array( 'changeFieldPurgeTable', 'l10n_cache', 'lc_value', 'bytea',
+ "replace(lc_value,'\','\\\\')::bytea" ),
// 1.24
array( 'addPgField', 'page_props', 'pp_sortkey', 'float NULL' ),