* @param string $actiontext Text of the action; in case of log event
* @return string
*/
- public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext = '' ) {
+ public static function formatDiffRow( $title, $oldid, $newid, $timestamp,
+ $comment, $actiontext = ''
+ ) {
global $wgFeedDiffCutoff, $wgLang;
wfProfileIn( __METHOD__ );
'diff' => 'background-color: white; color:black;',
'diff-otitle' => 'background-color: white; color:black; text-align: center;',
'diff-ntitle' => 'background-color: white; color:black; text-align: center;',
- 'diff-addedline' => 'color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;',
- 'diff-deletedline' => 'color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;',
- 'diff-context' => 'background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;',
+ 'diff-addedline' => 'color:black; font-size: 88%; border-style: solid; '
+ . 'border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; '
+ . 'vertical-align: top; white-space: pre-wrap;',
+ 'diff-deletedline' => 'color:black; font-size: 88%; border-style: solid; '
+ . 'border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; '
+ . 'vertical-align: top; white-space: pre-wrap;',
+ 'diff-context' => 'background-color: #f9f9f9; color: #333333; font-size: 88%; '
+ . 'border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; '
+ . 'border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;',
'diffchange' => 'font-weight: bold; text-decoration: none;',
);
$suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed( 'suppressrevision' );
if ( $this->oldimage ) {
- $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage );
+ $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName(
+ $this->title,
+ $this->oldimage
+ );
}
if ( !self::haveDeletableFile( $this->file, $this->oldfile, $this->oldimage ) ) {
$reason = $deleteReasonList;
}
- $status = self::doDelete( $this->title, $this->file, $this->oldimage, $reason, $suppress, $wgUser );
+ $status = self::doDelete(
+ $this->title,
+ $this->file,
+ $this->oldimage,
+ $reason,
+ $suppress,
+ $wgUser
+ );
if ( !$status->isGood() ) {
$wgOut->addHTML( '<h2>' . $this->prepareMessage( 'filedeleteerror-short' ) . "</h2>\n" );
- $wgOut->addWikiText( '<div class="error">' . $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) . '</div>' );
+ $wgOut->addWikiText( '<div class="error">' .
+ $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' )
+ . '</div>' );
}
if ( $status->ok ) {
$wgOut->setPageTitle( wfMessage( 'actioncomplete' ) );
* @throws MWException
* @return bool|Status
*/
- public static function doDelete( &$title, &$file, &$oldimage, $reason, $suppress, User $user = null ) {
+ public static function doDelete( &$title, &$file, &$oldimage, $reason,
+ $suppress, User $user = null
+ ) {
if ( $user === null ) {
global $wgUser;
$user = $wgUser;
}
}
} catch ( MWException $e ) {
- // rollback before returning to prevent UI from displaying incorrect "View or restore N deleted edits?"
+ // Rollback before returning to prevent UI from displaying
+ // incorrect "View or restore N deleted edits?"
$dbw->rollback( __METHOD__ );
throw $e;
}
<tr>
<td></td>
<td class='mw-submit'>" .
- Xml::submitButton( wfMessage( 'filedelete-submit' )->text(),
- array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '4' ) ) .
+ Xml::submitButton(
+ wfMessage( 'filedelete-submit' )->text(),
+ array(
+ 'name' => 'mw-filedelete-submit',
+ 'id' => 'mw-filedelete-submit',
+ 'tabindex' => '4'
+ )
+ ) .
"</td>
</tr>" .
Xml::closeElement( 'table' ) .
private function prepareMessage( $message ) {
global $wgLang;
if ( $this->oldimage ) {
+ # Message keys used:
+ # 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old'
return wfMessage(
- "{$message}-old", # To ensure grep will find them: 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old'
+ "{$message}-old",
wfEscapeWikiText( $this->title->getText() ),
$wgLang->date( $this->getTimestamp(), true ),
$wgLang->time( $this->getTimestamp(), true ),
$readyPipes = $pipes;
// Clear last error
+ // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged
@trigger_error( '' );
if ( @stream_select( $readyPipes, $emptyArray, $emptyArray, null ) === false ) {
+ // @codingStandardsIgnoreEnd
$error = error_get_last();
if ( strncmp( $error['message'], $eintrMessage, strlen( $eintrMessage ) ) == 0 ) {
continue;
$decimal = bcadd( $decimal, $baseChars[$char] );
}
+ // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ( $result = ''; bccomp( $decimal, 0 ); $decimal = bcdiv( $decimal, $destBase, 0 ) ) {
$result .= $baseChars[bcmod( $decimal, $destBase )];
}
+ // @codingStandardsIgnoreEnd
$result = strrev( $result );
} else {
/**
* @since 1.18
*/
-class MWHookException extends MWException {}
+class MWHookException extends MWException {
+}
/**
* Hooks class.
* @since 1.18
*/
class Hooks {
-
/**
* Array of events mapped to an array of callbacks to be run
* when that event is triggered.
*
* @param array $params Params to set.
* - selected: [optional] Id of namespace which should be pre-selected
- * - all: [optional] Value of item for "all namespaces". If null or unset, no "<option>" is generated to select all namespaces
- * - label: text for label to add before the field
- * - exclude: [optional] Array of namespace ids to exclude
- * - disable: [optional] Array of namespace ids for which the option should be disabled in the selector
+ * - all: [optional] Value of item for "all namespaces". If null or unset,
+ * no "<option>" is generated to select all namespaces.
+ * - label: text for label to add before the field.
+ * - exclude: [optional] Array of namespace ids to exclude.
+ * - disable: [optional] Array of namespace ids for which the option should
+ * be disabled in the selector.
* @param array $selectAttribs HTML attributes for the generated select element.
- * - id: [optional], default: 'namespace'
- * - name: [optional], default: 'namespace'
+ * - id: [optional], default: 'namespace'.
+ * - name: [optional], default: 'namespace'.
* @return string HTML code to select a namespace.
*/
- public static function namespaceSelector( array $params = array(), array $selectAttribs = array() ) {
+ public static function namespaceSelector( array $params = array(),
+ array $selectAttribs = array()
+ ) {
global $wgContLang;
ksort( $selectAttribs );
* specify the $element in the method it'll change the underlying dom and you won't be able to get
* it back.
*
- * @param DOMElement|string|null $element ID of element to get HTML from or false to get it from the whole tree
+ * @param DOMElement|string|null $element ID of element to get HTML from or
+ * false to get it from the whole tree
* @return string Processed HTML
*/
public function getText( $element = null ) {
# $res might contain the whole 1,000 rows, so we read up to
# $num [should update this to use a Pager]
+ // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
+ // @codingStandardsIgnoreEnd
$namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
$title = Title::makeTitleSafe( $namespace, $row->title );
if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
}
// Gotta override this since it's abstract
- function formatResult( $skin, $result ) { }
+ function formatResult( $skin, $result ) {
+ }
/**
* Get additional HTML to be shown in a results' cell
* deprecated.
*/
class MWInit {
- static $compilerVersion;
+ private static $compilerVersion;
/**
* @deprecated since 1.22
* A License class for use on Special:Upload
*/
class Licenses extends HTMLFormField {
- /**
- * @var string
- */
+ /** @var string */
protected $msg;
- /**
- * @var array
- */
+ /** @var array */
protected $licenses = array();
- /**
- * @var string
- */
+ /** @var string */
protected $html;
/**#@-*/
/**
- * Constructor
- *
* @param array $params
*/
public function __construct( $params ) {
parent::__construct( $params );
- $this->msg = empty( $params['licenses'] ) ? wfMessage( 'licenses' )->inContentLanguage()->plain() : $params['licenses'];
+ $this->msg = empty( $params['licenses'] )
+ ? wfMessage( 'licenses' )->inContentLanguage()->plain()
+ : $params['licenses'];
$this->selected = null;
$this->makeLicenses();
* A License class for use on Special:Upload (represents a single type of license).
*/
class License {
- /**
- * @var string
- */
- var $template;
+ /** @var string */
+ public $template;
- /**
- * @var string
- */
- var $text;
+ /** @var string */
+ public $text;
/**
- * Constructor
- *
* @param string $str license name??
*/
function __construct( $str ) {
* @return string Wikitext parsed into HTML.
*/
protected function parseText( $string ) {
- $out = MessageCache::singleton()->parse( $string, $this->title, /*linestart*/true, $this->interface, $this->language );
+ $out = MessageCache::singleton()->parse(
+ $string,
+ $this->title,
+ /*linestart*/true,
+ $this->interface,
+ $this->language
+ );
+
return $out instanceof ParserOutput ? $out->getText() : $out;
}
* @return string Wikitext with {{-constructs replaced with their values.
*/
protected function transformText( $string ) {
- return MessageCache::singleton()->transform( $string, $this->interface, $this->language, $this->title );
+ return MessageCache::singleton()->transform(
+ $string,
+ $this->interface,
+ $this->language,
+ $this->title
+ );
}
/**