A lot more of static issues when using E_STRICT from the commandline.
This commit is contained in:
parent
c4cbef35ec
commit
fd912a148b
14 changed files with 60 additions and 53 deletions
|
|
@ -21,7 +21,7 @@ class LinkCache {
|
|||
/**
|
||||
* Get an instance of this class
|
||||
*/
|
||||
function &singleton() {
|
||||
static function &singleton() {
|
||||
static $instance;
|
||||
if ( !isset( $instance ) ) {
|
||||
$instance = new LinkCache;
|
||||
|
|
|
|||
|
|
@ -1081,7 +1081,7 @@ class Linker {
|
|||
*
|
||||
* @static
|
||||
*/
|
||||
function splitTrail( $trail ) {
|
||||
static function splitTrail( $trail ) {
|
||||
static $regex = false;
|
||||
if ( $regex === false ) {
|
||||
global $wgContLang;
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class MagicWord {
|
|||
* Factory: creates an object representing an ID
|
||||
* @static
|
||||
*/
|
||||
function &get( $id ) {
|
||||
static function &get( $id ) {
|
||||
global $wgMagicWords;
|
||||
|
||||
if ( !is_array( $wgMagicWords ) ) {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ class MathRenderer {
|
|||
return $path;
|
||||
}
|
||||
|
||||
function renderMath( $tex ) {
|
||||
public static function renderMath( $tex ) {
|
||||
global $wgUser;
|
||||
$math = new MathRenderer( $tex );
|
||||
$math->setOutputMode( $wgUser->getOption('math'));
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class Namespace {
|
|||
* Check if the give namespace is a talk page
|
||||
* @return bool
|
||||
*/
|
||||
function isTalk( $index ) {
|
||||
static function isTalk( $index ) {
|
||||
return ($index > NS_MAIN) // Special namespaces are negative
|
||||
&& ($index % 2); // Talk namespaces are odd-numbered
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1316,7 +1316,7 @@ class Parser
|
|||
* the URL differently; as a workaround, just use the output for
|
||||
* statistical records, not for actual linking/output.
|
||||
*/
|
||||
function replaceUnusualEscapes( $url ) {
|
||||
static function replaceUnusualEscapes( $url ) {
|
||||
return preg_replace_callback( '/%[0-9A-Fa-f]{2}/',
|
||||
array( 'Parser', 'replaceUnusualEscapesCallback' ), $url );
|
||||
}
|
||||
|
|
@ -1327,7 +1327,7 @@ class Parser
|
|||
* @static
|
||||
* @private
|
||||
*/
|
||||
function replaceUnusualEscapesCallback( $matches ) {
|
||||
private static function replaceUnusualEscapesCallback( $matches ) {
|
||||
$char = urldecode( $matches[0] );
|
||||
$ord = ord( $char );
|
||||
// Is it an unsafe or HTTP reserved character according to RFC 1738?
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class ParserCache {
|
|||
/**
|
||||
* Get an instance of this object
|
||||
*/
|
||||
function &singleton() {
|
||||
public static function &singleton() {
|
||||
static $instance;
|
||||
if ( !isset( $instance ) ) {
|
||||
global $parserMemc;
|
||||
|
|
|
|||
|
|
@ -243,9 +243,14 @@ class RecentChange
|
|||
return( $rc->mAttribs['rc_id'] );
|
||||
}
|
||||
|
||||
# Makes an entry in the database corresponding to page creation
|
||||
# Note: the title object must be loaded with the new id using resetArticleID()
|
||||
/*static*/ function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default",
|
||||
/**
|
||||
* Makes an entry in the database corresponding to page creation
|
||||
* Note: the title object must be loaded with the new id using resetArticleID()
|
||||
* @todo Document parameters and return
|
||||
* @public
|
||||
* @static
|
||||
*/
|
||||
public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default",
|
||||
$ip='', $size = 0, $newId = 0 )
|
||||
{
|
||||
if ( !$ip ) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Revision {
|
|||
* @static
|
||||
* @access public
|
||||
*/
|
||||
function newFromId( $id ) {
|
||||
public static function newFromId( $id ) {
|
||||
return Revision::newFromConds(
|
||||
array( 'page_id=rev_page',
|
||||
'rev_id' => intval( $id ) ) );
|
||||
|
|
@ -42,7 +42,7 @@ class Revision {
|
|||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function newFromTitle( &$title, $id = 0 ) {
|
||||
public static function newFromTitle( &$title, $id = 0 ) {
|
||||
if( $id ) {
|
||||
$matchId = intval( $id );
|
||||
} else {
|
||||
|
|
@ -66,7 +66,7 @@ class Revision {
|
|||
* @return Revision
|
||||
* @access public
|
||||
*/
|
||||
function loadFromPageId( &$db, $pageid, $id = 0 ) {
|
||||
public static function loadFromPageId( &$db, $pageid, $id = 0 ) {
|
||||
$conds=array('page_id=rev_page','rev_page'=>intval( $pageid ), 'page_id'=>intval( $pageid ));
|
||||
if( $id ) {
|
||||
$conds['rev_id']=intval($id);
|
||||
|
|
@ -130,7 +130,7 @@ class Revision {
|
|||
* @static
|
||||
* @access private
|
||||
*/
|
||||
function newFromConds( $conditions ) {
|
||||
private static function newFromConds( $conditions ) {
|
||||
$db =& wfGetDB( DB_SLAVE );
|
||||
$row = Revision::loadFromConds( $db, $conditions );
|
||||
if( is_null( $row ) ) {
|
||||
|
|
@ -150,7 +150,7 @@ class Revision {
|
|||
* @static
|
||||
* @access private
|
||||
*/
|
||||
function loadFromConds( &$db, $conditions ) {
|
||||
private static function loadFromConds( &$db, $conditions ) {
|
||||
$res = Revision::fetchFromConds( $db, $conditions );
|
||||
if( $res ) {
|
||||
$row = $res->fetchObject();
|
||||
|
|
@ -192,7 +192,7 @@ class Revision {
|
|||
* @static
|
||||
* @access public
|
||||
*/
|
||||
function fetchRevision( &$title ) {
|
||||
public static function fetchRevision( &$title ) {
|
||||
return Revision::fetchFromConds(
|
||||
wfGetDB( DB_SLAVE ),
|
||||
array( 'rev_id=page_latest',
|
||||
|
|
@ -212,7 +212,7 @@ class Revision {
|
|||
* @static
|
||||
* @access private
|
||||
*/
|
||||
function fetchFromConds( &$db, $conditions ) {
|
||||
private static function fetchFromConds( &$db, $conditions ) {
|
||||
$res = $db->select(
|
||||
array( 'page', 'revision' ),
|
||||
array( 'page_namespace',
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ class Sanitizer {
|
|||
* @param array $args for the processing callback
|
||||
* @return string
|
||||
*/
|
||||
function removeHTMLtags( $text, $processCallback = null, $args = array() ) {
|
||||
static function removeHTMLtags( $text, $processCallback = null, $args = array() ) {
|
||||
global $wgUseTidy, $wgUserHtml;
|
||||
$fname = 'Parser::removeHTMLtags';
|
||||
wfProfileIn( $fname );
|
||||
|
|
@ -501,7 +501,7 @@ class Sanitizer {
|
|||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
function removeHTMLcomments( $text ) {
|
||||
static function removeHTMLcomments( $text ) {
|
||||
$fname='Parser::removeHTMLcomments';
|
||||
wfProfileIn( $fname );
|
||||
while (($start = strpos($text, '<!--')) !== false) {
|
||||
|
|
@ -551,7 +551,7 @@ class Sanitizer {
|
|||
* @todo Check for legal values where the DTD limits things.
|
||||
* @todo Check for unique id attribute :P
|
||||
*/
|
||||
function validateTagAttributes( $attribs, $element ) {
|
||||
static function validateTagAttributes( $attribs, $element ) {
|
||||
$whitelist = array_flip( Sanitizer::attributeWhitelist( $element ) );
|
||||
$out = array();
|
||||
foreach( $attribs as $attribute => $value ) {
|
||||
|
|
@ -626,7 +626,7 @@ class Sanitizer {
|
|||
* @param string $element
|
||||
* @return string
|
||||
*/
|
||||
function fixTagAttributes( $text, $element ) {
|
||||
static function fixTagAttributes( $text, $element ) {
|
||||
if( trim( $text ) == '' ) {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -649,7 +649,7 @@ class Sanitizer {
|
|||
* @param $text
|
||||
* @return HTML-encoded text fragment
|
||||
*/
|
||||
function encodeAttribute( $text ) {
|
||||
static function encodeAttribute( $text ) {
|
||||
$encValue = htmlspecialchars( $text );
|
||||
|
||||
// Whitespace is normalized during attribute decoding,
|
||||
|
|
@ -670,7 +670,7 @@ class Sanitizer {
|
|||
* @param $text
|
||||
* @return HTML-encoded text fragment
|
||||
*/
|
||||
function safeEncodeAttribute( $text ) {
|
||||
static function safeEncodeAttribute( $text ) {
|
||||
$encValue = Sanitizer::encodeAttribute( $text );
|
||||
|
||||
# Templates and links may be expanded in later parsing,
|
||||
|
|
@ -713,7 +713,7 @@ class Sanitizer {
|
|||
* @param string $id
|
||||
* @return string
|
||||
*/
|
||||
function escapeId( $id ) {
|
||||
static function escapeId( $id ) {
|
||||
static $replace = array(
|
||||
'%3A' => ':',
|
||||
'%' => '.'
|
||||
|
|
@ -730,7 +730,7 @@ class Sanitizer {
|
|||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function armorLinksCallback( $matches ) {
|
||||
private static function armorLinksCallback( $matches ) {
|
||||
return str_replace( ':', ':', $matches[1] );
|
||||
}
|
||||
|
||||
|
|
@ -742,7 +742,7 @@ class Sanitizer {
|
|||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
function decodeTagAttributes( $text ) {
|
||||
static function decodeTagAttributes( $text ) {
|
||||
$attribs = array();
|
||||
|
||||
if( trim( $text ) == '' ) {
|
||||
|
|
@ -780,7 +780,7 @@ class Sanitizer {
|
|||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function getTagAttributeCallback( $set ) {
|
||||
private static function getTagAttributeCallback( $set ) {
|
||||
if( isset( $set[6] ) ) {
|
||||
# Illegal #XXXXXX color with no quotes.
|
||||
return $set[6];
|
||||
|
|
@ -814,7 +814,7 @@ class Sanitizer {
|
|||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function normalizeAttributeValue( $text ) {
|
||||
private static function normalizeAttributeValue( $text ) {
|
||||
return str_replace( '"', '"',
|
||||
preg_replace(
|
||||
'/\r\n|[\x20\x0d\x0a\x09]/',
|
||||
|
|
@ -836,7 +836,7 @@ class Sanitizer {
|
|||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function normalizeCharReferences( $text ) {
|
||||
static function normalizeCharReferences( $text ) {
|
||||
return preg_replace_callback(
|
||||
MW_CHAR_REFS_REGEX,
|
||||
array( 'Sanitizer', 'normalizeCharReferencesCallback' ),
|
||||
|
|
@ -846,7 +846,7 @@ class Sanitizer {
|
|||
* @param string $matches
|
||||
* @return string
|
||||
*/
|
||||
function normalizeCharReferencesCallback( $matches ) {
|
||||
static function normalizeCharReferencesCallback( $matches ) {
|
||||
$ret = null;
|
||||
if( $matches[1] != '' ) {
|
||||
$ret = Sanitizer::normalizeEntity( $matches[1] );
|
||||
|
|
@ -871,8 +871,9 @@ class Sanitizer {
|
|||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
* @static
|
||||
*/
|
||||
function normalizeEntity( $name ) {
|
||||
static function normalizeEntity( $name ) {
|
||||
global $wgHtmlEntities;
|
||||
if( isset( $wgHtmlEntities[$name] ) ) {
|
||||
return "&$name;";
|
||||
|
|
@ -881,7 +882,7 @@ class Sanitizer {
|
|||
}
|
||||
}
|
||||
|
||||
function decCharReference( $codepoint ) {
|
||||
static function decCharReference( $codepoint ) {
|
||||
$point = intval( $codepoint );
|
||||
if( Sanitizer::validateCodepoint( $point ) ) {
|
||||
return sprintf( '&#%d;', $point );
|
||||
|
|
@ -890,7 +891,7 @@ class Sanitizer {
|
|||
}
|
||||
}
|
||||
|
||||
function hexCharReference( $codepoint ) {
|
||||
static function hexCharReference( $codepoint ) {
|
||||
$point = hexdec( $codepoint );
|
||||
if( Sanitizer::validateCodepoint( $point ) ) {
|
||||
return sprintf( '&#x%x;', $point );
|
||||
|
|
@ -904,7 +905,7 @@ class Sanitizer {
|
|||
* @param int $codepoint
|
||||
* @return bool
|
||||
*/
|
||||
function validateCodepoint( $codepoint ) {
|
||||
private static function validateCodepoint( $codepoint ) {
|
||||
return ($codepoint == 0x09)
|
||||
|| ($codepoint == 0x0a)
|
||||
|| ($codepoint == 0x0d)
|
||||
|
|
@ -954,7 +955,7 @@ class Sanitizer {
|
|||
* @return string
|
||||
* @private
|
||||
*/
|
||||
function decodeChar( $codepoint ) {
|
||||
static function decodeChar( $codepoint ) {
|
||||
if( Sanitizer::validateCodepoint( $codepoint ) ) {
|
||||
return codepointToUtf8( $codepoint );
|
||||
} else {
|
||||
|
|
@ -970,7 +971,7 @@ class Sanitizer {
|
|||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
function decodeEntity( $name ) {
|
||||
static function decodeEntity( $name ) {
|
||||
global $wgHtmlEntities;
|
||||
if( isset( $wgHtmlEntities[$name] ) ) {
|
||||
return codepointToUtf8( $wgHtmlEntities[$name] );
|
||||
|
|
@ -986,7 +987,7 @@ class Sanitizer {
|
|||
* @param string $element
|
||||
* @return array
|
||||
*/
|
||||
function attributeWhitelist( $element ) {
|
||||
static function attributeWhitelist( $element ) {
|
||||
static $list;
|
||||
if( !isset( $list ) ) {
|
||||
$list = Sanitizer::setupAttributeWhitelist();
|
||||
|
|
@ -997,9 +998,10 @@ class Sanitizer {
|
|||
}
|
||||
|
||||
/**
|
||||
* @todo Document it a bit
|
||||
* @return array
|
||||
*/
|
||||
function setupAttributeWhitelist() {
|
||||
static function setupAttributeWhitelist() {
|
||||
$common = array( 'id', 'class', 'lang', 'dir', 'title', 'style' );
|
||||
$block = array_merge( $common, array( 'align' ) );
|
||||
$tablealign = array( 'align', 'char', 'charoff', 'valign' );
|
||||
|
|
@ -1143,7 +1145,7 @@ class Sanitizer {
|
|||
* @param string $text HTML fragment
|
||||
* @return string
|
||||
*/
|
||||
function stripAllTags( $text ) {
|
||||
static function stripAllTags( $text ) {
|
||||
# Actual <tags>
|
||||
$text = preg_replace( '/ < .*? > /x', '', $text );
|
||||
|
||||
|
|
@ -1170,7 +1172,7 @@ class Sanitizer {
|
|||
* @return string
|
||||
* @static
|
||||
*/
|
||||
function hackDocType() {
|
||||
static function hackDocType() {
|
||||
global $wgHtmlEntities;
|
||||
$out = "<!DOCTYPE html [\n";
|
||||
foreach( $wgHtmlEntities as $entity => $codepoint ) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Skin extends Linker {
|
|||
* @return array of strings
|
||||
* @static
|
||||
*/
|
||||
function &getSkinNames() {
|
||||
static function &getSkinNames() {
|
||||
global $wgValidSkinNames;
|
||||
static $skinsInitialised = false;
|
||||
if ( !$skinsInitialised ) {
|
||||
|
|
@ -68,7 +68,7 @@ class Skin extends Linker {
|
|||
* @return string
|
||||
* @static
|
||||
*/
|
||||
function normalizeKey( $key ) {
|
||||
static function normalizeKey( $key ) {
|
||||
global $wgDefaultSkin;
|
||||
$skinNames = Skin::getSkinNames();
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ class Skin extends Linker {
|
|||
* @return Skin
|
||||
* @static
|
||||
*/
|
||||
function &newFromKey( $key ) {
|
||||
static function &newFromKey( $key ) {
|
||||
global $wgStyleDirectory;
|
||||
|
||||
$key = Skin::normalizeKey( $key );
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ class SpecialPage
|
|||
* @param $title a title object
|
||||
* @param $including output is being captured for use in {{special:whatever}}
|
||||
*/
|
||||
function executePath( &$title, $including = false ) {
|
||||
static function executePath( &$title, $including = false ) {
|
||||
global $wgOut, $wgTitle;
|
||||
$fname = 'SpecialPage::executePath';
|
||||
wfProfileIn( $fname );
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ class Title {
|
|||
* @static
|
||||
* @access public
|
||||
*/
|
||||
function makeTitleSafe( $ns, $title ) {
|
||||
public static function makeTitleSafe( $ns, $title ) {
|
||||
$t = new Title();
|
||||
$t->mDbkeyform = Title::makeName( $ns, $title );
|
||||
if( $t->secureAndSplit() ) {
|
||||
|
|
@ -273,7 +273,7 @@ class Title {
|
|||
* @return Title the new object
|
||||
* @access public
|
||||
*/
|
||||
function newMainPage() {
|
||||
public static function newMainPage() {
|
||||
return Title::newFromText( wfMsgForContent( 'mainpage' ) );
|
||||
}
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ class Title {
|
|||
* @static
|
||||
* @access public
|
||||
*/
|
||||
function newFromRedirect( $text ) {
|
||||
public static function newFromRedirect( $text ) {
|
||||
$mwRedir = MagicWord::get( MAG_REDIRECT );
|
||||
$rt = NULL;
|
||||
if ( $mwRedir->matchStart( $text ) ) {
|
||||
|
|
@ -336,7 +336,7 @@ class Title {
|
|||
* @static
|
||||
* @access public
|
||||
*/
|
||||
function legalChars() {
|
||||
public static function legalChars() {
|
||||
global $wgLegalTitleChars;
|
||||
return $wgLegalTitleChars;
|
||||
}
|
||||
|
|
@ -376,7 +376,7 @@ class Title {
|
|||
* @param string $title the DB key form the title
|
||||
* @return string the prefixed form of the title
|
||||
*/
|
||||
/* static */ function makeName( $ns, $title ) {
|
||||
public static function makeName( $ns, $title ) {
|
||||
global $wgContLang;
|
||||
|
||||
$n = $wgContLang->getNsText( $ns );
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ class Xml {
|
|||
}
|
||||
|
||||
// Shortcuts
|
||||
function openElement( $element, $attribs = null ) { return self::element( $element, $attribs, null ); }
|
||||
function closeElement( $element ) { return "</$element>"; }
|
||||
public static function openElement( $element, $attribs = null ) { return self::element( $element, $attribs, null ); }
|
||||
public static function closeElement( $element ) { return "</$element>"; }
|
||||
|
||||
/**
|
||||
* Create a namespace selector
|
||||
|
|
@ -216,7 +216,7 @@ class Xml {
|
|||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
function escapeJsString( $string ) {
|
||||
public static function escapeJsString( $string ) {
|
||||
// See ECMA 262 section 7.8.4 for string literal format
|
||||
$pairs = array(
|
||||
"\\" => "\\\\",
|
||||
|
|
|
|||
Loading…
Reference in a new issue