From 89d2c02702ceb83a714e2e8bb1f8bef615328b03 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 10 Jul 2006 18:53:15 +0000 Subject: [PATCH] Adding some more static statements --- includes/Namespace.php | 14 +++++++------- includes/Xml.php | 32 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/includes/Namespace.php b/includes/Namespace.php index 422a28007f..73dc296930 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -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 ); } } diff --git a/includes/Xml.php b/includes/Xml.php index e1e415f28d..c44fca9cc0 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -16,7 +16,7 @@ class Xml { * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default) * @return string */ - function element( $element, $attribs = null, $contents = '') { + public static function element( $element, $attribs = null, $contents = '') { $out = '<' . $element; if( !is_null( $attribs ) ) { foreach( $attribs as $name => $val ) { @@ -45,7 +45,7 @@ class Xml { * @param $contents String: NULL to make an open tag only; '' for a contentless closed tag (default) * @return string */ - function elementClean( $element, $attribs = array(), $contents = '') { + public static function elementClean( $element, $attribs = array(), $contents = '') { if( $attribs ) { $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs ); } @@ -67,7 +67,7 @@ class Xml { * @param $includehidden Bool: include hidden namespaces? * @return String: Html string containing the namespace selector */ - function &namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) { + public static function &namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) { global $wgContLang; if( $selected !== '' ) { if( is_null( $selected ) ) { @@ -100,7 +100,7 @@ class Xml { return $s; } - function span( $text, $class, $attribs=array() ) { + public static function span( $text, $class, $attribs=array() ) { return self::element( 'span', array( 'class' => $class ) + $attribs, $text ); } @@ -108,7 +108,7 @@ class Xml { * Convenience function to build an HTML text input field * @return string HTML */ - function input( $name, $size=false, $value=false, $attribs=array() ) { + public static function input( $name, $size=false, $value=false, $attribs=array() ) { return self::element( 'input', array( 'name' => $name, 'size' => $size, @@ -119,7 +119,7 @@ class Xml { * Internal function for use in checkboxes and radio buttons and such. * @return array */ - function attrib( $name, $present = true ) { + public static function attrib( $name, $present = true ) { return $present ? array( $name => $name ) : array(); } @@ -127,7 +127,7 @@ class Xml { * Convenience function to build an HTML checkbox * @return string HTML */ - function check( $name, $checked=false, $attribs=array() ) { + public static function check( $name, $checked=false, $attribs=array() ) { return self::element( 'input', array( 'name' => $name, 'type' => 'checkbox', @@ -138,7 +138,7 @@ class Xml { * Convenience function to build an HTML radio button * @return string HTML */ - function radio( $name, $value, $checked=false, $attribs=array() ) { + public static function radio( $name, $value, $checked=false, $attribs=array() ) { return self::element( 'input', array( 'name' => $name, 'type' => 'radio', @@ -149,7 +149,7 @@ class Xml { * Convenience function to build an HTML form label * @return string HTML */ - function label( $label, $id ) { + public static function label( $label, $id ) { return self::element( 'label', array( 'for' => $id ), $label ); } @@ -157,7 +157,7 @@ class Xml { * Convenience function to build an HTML text input field with a label * @return string HTML */ - function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) { + public static function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array() ) { return Xml::label( $label, $id ) . ' ' . self::input( $name, $size, $value, array( 'id' => $id ) + $attribs ); @@ -167,7 +167,7 @@ class Xml { * Convenience function to build an HTML checkbox with a label * @return string HTML */ - function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) { + public static function checkLabel( $label, $name, $id, $checked=false, $attribs=array() ) { return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) . ' ' . self::label( $label, $id ); @@ -177,7 +177,7 @@ class Xml { * Convenience function to build an HTML radio button with a label * @return string HTML */ - function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) { + public static function radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array() ) { return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) . ' ' . self::label( $label, $id ); @@ -189,7 +189,7 @@ class Xml { * @param $attribs Array: optional custom attributes * @return string HTML */ - function submitButton( $value, $attribs=array() ) { + public static function submitButton( $value, $attribs=array() ) { return self::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs ); } @@ -201,7 +201,7 @@ class Xml { * @param $attribs Array: optional custom attributes * @return string HTML */ - function hidden( $name, $value, $attribs=array() ) { + public static function hidden( $name, $value, $attribs=array() ) { return self::element( 'input', array( 'name' => $name, 'type' => 'hidden', @@ -241,7 +241,7 @@ class Xml { * * @todo Error position reporting return */ - function isWellFormed( $text ) { + public static function isWellFormed( $text ) { $parser = xml_parser_create( "UTF-8" ); # case folding violates XML standard, turn it off @@ -267,7 +267,7 @@ class Xml { * @param $text String: * @return bool */ - function isWellFormedXmlFragment( $text ) { + public static function isWellFormedXmlFragment( $text ) { $html = Sanitizer::hackDocType() . '' . -- 2.20.1