Adding some more static statements
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 10 Jul 2006 18:53:15 +0000 (18:53 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 10 Jul 2006 18:53:15 +0000 (18:53 +0000)
includes/Namespace.php
includes/Xml.php

index 422a280..73dc296 100644 (file)
@@ -49,7 +49,7 @@ class Namespace {
         * Check if the given namespace might be moved
         * @return bool
         */
-       function isMovable( $index ) {
+       static function isMovable( $index ) {
                return !( $index < NS_MAIN || $index == NS_IMAGE  || $index == NS_CATEGORY );
        }
 
@@ -57,7 +57,7 @@ class Namespace {
         * Check if the given namespace is not a talk page
         * @return bool
         */
-       function isMain( $index ) {
+       static function isMain( $index ) {
                return ! Namespace::isTalk( $index );
        }
 
@@ -73,7 +73,7 @@ class Namespace {
        /**
         * Get the talk namespace corresponding to the given index
         */
-       function getTalk( $index ) {
+       static function getTalk( $index ) {
                if ( Namespace::isTalk( $index ) ) {
                        return $index;
                } else {
@@ -82,7 +82,7 @@ class Namespace {
                }
        }
 
-       function getSubject( $index ) {
+       static function getSubject( $index ) {
                if ( Namespace::isTalk( $index ) ) {
                        return $index - 1;
                } else {
@@ -93,7 +93,7 @@ class Namespace {
        /**
         * Returns the canonical (English Wikipedia) name for a given index
         */
-       function getCanonicalName( $index ) {
+       static function getCanonicalName( $index ) {
                global $wgCanonicalNamespaceNames;
                return $wgCanonicalNamespaceNames[$index];
        }
@@ -102,7 +102,7 @@ class Namespace {
         * Returns the index for a given canonical name, or NULL
         * The input *must* be converted to lower case first
         */
-       function getCanonicalIndex( $name ) {
+       static function getCanonicalIndex( $name ) {
                global $wgCanonicalNamespaceNames;
                static $xNamespaces = false;
                if ( $xNamespaces === false ) {
@@ -122,7 +122,7 @@ class Namespace {
         * Can this namespace ever have a talk namespace?
         * @param $index Namespace index
         */
-        function canTalk( $index ) {
+        static function canTalk( $index ) {
                return( $index >= NS_MAIN );
         }
 }
index e1e415f..c44fca9 100644 (file)
@@ -16,7 +16,7 @@ class Xml {
         * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default)\r
         * @return string\r
         */\r
-       function element( $element, $attribs = null, $contents = '') {\r
+       public static function element( $element, $attribs = null, $contents = '') {\r
                $out = '<' . $element;\r
                if( !is_null( $attribs ) ) {\r
                        foreach( $attribs as $name => $val ) {\r
@@ -45,7 +45,7 @@ class Xml {
         * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default)\r
         * @return string\r
         */\r
-       function elementClean( $element, $attribs = array(), $contents = '') {\r
+       public static function elementClean( $element, $attribs = array(), $contents = '') {\r
                if( $attribs ) {\r
                        $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );\r
                }\r
@@ -67,7 +67,7 @@ class Xml {
         * @param $includehidden Bool: include hidden namespaces?\r
         * @return String: Html string containing the namespace selector\r
         */\r
-       function &namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) {\r
+       public static function &namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) {\r
                global $wgContLang;\r
                if( $selected !== '' ) {\r
                        if( is_null( $selected ) ) {\r
@@ -100,7 +100,7 @@ class Xml {
                return $s;\r
        }\r
 \r
-       function span( $text, $class, $attribs=array() ) {\r
+       public static function span( $text, $class, $attribs=array() ) {\r
                return self::element( 'span', array( 'class' => $class ) + $attribs, $text );\r
        }\r
 \r
@@ -108,7 +108,7 @@ class Xml {
         * Convenience function to build an HTML text input field\r
         * @return string HTML\r
         */\r
-       function input( $name, $size=false, $value=false, $attribs=array() ) {\r
+       public static function input( $name, $size=false, $value=false, $attribs=array() ) {\r
                return self::element( 'input', array(\r
                        'name' => $name,\r
                        'size' => $size,\r
@@ -119,7 +119,7 @@ class Xml {
         * Internal function for use in checkboxes and radio buttons and such.\r
         * @return array\r
         */\r
-       function attrib( $name, $present = true ) {\r
+       public static function attrib( $name, $present = true ) {\r
                return $present ? array( $name => $name ) : array();\r
        }\r
 \r
@@ -127,7 +127,7 @@ class Xml {
         * Convenience function to build an HTML checkbox\r
         * @return string HTML\r
         */\r
-       function check( $name, $checked=false, $attribs=array() ) {\r
+       public static function check( $name, $checked=false, $attribs=array() ) {\r
                return self::element( 'input', array(\r
                        'name' => $name,\r
                        'type' => 'checkbox',\r
@@ -138,7 +138,7 @@ class Xml {
         * Convenience function to build an HTML radio button\r
         * @return string HTML\r
         */\r
-       function radio( $name, $value, $checked=false, $attribs=array() ) {\r
+       public static function radio( $name, $value, $checked=false, $attribs=array() ) {\r
                return self::element( 'input', array(\r
                        'name' => $name,\r
                        'type' => 'radio',\r
@@ -149,7 +149,7 @@ class Xml {
         * Convenience function to build an HTML form label\r
         * @return string HTML\r
         */\r
-       function label( $label, $id ) {\r
+       public static function label( $label, $id ) {\r
                return self::element( 'label', array( 'for' => $id ), $label );\r
        }\r
 \r
@@ -157,7 +157,7 @@ class Xml {
         * Convenience function to build an HTML text input field with a label\r
         * @return string HTML\r
         */\r
-       function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) {\r
+       public static function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) {\r
                return Xml::label( $label, $id ) .\r
                        '&nbsp;' .\r
                        self::input( $name, $size, $value, array( 'id' => $id ) + $attribs );\r
@@ -167,7 +167,7 @@ class Xml {
         * Convenience function to build an HTML checkbox with a label\r
         * @return string HTML\r
         */\r
-       function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) {\r
+       public static function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) {\r
                return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) .\r
                        '&nbsp;' .\r
                        self::label( $label, $id );\r
@@ -177,7 +177,7 @@ class Xml {
         * Convenience function to build an HTML radio button with a label\r
         * @return string HTML\r
         */\r
-       function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) {\r
+       public static function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) {\r
                return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) .\r
                        '&nbsp;' .\r
                        self::label( $label, $id );\r
@@ -189,7 +189,7 @@ class Xml {
         * @param $attribs Array: optional custom attributes\r
         * @return string HTML\r
         */\r
-       function submitButton( $value, $attribs=array() ) {\r
+       public static function submitButton( $value, $attribs=array() ) {\r
                return self::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs );\r
        }\r
 \r
@@ -201,7 +201,7 @@ class Xml {
         * @param $attribs Array: optional custom attributes\r
         * @return string HTML\r
         */\r
-       function hidden( $name, $value, $attribs=array() ) {\r
+       public static function hidden( $name, $value, $attribs=array() ) {\r
                return self::element( 'input', array(\r
                        'name' => $name,\r
                        'type' => 'hidden',\r
@@ -241,7 +241,7 @@ class Xml {
         *\r
         * @todo Error position reporting return\r
         */\r
-       function isWellFormed( $text ) {\r
+       public static function isWellFormed( $text ) {\r
                $parser = xml_parser_create( "UTF-8" );\r
 \r
                # case folding violates XML standard, turn it off\r
@@ -267,7 +267,7 @@ class Xml {
         * @param $text String:\r
         * @return bool\r
         */\r
-       function isWellFormedXmlFragment( $text ) {\r
+       public static function isWellFormedXmlFragment( $text ) {\r
                $html =\r
                        Sanitizer::hackDocType() .\r
                        '<html>' .\r