From fd912a148b69ff488593ebd6d5e8da3b5f1cab08 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 10 Jul 2006 15:41:30 +0000 Subject: [PATCH] A lot more of static issues when using E_STRICT from the commandline. --- includes/LinkCache.php | 2 +- includes/Linker.php | 2 +- includes/MagicWord.php | 2 +- includes/Math.php | 2 +- includes/Namespace.php | 2 +- includes/Parser.php | 4 ++-- includes/ParserCache.php | 2 +- includes/RecentChange.php | 11 ++++++--- includes/Revision.php | 14 ++++++------ includes/Sanitizer.php | 48 ++++++++++++++++++++------------------- includes/Skin.php | 6 ++--- includes/SpecialPage.php | 2 +- includes/Title.php | 10 ++++---- includes/Xml.php | 6 ++--- 14 files changed, 60 insertions(+), 53 deletions(-) diff --git a/includes/LinkCache.php b/includes/LinkCache.php index 451b3f0c0a..a7cbe47ee9 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -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; diff --git a/includes/Linker.php b/includes/Linker.php index 4a0eafbdc7..6cc7976fbd 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1081,7 +1081,7 @@ class Linker { * * @static */ - function splitTrail( $trail ) { + static function splitTrail( $trail ) { static $regex = false; if ( $regex === false ) { global $wgContLang; diff --git a/includes/MagicWord.php b/includes/MagicWord.php index c80d258389..75a8413844 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -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 ) ) { diff --git a/includes/Math.php b/includes/Math.php index f9d6a605b5..a8b339840f 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -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')); diff --git a/includes/Namespace.php b/includes/Namespace.php index ab7511d03e..422a28007f 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -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 } diff --git a/includes/Parser.php b/includes/Parser.php index cfe6f1c5cb..e1efe54a73 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -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? diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 3ec7512fca..612790a38b 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -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; diff --git a/includes/RecentChange.php b/includes/RecentChange.php index f320a47ac9..1f035d367f 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -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 ) { diff --git a/includes/Revision.php b/includes/Revision.php index 653bacb8d9..a33e48fefa 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -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', diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 7caefc69a7..f2dde9281a 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -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, '