Merge "Add a test for named vs. positional parameter whitespace stripping"
[lhc/web/wiklou.git] / includes / Xml.php
index 120312d..67f3658 100644 (file)
@@ -59,6 +59,7 @@ class Xml {
         * The values are passed to Sanitizer::encodeAttribute.
         * Return null if no attributes given.
         * @param $attribs Array of attributes for an XML element
+        * @throws MWException
         * @return null|string
         */
        public static function expandAttributes( $attribs ) {
@@ -198,15 +199,16 @@ class Xml {
                } else {
                        $encYear = '';
                }
-               return Xml::label( wfMessage( 'year' )->text(), 'year' ) . ' '.
-                       Xml::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) . ' '.
-                       Xml::label( wfMessage( 'month' )->text(), 'month' ) . ' '.
-                       Xml::monthSelector( $encMonth, -1 );
+               $inputAttribs = array( 'id' => 'year', 'maxlength' => 4, 'size' => 7 );
+               return self::label( wfMessage( 'year' )->text(), 'year' ) . ' '.
+                       Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' '.
+                       self::label( wfMessage( 'month' )->text(), 'month' ) . ' '.
+                       self::monthSelector( $encMonth, -1 );
        }
 
        /**
         * Construct a language selector appropriate for use in a form or preferences
-        * 
+        *
         * @param string $selected The language code of the selected language
         * @param boolean $customisedOnly If true only languages which have some content are listed
         * @param string $inLanguage The ISO code of the language to display the select list in (optional)
@@ -574,7 +576,8 @@ class Xml {
         */
        public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = array() ) {
                return self::element( 'textarea',
-                                       array(  'name' => $name,
+                                       array(
+                                               'name' => $name,
                                                'id' => $name,
                                                'cols' => $cols,
                                                'rows' => $rows