From acb150a1054104b8000ff6541749294b29aad1c9 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 11 May 2006 19:39:50 +0000 Subject: [PATCH] a round of static statements --- includes/LoadBalancer.php | 2 +- includes/MagicWord.php | 2 +- includes/OutputPage.php | 2 +- includes/Parser.php | 2 +- includes/Sanitizer.php | 14 ++++++++------ includes/SpecialPage.php | 12 ++++++------ includes/Title.php | 2 +- includes/User.php | 5 +++-- 8 files changed, 22 insertions(+), 19 deletions(-) diff --git a/includes/LoadBalancer.php b/includes/LoadBalancer.php index 83c02991ec..7206b7ba33 100644 --- a/includes/LoadBalancer.php +++ b/includes/LoadBalancer.php @@ -62,7 +62,7 @@ class LoadBalancer { $this->mAllowLag = false; } - function newFromParams( $servers, $failFunction = false, $waitTimeout = 10 ) + static function newFromParams( $servers, $failFunction = false, $waitTimeout = 10 ) { $lb = new LoadBalancer; $lb->initialise( $servers, $failFunction, $waitTimeout ); diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 5a42a7a49d..cd654ce5a2 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -182,7 +182,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/OutputPage.php b/includes/OutputPage.php index cb918ac254..3bacd96f79 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -611,7 +611,7 @@ class OutputPage { print $outs; } - function setEncodings() { + static function setEncodings() { global $wgInputEncoding, $wgOutputEncoding; global $wgUser, $wgContLang; diff --git a/includes/Parser.php b/includes/Parser.php index e07b2363f1..0e38b912fb 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4253,7 +4253,7 @@ class ParserOptions * Get parser options * @static */ - function newFromUser( &$user ) { + static function newFromUser( &$user ) { $popts = new ParserOptions; $popts->initialiseFromUser( $user ); return $popts; diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 784541940c..7d4551e8d4 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -634,7 +634,7 @@ class Sanitizer { * @param string $id * @return string */ - function escapeId( $id ) { + static function escapeId( $id ) { static $replace = array( '%3A' => ':', '%' => '.' @@ -750,6 +750,7 @@ class Sanitizer { * @param string $text * @return string * @private + * @todo FIXME called from parser.php so not that much private */ function normalizeCharReferences( $text ) { return preg_replace_callback( @@ -761,7 +762,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] ); @@ -787,7 +788,7 @@ class Sanitizer { * @param string $name * @return string */ - function normalizeEntity( $name ) { + static function normalizeEntity( $name ) { global $wgHtmlEntities; if( isset( $wgHtmlEntities[$name] ) ) { return "&$name;"; @@ -835,8 +836,9 @@ class Sanitizer { * @param string $text * @return string * @public + * @static */ - function decodeCharReferences( $text ) { + public static function decodeCharReferences( $text ) { return preg_replace_callback( MW_CHAR_REFS_REGEX, array( 'Sanitizer', 'decodeCharReferencesCallback' ), @@ -847,7 +849,7 @@ class Sanitizer { * @param string $matches * @return string */ - function decodeCharReferencesCallback( $matches ) { + static function decodeCharReferencesCallback( $matches ) { if( $matches[1] != '' ) { return Sanitizer::decodeEntity( $matches[1] ); } elseif( $matches[2] != '' ) { @@ -1084,7 +1086,7 @@ class Sanitizer { * @return string * @static */ - function hackDocType() { + static function hackDocType() { global $wgHtmlEntities; $out = " $codepoint ) { diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index b061598e6d..b88b6dc359 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -145,7 +145,7 @@ class SpecialPage * Use this for a special page extension * @static */ - function addPage( &$obj ) { + static function addPage( &$obj ) { global $wgSpecialPages; $wgSpecialPages[$obj->mName] = $obj; } @@ -155,7 +155,7 @@ class SpecialPage * Occasionally used to disable expensive or dangerous special pages * @static */ - function removePage( $name ) { + static function removePage( $name ) { global $wgSpecialPages; unset( $wgSpecialPages[$name] ); } @@ -165,7 +165,7 @@ class SpecialPage * @static * @param string $name */ - function getPage( $name ) { + static function getPage( $name ) { global $wgSpecialPages; if ( array_key_exists( $name, $wgSpecialPages ) ) { return $wgSpecialPages[$name]; @@ -179,7 +179,7 @@ class SpecialPage * @param string $name * @return mixed Title object if the redirect exists, otherwise NULL */ - function getRedirect( $name ) { + static function getRedirect( $name ) { global $wgUser; $redirects = array( @@ -227,7 +227,7 @@ class SpecialPage * Returns a 2d array where the first index is the restriction name * @static */ - function getPages() { + static function getPages() { global $wgSpecialPages; $pages = array( '' => array(), @@ -324,7 +324,7 @@ class SpecialPage * a redirect. * @static */ - function capturePath( &$title ) { + static function capturePath( &$title ) { global $wgOut, $wgTitle; $oldTitle = $wgTitle; diff --git a/includes/Title.php b/includes/Title.php index c23e0bfd10..ed841c59f2 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -216,7 +216,7 @@ class Title { * @static * @access public */ - function &makeTitle( $ns, $title ) { + public static function &makeTitle( $ns, $title ) { $t =& new Title(); $t->mInterwiki = ''; $t->mFragment = ''; diff --git a/includes/User.php b/includes/User.php index 5d6e2e8944..81c45ec1a8 100644 --- a/includes/User.php +++ b/includes/User.php @@ -641,8 +641,9 @@ class User { /** * Initialise php session + * @static */ - function SetupSession() { + static function SetupSession() { global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain; if( $wgSessionsInMemcached ) { require_once( 'MemcachedSessions.php' ); @@ -660,7 +661,7 @@ class User { * Create a new user object using data from session * @static */ - function loadFromSession() { + static function loadFromSession() { global $wgMemc, $wgDBname, $wgCookiePrefix; if ( isset( $_SESSION['wsUserID'] ) ) { -- 2.20.1