Index: trunk/phase3/includes/Xml.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default)
|
18 | 18 | * @return string
|
19 | 19 | */
|
20 | | - function element( $element, $attribs = null, $contents = '') {
|
| 20 | + public static function element( $element, $attribs = null, $contents = '') {
|
21 | 21 | $out = '<' . $element;
|
22 | 22 | if( !is_null( $attribs ) ) {
|
23 | 23 | foreach( $attribs as $name => $val ) {
|
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default)
|
47 | 47 | * @return string
|
48 | 48 | */
|
49 | | - function elementClean( $element, $attribs = array(), $contents = '') {
|
| 49 | + public static function elementClean( $element, $attribs = array(), $contents = '') {
|
50 | 50 | if( $attribs ) {
|
51 | 51 | $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );
|
52 | 52 | }
|
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | * @param $includehidden Bool: include hidden namespaces?
|
69 | 69 | * @return String: Html string containing the namespace selector
|
70 | 70 | */
|
71 | | - function &namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) {
|
| 71 | + public static function &namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) {
|
72 | 72 | global $wgContLang;
|
73 | 73 | if( $selected !== '' ) {
|
74 | 74 | if( is_null( $selected ) ) {
|
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | return $s;
|
102 | 102 | }
|
103 | 103 |
|
104 | | - function span( $text, $class, $attribs=array() ) {
|
| 104 | + public static function span( $text, $class, $attribs=array() ) {
|
105 | 105 | return self::element( 'span', array( 'class' => $class ) + $attribs, $text );
|
106 | 106 | }
|
107 | 107 |
|
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | * Convenience function to build an HTML text input field
|
110 | 110 | * @return string HTML
|
111 | 111 | */
|
112 | | - function input( $name, $size=false, $value=false, $attribs=array() ) {
|
| 112 | + public static function input( $name, $size=false, $value=false, $attribs=array() ) {
|
113 | 113 | return self::element( 'input', array(
|
114 | 114 | 'name' => $name,
|
115 | 115 | 'size' => $size,
|
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | * Internal function for use in checkboxes and radio buttons and such.
|
121 | 121 | * @return array
|
122 | 122 | */
|
123 | | - function attrib( $name, $present = true ) {
|
| 123 | + public static function attrib( $name, $present = true ) {
|
124 | 124 | return $present ? array( $name => $name ) : array();
|
125 | 125 | }
|
126 | 126 |
|
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | * Convenience function to build an HTML checkbox
|
129 | 129 | * @return string HTML
|
130 | 130 | */
|
131 | | - function check( $name, $checked=false, $attribs=array() ) {
|
| 131 | + public static function check( $name, $checked=false, $attribs=array() ) {
|
132 | 132 | return self::element( 'input', array(
|
133 | 133 | 'name' => $name,
|
134 | 134 | 'type' => 'checkbox',
|
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | * Convenience function to build an HTML radio button
|
140 | 140 | * @return string HTML
|
141 | 141 | */
|
142 | | - function radio( $name, $value, $checked=false, $attribs=array() ) {
|
| 142 | + public static function radio( $name, $value, $checked=false, $attribs=array() ) {
|
143 | 143 | return self::element( 'input', array(
|
144 | 144 | 'name' => $name,
|
145 | 145 | 'type' => 'radio',
|
— | — | @@ -149,7 +149,7 @@ |
150 | 150 | * Convenience function to build an HTML form label
|
151 | 151 | * @return string HTML
|
152 | 152 | */
|
153 | | - function label( $label, $id ) {
|
| 153 | + public static function label( $label, $id ) {
|
154 | 154 | return self::element( 'label', array( 'for' => $id ), $label );
|
155 | 155 | }
|
156 | 156 |
|
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | * Convenience function to build an HTML text input field with a label
|
159 | 159 | * @return string HTML
|
160 | 160 | */
|
161 | | - function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) {
|
| 161 | + public static function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) {
|
162 | 162 | return Xml::label( $label, $id ) .
|
163 | 163 | ' ' .
|
164 | 164 | self::input( $name, $size, $value, array( 'id' => $id ) + $attribs );
|
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | * Convenience function to build an HTML checkbox with a label
|
169 | 169 | * @return string HTML
|
170 | 170 | */
|
171 | | - function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) {
|
| 171 | + public static function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) {
|
172 | 172 | return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) .
|
173 | 173 | ' ' .
|
174 | 174 | self::label( $label, $id );
|
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | * Convenience function to build an HTML radio button with a label
|
179 | 179 | * @return string HTML
|
180 | 180 | */
|
181 | | - function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) {
|
| 181 | + public static function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) {
|
182 | 182 | return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) .
|
183 | 183 | ' ' .
|
184 | 184 | self::label( $label, $id );
|
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | * @param $attribs Array: optional custom attributes
|
191 | 191 | * @return string HTML
|
192 | 192 | */
|
193 | | - function submitButton( $value, $attribs=array() ) {
|
| 193 | + public static function submitButton( $value, $attribs=array() ) {
|
194 | 194 | return self::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs );
|
195 | 195 | }
|
196 | 196 |
|
— | — | @@ -201,7 +201,7 @@ |
202 | 202 | * @param $attribs Array: optional custom attributes
|
203 | 203 | * @return string HTML
|
204 | 204 | */
|
205 | | - function hidden( $name, $value, $attribs=array() ) {
|
| 205 | + public static function hidden( $name, $value, $attribs=array() ) {
|
206 | 206 | return self::element( 'input', array(
|
207 | 207 | 'name' => $name,
|
208 | 208 | 'type' => 'hidden',
|
— | — | @@ -241,7 +241,7 @@ |
242 | 242 | *
|
243 | 243 | * @todo Error position reporting return
|
244 | 244 | */
|
245 | | - function isWellFormed( $text ) {
|
| 245 | + public static function isWellFormed( $text ) {
|
246 | 246 | $parser = xml_parser_create( "UTF-8" );
|
247 | 247 |
|
248 | 248 | # case folding violates XML standard, turn it off
|
— | — | @@ -267,7 +267,7 @@ |
268 | 268 | * @param $text String:
|
269 | 269 | * @return bool
|
270 | 270 | */
|
271 | | - function isWellFormedXmlFragment( $text ) {
|
| 271 | + public static function isWellFormedXmlFragment( $text ) {
|
272 | 272 | $html =
|
273 | 273 | Sanitizer::hackDocType() .
|
274 | 274 | '<html>' .
|
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | * Check if the given namespace might be moved |
51 | 51 | * @return bool |
52 | 52 | */ |
53 | | - function isMovable( $index ) { |
| 53 | + static function isMovable( $index ) { |
54 | 54 | return !( $index < NS_MAIN || $index == NS_IMAGE || $index == NS_CATEGORY ); |
55 | 55 | } |
56 | 56 | |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | * Check if the given namespace is not a talk page |
59 | 59 | * @return bool |
60 | 60 | */ |
61 | | - function isMain( $index ) { |
| 61 | + static function isMain( $index ) { |
62 | 62 | return ! Namespace::isTalk( $index ); |
63 | 63 | } |
64 | 64 | |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | /** |
75 | 75 | * Get the talk namespace corresponding to the given index |
76 | 76 | */ |
77 | | - function getTalk( $index ) { |
| 77 | + static function getTalk( $index ) { |
78 | 78 | if ( Namespace::isTalk( $index ) ) { |
79 | 79 | return $index; |
80 | 80 | } else { |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | | - function getSubject( $index ) { |
| 86 | + static function getSubject( $index ) { |
87 | 87 | if ( Namespace::isTalk( $index ) ) { |
88 | 88 | return $index - 1; |
89 | 89 | } else { |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | /** |
95 | 95 | * Returns the canonical (English Wikipedia) name for a given index |
96 | 96 | */ |
97 | | - function getCanonicalName( $index ) { |
| 97 | + static function getCanonicalName( $index ) { |
98 | 98 | global $wgCanonicalNamespaceNames; |
99 | 99 | return $wgCanonicalNamespaceNames[$index]; |
100 | 100 | } |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | * Returns the index for a given canonical name, or NULL |
104 | 104 | * The input *must* be converted to lower case first |
105 | 105 | */ |
106 | | - function getCanonicalIndex( $name ) { |
| 106 | + static function getCanonicalIndex( $name ) { |
107 | 107 | global $wgCanonicalNamespaceNames; |
108 | 108 | static $xNamespaces = false; |
109 | 109 | if ( $xNamespaces === false ) { |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | * Can this namespace ever have a talk namespace? |
124 | 124 | * @param $index Namespace index |
125 | 125 | */ |
126 | | - function canTalk( $index ) { |
| 126 | + static function canTalk( $index ) { |
127 | 127 | return( $index >= NS_MAIN ); |
128 | 128 | } |
129 | 129 | } |