From 510add5a5c48f536f1376e7038c0b18e2fbedd9a Mon Sep 17 00:00:00 2001 From: Rob Church Date: Mon, 25 Jun 2007 11:09:51 +0000 Subject: [PATCH] Clean up the mess that is Xml::monthSelector()... * Use accessors instead of direct access to static members * Use existing XML functions to make life easier and guarantee clean XHTML * Drop the useless class (use the ID in CSS) --- includes/Xml.php | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/includes/Xml.php b/includes/Xml.php index c31a077fba..c5c60cb020 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -131,28 +131,18 @@ class Xml { * @param $allmonths String: value of a special item denoting all month. Null to not include (default) * @return String: Html string containing the month selector */ - public static function monthSelector($selected = '', $allmonths = null) { + public static function monthSelector( $selected = '', $allmonths = null ) { + global $wgLang; + $options = array(); if( is_null( $selected ) ) $selected = ''; - $s = "\n\n"; - return $s; + if( !is_null( $allmonths ) ) + $options[] = self::option( wfMsg( 'monthsall' ), $allmonths, $selected === $allmonths ); + for( $i = 1; $i < 13; $i++ ) + $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i ); + return self::openElement( 'select', array( 'id' => 'month', 'name' => 'month' ) ) + . implode( "\n", $options ) + . self::closeElement( 'select' ); } /** -- 2.20.1