Merge "Remove redirectToFragment() from wikibits.js"
[lhc/web/wiklou.git] / includes / Xml.php
index d5501fe..3b82c64 100644 (file)
@@ -195,8 +195,9 @@ class Xml {
                if ( $year ) {
                        $encYear = intval( $year );
                } elseif ( $encMonth ) {
-                       $thisMonth = intval( gmdate( 'n' ) );
-                       $thisYear = intval( gmdate( 'Y' ) );
+                       $timestamp = MWTimestamp::getInstance();
+                       $thisMonth = intval( $timestamp->format( 'n' ) );
+                       $thisYear = intval( $timestamp->format( 'Y' ) );
                        if ( intval( $encMonth ) > $thisMonth ) {
                                $thisYear--;
                        }
@@ -499,34 +500,34 @@ class Xml {
                $options = self::option( $other, 'other', $selected === 'other' );
 
                foreach ( explode( "\n", $list ) as $option ) {
-                               $value = trim( $option );
-                               if ( $value == '' ) {
-                                       continue;
-                               } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
-                                       // A new group is starting ...
-                                       $value = trim( substr( $value, 1 ) );
-                                       if ( $optgroup ) {
-                                               $options .= self::closeElement( 'optgroup' );
-                                       }
-                                       $options .= self::openElement( 'optgroup', array( 'label' => $value ) );
-                                       $optgroup = true;
-                               } elseif ( substr( $value, 0, 2 ) == '**' ) {
-                                       // groupmember
-                                       $value = trim( substr( $value, 2 ) );
-                                       $options .= self::option( $value, $value, $selected === $value );
-                               } else {
-                                       // groupless reason list
-                                       if ( $optgroup ) {
-                                               $options .= self::closeElement( 'optgroup' );
-                                       }
-                                       $options .= self::option( $value, $value, $selected === $value );
-                                       $optgroup = false;
+                       $value = trim( $option );
+                       if ( $value == '' ) {
+                               continue;
+                       } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
+                               // A new group is starting ...
+                               $value = trim( substr( $value, 1 ) );
+                               if ( $optgroup ) {
+                                       $options .= self::closeElement( 'optgroup' );
                                }
+                               $options .= self::openElement( 'optgroup', array( 'label' => $value ) );
+                               $optgroup = true;
+                       } elseif ( substr( $value, 0, 2 ) == '**' ) {
+                               // groupmember
+                               $value = trim( substr( $value, 2 ) );
+                               $options .= self::option( $value, $value, $selected === $value );
+                       } else {
+                               // groupless reason list
+                               if ( $optgroup ) {
+                                       $options .= self::closeElement( 'optgroup' );
+                               }
+                               $options .= self::option( $value, $value, $selected === $value );
+                               $optgroup = false;
                        }
+               }
 
-                       if ( $optgroup ) {
-                               $options .= self::closeElement( 'optgroup' );
-                       }
+               if ( $optgroup ) {
+                       $options .= self::closeElement( 'optgroup' );
+               }
 
                $attribs = array();
 
@@ -900,7 +901,7 @@ class XmlSelect {
         * label => value
         * label => ( label => value, label => value )
         *
-        * @param  $options
+        * @param $options
         */
        public function addOptions( $options ) {
                $this->options[] = $options;
@@ -911,7 +912,7 @@ class XmlSelect {
         * label => value
         * label => ( label => value, label => value )
         *
-        * @param  $options
+        * @param $options
         * @param bool $default
         * @return string
         */