* @file
*/
class Block {
- /* public*/ var $mReason, $mTimestamp, $mAuto, $mExpiry, $mHideName;
+ /** @var string */
+ public $mReason;
- protected
- $mId,
- $mFromMaster,
+ /** @var bool|string */
+ public $mTimestamp;
- $mBlockEmail,
- $mDisableUsertalk,
- $mCreateAccount,
- $mParentBlockId;
+ /** @var int */
+ public $mAuto;
+
+ /** @var bool|string */
+ public $mExpiry;
+
+ public $mHideName;
+
+ /** @var int */
+ public $mParentBlockId;
+
+ /** @var int */
+ protected $mId;
+
+ /** @var bool */
+ protected $mFromMaster;
+
+ /** @var bool */
+ protected $mBlockEmail;
+
+ /** @var bool */
+ protected $mDisableUsertalk;
+
+ /** @var bool */
+ protected $mCreateAccount;
/** @var User|string */
protected $target;
const TYPE_ID = 5;
/**
- * Constructor
- * @todo FIXME: Don't know what the best format to have for this constructor is, but fourteen
- * optional parameters certainly isn't it.
+ * @todo FIXME: Don't know what the best format to have for this constructor
+ * is, but fourteen optional parameters certainly isn't it.
*/
function __construct( $address = '', $user = 0, $by = 0, $reason = '',
$timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
*
*/
class Categoryfinder {
- var $articles = array(); # The original article IDs passed to the seed function
- var $deadend = array(); # Array of DBKEY category names for categories that don't have a page
- var $parents = array(); # Array of [ID => array()]
- var $next = array(); # Array of article/category IDs
- var $targets = array(); # Array of DBKEY category names
- var $name2id = array();
- var $mode; # "AND" or "OR"
+ /** @var int[] The original article IDs passed to the seed function */
+ protected $articles = array();
- /**
- * @var DatabaseBase
- */
- var $dbr; # Read-DB slave
+ /** @var array Array of DBKEY category names for categories that don't have a page */
+ protected $deadend = array();
+
+ /** @var array Array of [ID => array()] */
+ protected $parents = array();
+
+ /** @var array Array of article/category IDs */
+ protected $next = array();
+
+ /** @var array Array of DBKEY category names */
+ protected $targets = array();
+
+ /** @var array */
+ protected $name2id = array();
+
+ /** @var "AND" or "OR" */
+ protected $mode;
+
+ /** @var DatabaseBase Read-DB slave */
+ protected $dbr;
- /**
- * Constructor (currently empty).
- */
function __construct() {
}
*/
abstract class Collation {
- static $instance;
+ private static $instance;
/**
* @return Collation
}
class UppercaseCollation extends Collation {
- var $lang;
+ private $lang;
+
function __construct() {
// Get a language object so that we can use the generic UTF-8 uppercase
// function there
class IcuCollation extends Collation {
const FIRST_LETTER_VERSION = 2;
- var $primaryCollator, $mainCollator, $locale, $digitTransformLanguage;
- var $firstLetterData;
+ /** @var Collator */
+ private $primaryCollator;
+
+ /** @var Collator */
+ private $mainCollator;
+
+ /** @var */
+ private $locale;
+
+ /** @var Language */
+ protected $digitTransformLanguage;
+
+ /** @var array */
+ private $firstLetterData;
/**
* Unified CJK blocks.
* is pretty useless for sorting Chinese text anyway. Japanese and Korean
* blocks are not included here, because they are smaller and more useful.
*/
- static $cjkBlocks = array(
+ private static $cjkBlocks = array(
array( 0x2E80, 0x2EFF ), // CJK Radicals Supplement
array( 0x2F00, 0x2FDF ), // Kangxi Radicals
array( 0x2FF0, 0x2FFF ), // Ideographic Description Characters
* Empty arrays are intended; this signifies that the data for the language is
* available and that there are, in fact, no additional letters to consider.
*/
- static $tailoringFirstLetters = array(
+ private static $tailoringFirstLetters = array(
// Verified by native speakers
'be' => array( "Ё" ),
'be-tarask' => array( "Ё" ),
* @ingroup Media
*/
class ImagePage extends Article {
-
- /**
- * @var File
- */
+ /** @var File */
private $displayImg;
- /**
- * @var FileRepo
- */
+
+ /** @var FileRepo */
private $repo;
+
+ /** @var bool */
private $fileLoaded;
- var $mExtraDescription = false;
+ /** @var bool */
+ protected $mExtraDescription = false;
/**
* @param Title $title
$out = $this->getContext()->getOutput();
$request = $this->getContext()->getRequest();
$diff = $request->getVal( 'diff' );
- $diffOnly = $request->getBool( 'diffonly', $this->getContext()->getUser()->getOption( 'diffonly' ) );
+ $diffOnly = $request->getBool(
+ 'diffonly',
+ $this->getContext()->getUser()->getOption( 'diffonly' )
+ );
if ( $this->getTitle()->getNamespace() != NS_FILE || ( $diff !== null && $diffOnly ) ) {
parent::view();
// mTitle is not the same as the redirect target so it is
// probably the redirect page itself. Fake the redirect symbol
$out->setPageTitle( $this->getTitle()->getPrefixedText() );
- $out->addHTML( $this->viewRedirect( Title::makeTitle( NS_FILE, $this->mPage->getFile()->getName() ),
- /* $appendSubtitle */ true, /* $forceKnown */ true ) );
+ $out->addHTML( $this->viewRedirect(
+ Title::makeTitle( NS_FILE, $this->mPage->getFile()->getName() ),
+ /* $appendSubtitle */ true,
+ /* $forceKnown */ true )
+ );
$this->mPage->doViewUpdates( $this->getContext()->getUser(), $this->getOldID() );
return;
}
# image
# "Download high res version" link below the image
- # $msgsize = wfMessage( 'file-info-size', $width_orig, $height_orig, Linker::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
+ # $msgsize = wfMessage( 'file-info-size', $width_orig, $height_orig,
+ # Linker::formatSize( $this->displayImg->getSize() ), $mime )->escaped();
# We'll show a thumbnail of this image
if ( $width > $maxWidth || $height > $maxHeight ) {
# Calculate the thumbnail size.
# First case, the limiting factor is the width, not the height.
- if ( $width / $height >= $maxWidth / $maxHeight ) { // FIXME: Possible division by 0. bug 36911
- $height = round( $height * $maxWidth / $width ); // FIXME: Possible division by 0. bug 36911
+ /** @todo // FIXME: Possible division by 0. bug 36911 */
+ if ( $width / $height >= $maxWidth / $maxHeight ) {
+ /** @todo // FIXME: Possible division by 0. bug 36911 */
+ $height = round( $height * $maxWidth / $width );
$width = $maxWidth;
# Note that $height <= $maxHeight now.
} else {
- $newwidth = floor( $width * $maxHeight / $height ); // FIXME: Possible division by 0. bug 36911
- $height = round( $height * $newwidth / $width ); // FIXME: Possible division by 0. bug 36911
+ /** @todo // FIXME: Possible division by 0. bug 36911 */
+ $newwidth = floor( $width * $maxHeight / $height );
+ /** @todo // FIXME: Possible division by 0. bug 36911 */
+ $height = round( $height * $newwidth / $width );
$width = $newwidth;
# Note that $height <= $maxHeight now, but might not be identical
# because of rounding.
$thumbnail = $this->displayImg->transform( $params );
Linker::processResponsiveImages( $this->displayImg, $thumbnail, $params );
- $anchorclose = Html::rawElement( 'div', array( 'class' => 'mw-filepage-resolutioninfo' ), $msgsmall );
+ $anchorclose = Html::rawElement(
+ 'div',
+ array( 'class' => 'mw-filepage-resolutioninfo' ),
+ $msgsmall
+ );
$isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
if ( $isMulti ) {
array(),
array( 'page' => $page - 1 )
);
- $thumb1 = Linker::makeThumbLinkObj( $this->getTitle(), $this->displayImg, $link, $label, 'none',
- array( 'page' => $page - 1 ) );
+ $thumb1 = Linker::makeThumbLinkObj(
+ $this->getTitle(),
+ $this->displayImg,
+ $link,
+ $label,
+ 'none',
+ array( 'page' => $page - 1 )
+ );
} else {
$thumb1 = '';
}
array(),
array( 'page' => $page + 1 )
);
- $thumb2 = Linker::makeThumbLinkObj( $this->getTitle(), $this->displayImg, $link, $label, 'none',
- array( 'page' => $page + 1 ) );
+ $thumb2 = Linker::makeThumbLinkObj(
+ $this->getTitle(),
+ $this->displayImg,
+ $link,
+ $label,
+ 'none',
+ array( 'page' => $page + 1 )
+ );
} else {
$thumb2 = '';
}
// The dirmark, however, must not be immediately adjacent
// to the filename, because it can get copied with it.
// See bug 25277.
+ // @codingStandardsIgnoreStart Ignore long line
$out->addWikiText( <<<EOT
<div class="fullMedia"><span class="dangerousLink">{$medialink}</span> $dirmark<span class="fileInfo">$longDesc</span></div>
<div class="mediaWarning">$warning</div>
EOT
- );
+ );
+ // @codingStandardsIgnoreEnd
} else {
$out->addWikiText( <<<EOT
<div class="fullMedia">{$medialink} {$dirmark}<span class="fileInfo">$longDesc</span>
# "Upload a new version of this file" link
$canUpload = $this->getTitle()->userCan( 'upload', $this->getContext()->getUser() );
- if ( $canUpload && UploadBase::userCanReUpload( $this->getContext()->getUser(), $this->mPage->getFile()->name ) ) {
- $ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMessage( 'uploadnewversion-linktext' )->text() );
- $out->addHTML( "<li id=\"mw-imagepage-reupload-link\"><div class=\"plainlinks\">{$ulink}</div></li>\n" );
+ if ( $canUpload && UploadBase::userCanReUpload(
+ $this->getContext()->getUser(),
+ $this->mPage->getFile()->name )
+ ) {
+ $ulink = Linker::makeExternalLink(
+ $this->getUploadUrl(),
+ wfMessage( 'uploadnewversion-linktext' )->text()
+ );
+ $out->addHTML( "<li id=\"mw-imagepage-reupload-link\">"
+ . "<div class=\"plainlinks\">{$ulink}</div></li>\n" );
} else {
- $out->addHTML( "<li id=\"mw-imagepage-upload-disallowed\">" . $this->getContext()->msg( 'upload-disallowed-here' )->escaped() . "</li>\n" );
+ $out->addHTML( "<li id=\"mw-imagepage-upload-disallowed\">"
+ . $this->getContext()->msg( 'upload-disallowed-here' )->escaped() . "</li>\n" );
}
$out->addHTML( "</ul>\n" );
}
- protected function closeShowImage() { } # For overloading
+ /**
+ * For overloading
+ */
+ protected function closeShowImage() {
+ }
/**
* If the page we've just displayed is in the "Image" namespace,
if ( !$haveDefaultLang ) {
// Its hard to know if the content is really in the default language, or
// if its just unmarked content that could be in any language.
- $opts = Xml::option( wfMessage( 'img-lang-default' )->text(), $defaultLang, $defaultLang === $curLang ) . $opts;
+ $opts = Xml::option(
+ wfMessage( 'img-lang-default' )->text(),
+ $defaultLang,
+ $defaultLang === $curLang
+ ) . $opts;
}
if ( !$haveCurrentLang && $defaultLang !== $curLang ) {
$name = Language::fetchLanguageName( $curLang, $this->getContext()->getLanguage()->getCode() );
$opts = Xml::option( $display, $curLang, true ) . $opts;
}
- $select = Html::rawElement( 'select', array( 'id' => 'mw-imglangselector', 'name' => 'lang' ), $opts );
+ $select = Html::rawElement(
+ 'select',
+ array( 'id' => 'mw-imglangselector', 'name' => 'lang' ),
+ $opts
+ );
$submit = Xml::submitButton( wfMessage( 'img-lang-go' )->text() );
$formContents = wfMessage( 'img-lang-info' )->rawParams( $select, $submit )->parse()
* @return string
*/
public function beginImageHistoryList( $navLinks = '' ) {
- return Xml::element( 'h2', array( 'id' => 'filehistory' ), $this->msg( 'filehist' )->text() ) . "\n"
+ return Xml::element( 'h2', array( 'id' => 'filehistory' ), $this->msg( 'filehist' )->text() )
+ . "\n"
. "<div id=\"mw-imagepage-section-filehistory\">\n"
. $this->msg( 'filehist-help' )->parseAsBlock()
. $navLinks . "\n"
. Xml::openElement( 'table', array( 'class' => 'wikitable filehistory' ) ) . "\n"
. '<tr><td></td>'
- . ( $this->current->isLocal() && ( $this->getUser()->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '<td></td>' : '' )
+ . ( $this->current->isLocal()
+ && ( $this->getUser()->isAllowedAny( 'delete', 'deletedhistory' ) ) ? '<td></td>' : '' )
. '<th>' . $this->msg( 'filehist-datetime' )->escaped() . '</th>'
. ( $this->showThumb ? '<th>' . $this->msg( 'filehist-thumb' )->escaped() . '</th>' : '' )
. '<th>' . $this->msg( 'filehist-dimensions' )->escaped() . '</th>'
$row .= "<td $selected style='white-space: nowrap;'>";
if ( !$file->userCan( File::DELETED_FILE, $user ) ) {
# Don't link to unviewable files
- $row .= '<span class="history-deleted">' . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
+ $row .= '<span class="history-deleted">'
+ . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
} elseif ( $file->isDeleted( File::DELETED_FILE ) ) {
if ( $local ) {
$this->preventClickjacking();
$row .= '<span class="history-deleted">' . $url . '</span>';
} else {
$url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
- $row .= Xml::element( 'a', array( 'href' => $url ), $lang->userTimeAndDate( $timestamp, $user ) );
+ $row .= Xml::element(
+ 'a',
+ array( 'href' => $url ),
+ $lang->userTimeAndDate( $timestamp, $user )
+ );
}
$row .= "</td>";
$row .= '<td>';
// Hide deleted usernames
if ( $file->isDeleted( File::DELETED_USER ) ) {
- $row .= '<span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
+ $row .= '<span class="history-deleted">'
+ . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
if ( $local ) {
$row .= Linker::userLink( $userId, $userText );
// Don't show deleted descriptions
if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
- $row .= '<td><span class="history-deleted">' . $this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>';
+ $row .= '<td><span class="history-deleted">' .
+ $this->msg( 'rev-deleted-comment' )->escaped() . '</span></td>';
} else {
- $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::formatComment( $description, $this->title ) . '</td>';
+ $row .= '<td dir="' . $wgContLang->getDir() . '">' .
+ Linker::formatComment( $description, $this->title ) . '</td>';
}
$rowClass = null;
$da = array();
$strtime = '';
- if ( !$ts || $ts === "\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ) { // We want to catch 0, '', null... but not date strings starting with a letter.
+ // We want to catch 0, '', null... but not date strings starting with a letter.
+ if ( !$ts || $ts === "\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ) {
$uts = time();
$strtime = "@$uts";
} elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D', $ts, $da ) ) {
# TS_ORACLE // session altered to DD-MM-YYYY HH24:MI:SS.FF6
$strtime = preg_replace( '/(\d\d)\.(\d\d)\.(\d\d)(\.(\d+))?/', "$1:$2:$3",
str_replace( '+00:00', 'UTC', $ts ) );
- } elseif ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.*\d*)?Z?$/', $ts, $da ) ) {
+ } elseif ( preg_match(
+ '/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.*\d*)?Z?$/',
+ $ts,
+ $da
+ ) ) {
# TS_ISO_8601
- } elseif ( preg_match( '/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(?:\.*\d*)?Z?$/', $ts, $da ) ) {
+ } elseif ( preg_match(
+ '/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(?:\.*\d*)?Z?$/',
+ $ts,
+ $da
+ ) ) {
#TS_ISO_8601_BASIC
- } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d*[\+\- ](\d\d)$/', $ts, $da ) ) {
+ } elseif ( preg_match(
+ '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d*[\+\- ](\d\d)$/',
+ $ts,
+ $da
+ ) ) {
# TS_POSTGRES
- } elseif ( preg_match( '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/', $ts, $da ) ) {
+ } elseif ( preg_match(
+ '/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)\.*\d* GMT$/',
+ $ts,
+ $da
+ ) ) {
# TS_POSTGRES
- } elseif ( preg_match( '/^[ \t\r\n]*([A-Z][a-z]{2},[ \t\r\n]*)?' . # Day of week
- '\d\d?[ \t\r\n]*[A-Z][a-z]{2}[ \t\r\n]*\d{2}(?:\d{2})?' . # dd Mon yyyy
- '[ \t\r\n]*\d\d[ \t\r\n]*:[ \t\r\n]*\d\d[ \t\r\n]*:[ \t\r\n]*\d\d/S', $ts ) ) { # hh:mm:ss
- # TS_RFC2822, accepting a trailing comment. See http://www.squid-cache.org/mail-archive/squid-users/200307/0122.html / r77171
+ } elseif ( preg_match(
+ # Day of week
+ '/^[ \t\r\n]*([A-Z][a-z]{2},[ \t\r\n]*)?' .
+ # dd Mon yyyy
+ '\d\d?[ \t\r\n]*[A-Z][a-z]{2}[ \t\r\n]*\d{2}(?:\d{2})?' .
+ # hh:mm:ss
+ '[ \t\r\n]*\d\d[ \t\r\n]*:[ \t\r\n]*\d\d[ \t\r\n]*:[ \t\r\n]*\d\d/S',
+ $ts
+ ) ) {
+ # TS_RFC2822, accepting a trailing comment.
+ # See http://www.squid-cache.org/mail-archive/squid-users/200307/0122.html / r77171
# The regex is a superset of rfc2822 for readability
$strtime = strtok( $ts, ';' );
} elseif ( preg_match( '/^[A-Z][a-z]{5,8}, \d\d-[A-Z][a-z]{2}-\d{2} \d\d:\d\d:\d\d/', $ts ) ) {
* @since 1.20
* @since 1.22 Uses Language::getHumanTimestamp to produce the timestamp
*
- * @param MWTimestamp|null $relativeTo The base timestamp to compare to (defaults to now)
- * @param User|null $user User the timestamp is being generated for (or null to use main context's user)
- * @param Language|null $lang Language to use to make the human timestamp (or null to use main context's language)
+ * @param MWTimestamp|null $relativeTo The base timestamp to compare to
+ * (defaults to now).
+ * @param User|null $user User the timestamp is being generated for (or null
+ * to use main context's user).
+ * @param Language|null $lang Language to use to make the human timestamp
+ * (or null to use main context's language).
* @return string Formatted timestamp
*/
- public function getHumanTimestamp( MWTimestamp $relativeTo = null, User $user = null, Language $lang = null ) {
+ public function getHumanTimestamp( MWTimestamp $relativeTo = null,
+ User $user = null, Language $lang = null
+ ) {
if ( $relativeTo === null ) {
$relativeTo = new self();
}
$ts = '';
$diff = $this->diff( $relativeTo );
- if ( wfRunHooks( 'GetRelativeTimestamp', array( &$ts, &$diff, $this, $relativeTo, $user, $lang ) ) ) {
+ if ( wfRunHooks(
+ 'GetRelativeTimestamp',
+ array( &$ts, &$diff, $this, $relativeTo, $user, $lang )
+ ) ) {
$seconds = ( ( ( $diff->days * 24 + $diff->h ) * 60 + $diff->i ) * 60 + $diff->s );
$ts = wfMessage( 'ago', $lang->formatDuration( $seconds, $chosenIntervals ) )
- ->inLanguage( $lang )
- ->text();
+ ->inLanguage( $lang )->text();
}
return $ts;
*
* @since 1.22
* @param MWTimestamp $relativeTo Base time to calculate difference from
- * @return DateInterval|bool The DateInterval object representing the difference between the two dates or false on failure
+ * @return DateInterval|bool The DateInterval object representing the
+ * difference between the two dates or false on failure
*/
public function diff( MWTimestamp $relativeTo ) {
return $this->timestamp->diff( $relativeTo->timestamp );
* @ingroup Parser
*/
class MagicWord {
- /**#@+
- * @private
- */
- var $mId, $mSynonyms, $mCaseSensitive;
- var $mRegex = '';
- var $mRegexStart = '';
- var $mRegexStartToEnd = '';
- var $mBaseRegex = '';
- var $mVariableRegex = '';
- var $mVariableStartToEndRegex = '';
- var $mModified = false;
- var $mFound = false;
+ /**#@-*/
+
+ /** @var int */
+ public $mId;
+
+ /** @var array */
+ public $mSynonyms;
+
+ /** @var bool */
+ public $mCaseSensitive;
+
+ /** @var string */
+ private $mRegex = '';
+
+ /** @var string */
+ private $mRegexStart = '';
+
+ /** @var string */
+ private $mRegexStartToEnd = '';
+
+ /** @var string */
+ private $mBaseRegex = '';
+
+ /** @var string */
+ private $mVariableRegex = '';
+
+ /** @var string */
+ private $mVariableStartToEndRegex = '';
+
+ /** @var bool */
+ private $mModified = false;
+
+ /** @var bool */
+ private $mFound = false;
static public $mVariableIDsInitialised = false;
static public $mVariableIDs = array(
*/
function matchAndRemove( &$text ) {
$this->mFound = false;
- $text = preg_replace_callback( $this->getRegex(), array( &$this, 'pregRemoveAndRecord' ), $text );
+ $text = preg_replace_callback(
+ $this->getRegex(),
+ array( &$this, 'pregRemoveAndRecord' ),
+ $text
+ );
+
return $this->mFound;
}
*/
function matchStartAndRemove( &$text ) {
$this->mFound = false;
- $text = preg_replace_callback( $this->getRegexStart(), array( &$this, 'pregRemoveAndRecord' ), $text );
+ $text = preg_replace_callback(
+ $this->getRegexStart(),
+ array( &$this, 'pregRemoveAndRecord' ),
+ $text
+ );
+
return $this->mFound;
}
* @return string
*/
function replace( $replacement, $subject, $limit = -1 ) {
- $res = preg_replace( $this->getRegex(), StringUtils::escapeRegexReplacement( $replacement ), $subject, $limit );
+ $res = preg_replace(
+ $this->getRegex(),
+ StringUtils::escapeRegexReplacement( $replacement ),
+ $subject,
+ $limit
+ );
$this->mModified = $res !== $subject;
return $res;
}
* @ingroup Parser
*/
class MagicWordArray {
- var $names = array();
- var $hash;
- var $baseRegex, $regex;
- var $matches;
+ /** @var array */
+ public $names = array();
+
+ /** @var array */
+ private $hash;
+
+ private $baseRegex;
+
+ private $regex;
+
+ /** @todo Unused? */
+ private $matches;
/**
* @param array $names
* of MimeMagic. Please use MimeMagic::singleton() to get that instance.
*/
class MimeMagic {
-
/**
- * Mapping of media types to arrays of mime types.
+ * @var array Mapping of media types to arrays of mime types.
* This is used by findMediaType and getMediaType, respectively
*/
- var $mMediaTypes = null;
+ protected $mMediaTypes = null;
- /** Map of mime type aliases
+ /** @var array Map of mime type aliases
*/
- var $mMimeTypeAliases = null;
+ protected $mMimeTypeAliases = null;
- /** map of mime types to file extensions (as a space separated list)
+ /** @var array Map of mime types to file extensions (as a space separated list)
*/
- var $mMimeToExt = null;
+ protected $mMimeToExt = null;
- /** map of file extensions types to mime types (as a space separated list)
+ /** @var array Map of file extensions types to mime types (as a space separated list)
*/
- var $mExtToMime = null;
+ public $mExtToMime = null;
- /** IEContentAnalyzer instance
+ /** @var IEContentAnalyzer
*/
- var $mIEAnalyzer;
+ protected $mIEAnalyzer;
- /** The singleton instance
+ /** @var MimeMagic The singleton instance
*/
private static $instance = null;
if ( count( $m ) > 1 ) {
$main = $m[0];
- for ( $i = 1; $i < count( $m ); $i += 1 ) {
+ $mCount = count( $m );
+ for ( $i = 1; $i < $mCount; $i += 1 ) {
$mime = $m[$i];
$this->mMimeTypeAliases[$mime] = $main;
}
}
}
-
}
/**
private function detectMimeType( $file, $ext = true ) {
global $wgMimeDetectorCommand;
- if ( $ext ) { # TODO: make $ext default to false. Or better, remove it.
- wfDebug( __METHOD__ . ": WARNING: use of the \$ext parameter is deprecated. Use improveTypeFromExtension(\$mime, \$ext) instead.\n" );
+ /** @todo Make $ext default to false. Or better, remove it. */
+ if ( $ext ) {
+ wfDebug( __METHOD__ . ": WARNING: use of the \$ext parameter is deprecated. "
+ . "Use improveTypeFromExtension(\$mime, \$ext) instead.\n" );
}
$m = null;
} elseif ( function_exists( "mime_content_type" ) ) {
# NOTE: this function is available since PHP 4.3.0, but only if
- # PHP was compiled with --with-mime-magic or, before 4.3.2, with --enable-mime-magic.
+ # PHP was compiled with --with-mime-magic or, before 4.3.2, with
+ # --enable-mime-magic.
#
- # On Windows, you must set mime_magic.magicfile in php.ini to point to the mime.magic file bundled with PHP;
- # sometimes, this may even be needed under linus/unix.
+ # On Windows, you must set mime_magic.magicfile in php.ini to point
+ # to the mime.magic file bundled with PHP; sometimes, this may even
+ # be needed under *nix.
#
- # Also note that this has been DEPRECATED in favor of the fileinfo extension by PECL, see above.
- # see http://www.php.net/manual/en/ref.mime-magic.php for details.
+ # Also note that this has been DEPRECATED in favor of the fileinfo
+ # extension by PECL, see above.
+ # See http://www.php.net/manual/en/ref.mime-magic.php for details.
$m = mime_content_type( $file );
} else {
}
if ( $ext ) {
if ( $this->isRecognizableExtension( $ext ) ) {
- wfDebug( __METHOD__ . ": refusing to guess mime type for .$ext file, we should have recognized it\n" );
+ wfDebug( __METHOD__ . ": refusing to guess mime type for .$ext file, "
+ . "we should have recognized it\n" );
} else {
$m = $this->guessTypesForExtension( $ext );
if ( $m ) {
* Handles the page protection UI and backend
*/
class ProtectionForm {
- /** A map of action to restriction level, from request or default */
- var $mRestrictions = array();
+ /** @var array A map of action to restriction level, from request or default */
+ protected $mRestrictions = array();
- /** The custom/additional protection reason */
- var $mReason = '';
+ /** @var string The custom/additional protection reason */
+ protected $mReason = '';
- /** The reason selected from the list, blank for other/additional */
- var $mReasonSelection = '';
+ /** @var string The reason selected from the list, blank for other/additional */
+ protected $mReasonSelection = '';
- /** True if the restrictions are cascading, from request or existing protection */
- var $mCascade = false;
+ /** @var bool True if the restrictions are cascading, from request or existing protection */
+ protected $mCascade = false;
- /** Map of action to "other" expiry time. Used in preference to mExpirySelection. */
- var $mExpiry = array();
+ /** @var array Map of action to "other" expiry time. Used in preference to mExpirySelection. */
+ protected $mExpiry = array();
/**
- * Map of action to value selected in expiry drop-down list.
+ * @var array Map of action to value selected in expiry drop-down list.
* Will be set to 'othertime' whenever mExpiry is set.
*/
- var $mExpirySelection = array();
+ protected $mExpirySelection = array();
- /** Permissions errors for the protect action */
- var $mPermErrors = array();
+ /** @var array Permissions errors for the protect action */
+ protected $mPermErrors = array();
- /** Types (i.e. actions) for which levels can be selected */
- var $mApplicableTypes = array();
+ /** @var array Types (i.e. actions) for which levels can be selected */
+ protected $mApplicableTypes = array();
- /** Map of action to the expiry time of the existing protection */
- var $mExistingExpiry = array();
+ /** @var array Map of action to the expiry time of the existing protection */
+ protected $mExistingExpiry = array();
function __construct( Page $article ) {
global $wgUser;
if ( $this->mTitle->getRestrictionTypes() === array() ) {
// No restriction types available for the current title
// this might happen if an extension alters the available types
- $wgOut->setPageTitle( wfMessage( 'protect-norestrictiontypes-title', $this->mTitle->getPrefixedText() ) );
+ $wgOut->setPageTitle( wfMessage(
+ 'protect-norestrictiontypes-title',
+ $this->mTitle->getPrefixedText()
+ ) );
$wgOut->addWikiText( wfMessage( 'protect-norestrictiontypes-text' )->text() );
// Show the log in case protection was possible once
$titles .= '* [[:' . $title->getPrefixedText() . "]]\n";
}
- $wgOut->wrapWikiMsg( "<div id=\"mw-protect-cascadeon\">\n$1\n" . $titles . "</div>", array( 'protect-cascadeon', count( $cascadeSources ) ) );
+ /** @todo FIXME: i18n issue, should use formatted number. */
+ $wgOut->wrapWikiMsg(
+ "<div id=\"mw-protect-cascadeon\">\n$1\n" . $titles . "</div>",
+ array( 'protect-cascadeon', count( $cascadeSources ) )
+ );
}
# Show an appropriate message if the user isn't allowed or able to change
# the protection settings at this time
if ( $this->disabled ) {
- $wgOut->setPageTitle( wfMessage( 'protect-title-notallowed', $this->mTitle->getPrefixedText() ) );
+ $wgOut->setPageTitle(
+ wfMessage( 'protect-title-notallowed',
+ $this->mTitle->getPrefixedText() )
+ );
$wgOut->addWikiText( $wgOut->formatPermissionsErrorMessage( $this->mPermErrors, 'protect' ) );
} else {
$wgOut->setPageTitle( wfMessage( 'protect-title', $this->mTitle->getPrefixedText() ) );
$this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' );
- $status = $this->mArticle->doUpdateRestrictions( $this->mRestrictions, $expiry, $this->mCascade, $reasonstr, $wgUser );
+ $status = $this->mArticle->doUpdateRestrictions(
+ $this->mRestrictions,
+ $expiry,
+ $this->mCascade,
+ $reasonstr,
+ $wgUser
+ );
if ( !$status->isOK() ) {
$this->show( $wgOut->parseInline( $status->getWikiText() ) );
}
$show = htmlspecialchars( $show );
$value = htmlspecialchars( $value );
- $expiryFormOptions .= Xml::option( $show, $value, $this->mExpirySelection[$action] === $value ) . "\n";
+ $expiryFormOptions .= Xml::option(
+ $show,
+ $value,
+ $this->mExpirySelection[$action] === $value
+ ) . "\n";
}
# Add expiry dropdown
if ( $showProtectOptions && !$this->disabled ) {
}
if ( !$this->disabled ) {
- $out .= Html::hidden( 'wpEditToken', $wgUser->getEditToken( array( 'protect', $this->mTitle->getPrefixedDBkey() ) ) );
+ $out .= Html::hidden(
+ 'wpEditToken',
+ $wgUser->getEditToken( array( 'protect', $this->mTitle->getPrefixedDBkey() ) )
+ );
$out .= Xml::closeElement( 'form' );
$wgOut->addScript( $this->buildCleanupScript() );
}
* @ingroup SpecialPage
*/
abstract class QueryPage extends SpecialPage {
- /**
- * Whether or not we want plain listoutput rather than an ordered list
- *
- * @var bool
- */
- var $listoutput = false;
+ /** @var bool Whether or not we want plain listoutput rather than an ordered list */
+ protected $listoutput = false;
- /**
- * The offset and limit in use, as passed to the query() function
- *
- * @var int
- */
- var $offset = 0;
- var $limit = 0;
+ /** @var int The offset and limit in use, as passed to the query() function */
+ protected $offset = 0;
+
+ /** @var int */
+ protected $limit = 0;
/**
* The number of rows returned by the query. Reading this variable
list( $this->limit, $this->offset ) = $this->getRequest()->getLimitOffset();
}
- // TODO: Use doQuery()
+ // @todo Use doQuery()
if ( !$this->isCached() ) {
# select one extra row for navigation
$res = $this->reallyDoQuery( $this->limit + 1, $this->offset );
* @param OutputPage $out OutputPage to print to
* @param Skin $skin User skin to use
* @param DatabaseBase $dbr Database (read) connection to use
- * @param int $res Result pointer
+ * @param ResultWrapper $res Result pointer
* @param int $num Number of available result rows
* @param int $offset Paging offset
*/
# $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 = $res->fetchObject(); $i++ ) {
+ // @codingStandardsIgnoreEnd
$line = $this->formatResult( $skin, $row );
if ( $line ) {
$attr = ( isset( $row->usepatrol ) && $row->usepatrol && $row->patrolled == 0 )
* @param DatabaseBase $db
* @param ResultWrapper $res
*/
- function preprocessResults( $db, $res ) {}
+ function preprocessResults( $db, $res ) {
+ }
/**
* Similar to above, but packaging in a syndicated feed instead of a web page
$limit = min( $limit, $wgFeedLimit );
if ( isset( $wgFeedClasses[$class] ) ) {
+ /** @var RSSFeed|AtomFeed $feed */
$feed = new $wgFeedClasses[$class](
$this->feedTitle(),
$this->feedDesc(),
* List for revision table items for a single page
*/
abstract class RevisionListBase extends ContextSource {
- /**
- * @var Title
- */
- var $title;
+ /** @var Title */
+ public $title;
+
+ /** @var array */
+ protected $ids;
- var $ids, $res, $current;
+ protected $res;
+
+ /** @var bool|object */
+ protected $current;
/**
* Construct a revision list for a given title
* Abstract base class for revision items
*/
abstract class RevisionItemBase {
- /** The parent RevisionListBase */
- var $list;
+ /** @var RevisionListBase The parent */
+ protected $list;
- /** The DB result row */
- var $row;
+ /** The database result row */
+ protected $row;
/**
* @param RevisionListBase $list
* Item class for a live revision table row
*/
class RevisionItem extends RevisionItemBase {
- var $revision, $context;
+ /** @var Revision */
+ protected $revision;
+
+ /** @var RequestContext */
+ protected $context;
public function __construct( $list, $row ) {
parent::__construct( $list, $row );
return $content_actions;
}
- /**
+ /**
* build array of common navigation links
* @return array
*/