Index: trunk/phase3/includes/Xml.php |
— | — | @@ -56,8 +56,8 @@ |
57 | 57 | }
|
58 | 58 |
|
59 | 59 | // Shortcuts
|
60 | | - function openElement( $element, $attribs = null ) { return self::element( $element, $attribs, null ); }
|
61 | | - function closeElement( $element ) { return "</$element>"; }
|
| 60 | + public static function openElement( $element, $attribs = null ) { return self::element( $element, $attribs, null ); }
|
| 61 | + public static function closeElement( $element ) { return "</$element>"; }
|
62 | 62 |
|
63 | 63 | /**
|
64 | 64 | * Create a namespace selector
|
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | * @param string $string
|
218 | 218 | * @return string
|
219 | 219 | */
|
220 | | - function escapeJsString( $string ) {
|
| 220 | + public static function escapeJsString( $string ) {
|
221 | 221 | // See ECMA 262 section 7.8.4 for string literal format
|
222 | 222 | $pairs = array(
|
223 | 223 | "\\" => "\\\\",
|
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -243,9 +243,14 @@ |
244 | 244 | return( $rc->mAttribs['rc_id'] ); |
245 | 245 | } |
246 | 246 | |
247 | | - # Makes an entry in the database corresponding to page creation |
248 | | - # Note: the title object must be loaded with the new id using resetArticleID() |
249 | | - /*static*/ function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default", |
| 247 | + /** |
| 248 | + * Makes an entry in the database corresponding to page creation |
| 249 | + * Note: the title object must be loaded with the new id using resetArticleID() |
| 250 | + * @todo Document parameters and return |
| 251 | + * @public |
| 252 | + * @static |
| 253 | + */ |
| 254 | + public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = "default", |
250 | 255 | $ip='', $size = 0, $newId = 0 ) |
251 | 256 | { |
252 | 257 | if ( !$ip ) { |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1081,7 +1081,7 @@ |
1082 | 1082 | * |
1083 | 1083 | * @static |
1084 | 1084 | */ |
1085 | | - function splitTrail( $trail ) { |
| 1085 | + static function splitTrail( $trail ) { |
1086 | 1086 | static $regex = false; |
1087 | 1087 | if ( $regex === false ) { |
1088 | 1088 | global $wgContLang; |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -1316,7 +1316,7 @@ |
1317 | 1317 | * the URL differently; as a workaround, just use the output for |
1318 | 1318 | * statistical records, not for actual linking/output. |
1319 | 1319 | */ |
1320 | | - function replaceUnusualEscapes( $url ) { |
| 1320 | + static function replaceUnusualEscapes( $url ) { |
1321 | 1321 | return preg_replace_callback( '/%[0-9A-Fa-f]{2}/', |
1322 | 1322 | array( 'Parser', 'replaceUnusualEscapesCallback' ), $url ); |
1323 | 1323 | } |
— | — | @@ -1327,7 +1327,7 @@ |
1328 | 1328 | * @static |
1329 | 1329 | * @private |
1330 | 1330 | */ |
1331 | | - function replaceUnusualEscapesCallback( $matches ) { |
| 1331 | + private static function replaceUnusualEscapesCallback( $matches ) { |
1332 | 1332 | $char = urldecode( $matches[0] ); |
1333 | 1333 | $ord = ord( $char ); |
1334 | 1334 | // Is it an unsafe or HTTP reserved character according to RFC 1738? |
Index: trunk/phase3/includes/Sanitizer.php |
— | — | @@ -327,7 +327,7 @@ |
328 | 328 | * @param array $args for the processing callback |
329 | 329 | * @return string |
330 | 330 | */ |
331 | | - function removeHTMLtags( $text, $processCallback = null, $args = array() ) { |
| 331 | + static function removeHTMLtags( $text, $processCallback = null, $args = array() ) { |
332 | 332 | global $wgUseTidy, $wgUserHtml; |
333 | 333 | $fname = 'Parser::removeHTMLtags'; |
334 | 334 | wfProfileIn( $fname ); |
— | — | @@ -501,7 +501,7 @@ |
502 | 502 | * @param string $text |
503 | 503 | * @return string |
504 | 504 | */ |
505 | | - function removeHTMLcomments( $text ) { |
| 505 | + static function removeHTMLcomments( $text ) { |
506 | 506 | $fname='Parser::removeHTMLcomments'; |
507 | 507 | wfProfileIn( $fname ); |
508 | 508 | while (($start = strpos($text, '<!--')) !== false) { |
— | — | @@ -551,7 +551,7 @@ |
552 | 552 | * @todo Check for legal values where the DTD limits things. |
553 | 553 | * @todo Check for unique id attribute :P |
554 | 554 | */ |
555 | | - function validateTagAttributes( $attribs, $element ) { |
| 555 | + static function validateTagAttributes( $attribs, $element ) { |
556 | 556 | $whitelist = array_flip( Sanitizer::attributeWhitelist( $element ) ); |
557 | 557 | $out = array(); |
558 | 558 | foreach( $attribs as $attribute => $value ) { |
— | — | @@ -626,7 +626,7 @@ |
627 | 627 | * @param string $element |
628 | 628 | * @return string |
629 | 629 | */ |
630 | | - function fixTagAttributes( $text, $element ) { |
| 630 | + static function fixTagAttributes( $text, $element ) { |
631 | 631 | if( trim( $text ) == '' ) { |
632 | 632 | return ''; |
633 | 633 | } |
— | — | @@ -649,7 +649,7 @@ |
650 | 650 | * @param $text |
651 | 651 | * @return HTML-encoded text fragment |
652 | 652 | */ |
653 | | - function encodeAttribute( $text ) { |
| 653 | + static function encodeAttribute( $text ) { |
654 | 654 | $encValue = htmlspecialchars( $text ); |
655 | 655 | |
656 | 656 | // Whitespace is normalized during attribute decoding, |
— | — | @@ -670,7 +670,7 @@ |
671 | 671 | * @param $text |
672 | 672 | * @return HTML-encoded text fragment |
673 | 673 | */ |
674 | | - function safeEncodeAttribute( $text ) { |
| 674 | + static function safeEncodeAttribute( $text ) { |
675 | 675 | $encValue = Sanitizer::encodeAttribute( $text ); |
676 | 676 | |
677 | 677 | # Templates and links may be expanded in later parsing, |
— | — | @@ -713,7 +713,7 @@ |
714 | 714 | * @param string $id |
715 | 715 | * @return string |
716 | 716 | */ |
717 | | - function escapeId( $id ) { |
| 717 | + static function escapeId( $id ) { |
718 | 718 | static $replace = array( |
719 | 719 | '%3A' => ':', |
720 | 720 | '%' => '.' |
— | — | @@ -730,7 +730,7 @@ |
731 | 731 | * @return string |
732 | 732 | * @private |
733 | 733 | */ |
734 | | - function armorLinksCallback( $matches ) { |
| 734 | + private static function armorLinksCallback( $matches ) { |
735 | 735 | return str_replace( ':', ':', $matches[1] ); |
736 | 736 | } |
737 | 737 | |
— | — | @@ -742,7 +742,7 @@ |
743 | 743 | * @param string |
744 | 744 | * @return array |
745 | 745 | */ |
746 | | - function decodeTagAttributes( $text ) { |
| 746 | + static function decodeTagAttributes( $text ) { |
747 | 747 | $attribs = array(); |
748 | 748 | |
749 | 749 | if( trim( $text ) == '' ) { |
— | — | @@ -780,7 +780,7 @@ |
781 | 781 | * @return string |
782 | 782 | * @private |
783 | 783 | */ |
784 | | - function getTagAttributeCallback( $set ) { |
| 784 | + private static function getTagAttributeCallback( $set ) { |
785 | 785 | if( isset( $set[6] ) ) { |
786 | 786 | # Illegal #XXXXXX color with no quotes. |
787 | 787 | return $set[6]; |
— | — | @@ -814,7 +814,7 @@ |
815 | 815 | * @return string |
816 | 816 | * @private |
817 | 817 | */ |
818 | | - function normalizeAttributeValue( $text ) { |
| 818 | + private static function normalizeAttributeValue( $text ) { |
819 | 819 | return str_replace( '"', '"', |
820 | 820 | preg_replace( |
821 | 821 | '/\r\n|[\x20\x0d\x0a\x09]/', |
— | — | @@ -836,7 +836,7 @@ |
837 | 837 | * @return string |
838 | 838 | * @private |
839 | 839 | */ |
840 | | - function normalizeCharReferences( $text ) { |
| 840 | + static function normalizeCharReferences( $text ) { |
841 | 841 | return preg_replace_callback( |
842 | 842 | MW_CHAR_REFS_REGEX, |
843 | 843 | array( 'Sanitizer', 'normalizeCharReferencesCallback' ), |
— | — | @@ -846,7 +846,7 @@ |
847 | 847 | * @param string $matches |
848 | 848 | * @return string |
849 | 849 | */ |
850 | | - function normalizeCharReferencesCallback( $matches ) { |
| 850 | + static function normalizeCharReferencesCallback( $matches ) { |
851 | 851 | $ret = null; |
852 | 852 | if( $matches[1] != '' ) { |
853 | 853 | $ret = Sanitizer::normalizeEntity( $matches[1] ); |
— | — | @@ -871,8 +871,9 @@ |
872 | 872 | * |
873 | 873 | * @param string $name |
874 | 874 | * @return string |
| 875 | + * @static |
875 | 876 | */ |
876 | | - function normalizeEntity( $name ) { |
| 877 | + static function normalizeEntity( $name ) { |
877 | 878 | global $wgHtmlEntities; |
878 | 879 | if( isset( $wgHtmlEntities[$name] ) ) { |
879 | 880 | return "&$name;"; |
— | — | @@ -881,7 +882,7 @@ |
882 | 883 | } |
883 | 884 | } |
884 | 885 | |
885 | | - function decCharReference( $codepoint ) { |
| 886 | + static function decCharReference( $codepoint ) { |
886 | 887 | $point = intval( $codepoint ); |
887 | 888 | if( Sanitizer::validateCodepoint( $point ) ) { |
888 | 889 | return sprintf( '&#%d;', $point ); |
— | — | @@ -890,7 +891,7 @@ |
891 | 892 | } |
892 | 893 | } |
893 | 894 | |
894 | | - function hexCharReference( $codepoint ) { |
| 895 | + static function hexCharReference( $codepoint ) { |
895 | 896 | $point = hexdec( $codepoint ); |
896 | 897 | if( Sanitizer::validateCodepoint( $point ) ) { |
897 | 898 | return sprintf( '&#x%x;', $point ); |
— | — | @@ -904,7 +905,7 @@ |
905 | 906 | * @param int $codepoint |
906 | 907 | * @return bool |
907 | 908 | */ |
908 | | - function validateCodepoint( $codepoint ) { |
| 909 | + private static function validateCodepoint( $codepoint ) { |
909 | 910 | return ($codepoint == 0x09) |
910 | 911 | || ($codepoint == 0x0a) |
911 | 912 | || ($codepoint == 0x0d) |
— | — | @@ -954,7 +955,7 @@ |
955 | 956 | * @return string |
956 | 957 | * @private |
957 | 958 | */ |
958 | | - function decodeChar( $codepoint ) { |
| 959 | + static function decodeChar( $codepoint ) { |
959 | 960 | if( Sanitizer::validateCodepoint( $codepoint ) ) { |
960 | 961 | return codepointToUtf8( $codepoint ); |
961 | 962 | } else { |
— | — | @@ -970,7 +971,7 @@ |
971 | 972 | * @param string $name |
972 | 973 | * @return string |
973 | 974 | */ |
974 | | - function decodeEntity( $name ) { |
| 975 | + static function decodeEntity( $name ) { |
975 | 976 | global $wgHtmlEntities; |
976 | 977 | if( isset( $wgHtmlEntities[$name] ) ) { |
977 | 978 | return codepointToUtf8( $wgHtmlEntities[$name] ); |
— | — | @@ -986,7 +987,7 @@ |
987 | 988 | * @param string $element |
988 | 989 | * @return array |
989 | 990 | */ |
990 | | - function attributeWhitelist( $element ) { |
| 991 | + static function attributeWhitelist( $element ) { |
991 | 992 | static $list; |
992 | 993 | if( !isset( $list ) ) { |
993 | 994 | $list = Sanitizer::setupAttributeWhitelist(); |
— | — | @@ -997,9 +998,10 @@ |
998 | 999 | } |
999 | 1000 | |
1000 | 1001 | /** |
| 1002 | + * @todo Document it a bit |
1001 | 1003 | * @return array |
1002 | 1004 | */ |
1003 | | - function setupAttributeWhitelist() { |
| 1005 | + static function setupAttributeWhitelist() { |
1004 | 1006 | $common = array( 'id', 'class', 'lang', 'dir', 'title', 'style' ); |
1005 | 1007 | $block = array_merge( $common, array( 'align' ) ); |
1006 | 1008 | $tablealign = array( 'align', 'char', 'charoff', 'valign' ); |
— | — | @@ -1143,7 +1145,7 @@ |
1144 | 1146 | * @param string $text HTML fragment |
1145 | 1147 | * @return string |
1146 | 1148 | */ |
1147 | | - function stripAllTags( $text ) { |
| 1149 | + static function stripAllTags( $text ) { |
1148 | 1150 | # Actual <tags> |
1149 | 1151 | $text = preg_replace( '/ < .*? > /x', '', $text ); |
1150 | 1152 | |
— | — | @@ -1170,7 +1172,7 @@ |
1171 | 1173 | * @return string |
1172 | 1174 | * @static |
1173 | 1175 | */ |
1174 | | - function hackDocType() { |
| 1176 | + static function hackDocType() { |
1175 | 1177 | global $wgHtmlEntities; |
1176 | 1178 | $out = "<!DOCTYPE html [\n"; |
1177 | 1179 | foreach( $wgHtmlEntities as $entity => $codepoint ) { |
Index: trunk/phase3/includes/Revision.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | * @static |
27 | 27 | * @access public |
28 | 28 | */ |
29 | | - function newFromId( $id ) { |
| 29 | + public static function newFromId( $id ) { |
30 | 30 | return Revision::newFromConds( |
31 | 31 | array( 'page_id=rev_page', |
32 | 32 | 'rev_id' => intval( $id ) ) ); |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | * @access public |
44 | 44 | * @static |
45 | 45 | */ |
46 | | - function newFromTitle( &$title, $id = 0 ) { |
| 46 | + public static function newFromTitle( &$title, $id = 0 ) { |
47 | 47 | if( $id ) { |
48 | 48 | $matchId = intval( $id ); |
49 | 49 | } else { |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | * @return Revision |
68 | 68 | * @access public |
69 | 69 | */ |
70 | | - function loadFromPageId( &$db, $pageid, $id = 0 ) { |
| 70 | + public static function loadFromPageId( &$db, $pageid, $id = 0 ) { |
71 | 71 | $conds=array('page_id=rev_page','rev_page'=>intval( $pageid ), 'page_id'=>intval( $pageid )); |
72 | 72 | if( $id ) { |
73 | 73 | $conds['rev_id']=intval($id); |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | * @static |
132 | 132 | * @access private |
133 | 133 | */ |
134 | | - function newFromConds( $conditions ) { |
| 134 | + private static function newFromConds( $conditions ) { |
135 | 135 | $db =& wfGetDB( DB_SLAVE ); |
136 | 136 | $row = Revision::loadFromConds( $db, $conditions ); |
137 | 137 | if( is_null( $row ) ) { |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | * @static |
152 | 152 | * @access private |
153 | 153 | */ |
154 | | - function loadFromConds( &$db, $conditions ) { |
| 154 | + private static function loadFromConds( &$db, $conditions ) { |
155 | 155 | $res = Revision::fetchFromConds( $db, $conditions ); |
156 | 156 | if( $res ) { |
157 | 157 | $row = $res->fetchObject(); |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | * @static |
194 | 194 | * @access public |
195 | 195 | */ |
196 | | - function fetchRevision( &$title ) { |
| 196 | + public static function fetchRevision( &$title ) { |
197 | 197 | return Revision::fetchFromConds( |
198 | 198 | wfGetDB( DB_SLAVE ), |
199 | 199 | array( 'rev_id=page_latest', |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | * @static |
214 | 214 | * @access private |
215 | 215 | */ |
216 | | - function fetchFromConds( &$db, $conditions ) { |
| 216 | + private static function fetchFromConds( &$db, $conditions ) { |
217 | 217 | $res = $db->select( |
218 | 218 | array( 'page', 'revision' ), |
219 | 219 | array( 'page_namespace', |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -196,7 +196,7 @@ |
197 | 197 | * Factory: creates an object representing an ID |
198 | 198 | * @static |
199 | 199 | */ |
200 | | - function &get( $id ) { |
| 200 | + static function &get( $id ) { |
201 | 201 | global $wgMagicWords; |
202 | 202 | |
203 | 203 | if ( !is_array( $wgMagicWords ) ) { |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -256,7 +256,7 @@ |
257 | 257 | * @static |
258 | 258 | * @access public |
259 | 259 | */ |
260 | | - function makeTitleSafe( $ns, $title ) { |
| 260 | + public static function makeTitleSafe( $ns, $title ) { |
261 | 261 | $t = new Title(); |
262 | 262 | $t->mDbkeyform = Title::makeName( $ns, $title ); |
263 | 263 | if( $t->secureAndSplit() ) { |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | * @return Title the new object |
275 | 275 | * @access public |
276 | 276 | */ |
277 | | - function newMainPage() { |
| 277 | + public static function newMainPage() { |
278 | 278 | return Title::newFromText( wfMsgForContent( 'mainpage' ) ); |
279 | 279 | } |
280 | 280 | |
— | — | @@ -285,7 +285,7 @@ |
286 | 286 | * @static |
287 | 287 | * @access public |
288 | 288 | */ |
289 | | - function newFromRedirect( $text ) { |
| 289 | + public static function newFromRedirect( $text ) { |
290 | 290 | $mwRedir = MagicWord::get( MAG_REDIRECT ); |
291 | 291 | $rt = NULL; |
292 | 292 | if ( $mwRedir->matchStart( $text ) ) { |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | * @static |
338 | 338 | * @access public |
339 | 339 | */ |
340 | | - function legalChars() { |
| 340 | + public static function legalChars() { |
341 | 341 | global $wgLegalTitleChars; |
342 | 342 | return $wgLegalTitleChars; |
343 | 343 | } |
— | — | @@ -376,7 +376,7 @@ |
377 | 377 | * @param string $title the DB key form the title |
378 | 378 | * @return string the prefixed form of the title |
379 | 379 | */ |
380 | | - /* static */ function makeName( $ns, $title ) { |
| 380 | + public static function makeName( $ns, $title ) { |
381 | 381 | global $wgContLang; |
382 | 382 | |
383 | 383 | $n = $wgContLang->getNsText( $ns ); |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | * Check if the give namespace is a talk page |
67 | 67 | * @return bool |
68 | 68 | */ |
69 | | - function isTalk( $index ) { |
| 69 | + static function isTalk( $index ) { |
70 | 70 | return ($index > NS_MAIN) // Special namespaces are negative |
71 | 71 | && ($index % 2); // Talk namespaces are odd-numbered |
72 | 72 | } |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | * @return array of strings |
35 | 35 | * @static |
36 | 36 | */ |
37 | | - function &getSkinNames() { |
| 37 | + static function &getSkinNames() { |
38 | 38 | global $wgValidSkinNames; |
39 | 39 | static $skinsInitialised = false; |
40 | 40 | if ( !$skinsInitialised ) { |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | * @return string |
70 | 70 | * @static |
71 | 71 | */ |
72 | | - function normalizeKey( $key ) { |
| 72 | + static function normalizeKey( $key ) { |
73 | 73 | global $wgDefaultSkin; |
74 | 74 | $skinNames = Skin::getSkinNames(); |
75 | 75 | |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | * @return Skin |
109 | 109 | * @static |
110 | 110 | */ |
111 | | - function &newFromKey( $key ) { |
| 111 | + static function &newFromKey( $key ) { |
112 | 112 | global $wgStyleDirectory; |
113 | 113 | |
114 | 114 | $key = Skin::normalizeKey( $key ); |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -313,7 +313,7 @@ |
314 | 314 | * @param $title a title object |
315 | 315 | * @param $including output is being captured for use in {{special:whatever}} |
316 | 316 | */ |
317 | | - function executePath( &$title, $including = false ) { |
| 317 | + static function executePath( &$title, $including = false ) { |
318 | 318 | global $wgOut, $wgTitle; |
319 | 319 | $fname = 'SpecialPage::executePath'; |
320 | 320 | wfProfileIn( $fname ); |
Index: trunk/phase3/includes/ParserCache.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | /** |
15 | 15 | * Get an instance of this object |
16 | 16 | */ |
17 | | - function &singleton() { |
| 17 | + public static function &singleton() { |
18 | 18 | static $instance; |
19 | 19 | if ( !isset( $instance ) ) { |
20 | 20 | global $parserMemc; |
Index: trunk/phase3/includes/Math.php |
— | — | @@ -259,7 +259,7 @@ |
260 | 260 | return $path; |
261 | 261 | } |
262 | 262 | |
263 | | - function renderMath( $tex ) { |
| 263 | + public static function renderMath( $tex ) { |
264 | 264 | global $wgUser; |
265 | 265 | $math = new MathRenderer( $tex ); |
266 | 266 | $math->setOutputMode( $wgUser->getOption('math')); |
Index: trunk/phase3/includes/LinkCache.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | /** |
23 | 23 | * Get an instance of this class |
24 | 24 | */ |
25 | | - function &singleton() { |
| 25 | + static function &singleton() { |
26 | 26 | static $instance; |
27 | 27 | if ( !isset( $instance ) ) { |
28 | 28 | $instance = new LinkCache; |