Merge "Add framework for file warnings"
[lhc/web/wiklou.git] / includes / Html.php
index 93a1a04..8799225 100644 (file)
@@ -141,16 +141,17 @@ class Html {
                if ( !$attrs ) {
                        $attrs = array();
                }
-               if ( isset( $attrs['class'] ) ) {
-                       if ( is_array( $attrs['class'] ) ) {
-                               $attrs['class'][] = 'mw-ui-input';
+               if ( $wgUseMediaWikiUIEverywhere ) {
+                       if ( isset( $attrs['class'] ) ) {
+                               if ( is_array( $attrs['class'] ) ) {
+                                       $attrs['class'][] = 'mw-ui-input';
+                               } else {
+                                       $attrs['class'] .= ' mw-ui-input';
+                               }
                        } else {
-                               $attrs['class'] .= ' mw-ui-input';
+                               $attrs['class'] = 'mw-ui-input';
                        }
-               } else {
-                       $attrs['class'] = 'mw-ui-input';
-               }
-               if ( $wgUseMediaWikiUIEverywhere ) {
+
                        // Note that size can effect the desired width rendering of mw-ui-input elements
                        // so it is removed. Left intact when mediawiki ui not enabled.
                        unset( $attrs['size'] );
@@ -159,7 +160,8 @@ class Html {
        }
 
        /**
-        * Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled).
+        * Returns an HTML link element in a string styled as a button
+        * (when $wgUseMediaWikiUIEverywhere is enabled).
         *
         * @param string $contents The raw HTML contents of the element: *not*
         *   escaped!
@@ -178,7 +180,8 @@ class Html {
        }
 
        /**
-        * Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled).
+        * Returns an HTML link element in a string styled as a button
+        * (when $wgUseMediaWikiUIEverywhere is enabled).
         *
         * @param string $contents The raw HTML contents of the element: *not*
         *   escaped!
@@ -257,19 +260,11 @@ class Html {
         * @return string
         */
        public static function openElement( $element, $attribs = array() ) {
-               global $wgWellFormedXml;
                $attribs = (array)$attribs;
                // This is not required in HTML5, but let's do it anyway, for
                // consistency and better compression.
                $element = strtolower( $element );
 
-               // In text/html, initial <html> and <head> tags can be omitted under
-               // pretty much any sane circumstances, if they have no attributes.  See:
-               // <http://www.whatwg.org/html/syntax.html#optional-tags>
-               if ( !$wgWellFormedXml && !$attribs && in_array( $element, array( 'html', 'head' ) ) ) {
-                       return '';
-               }
-
                // Remove invalid input types
                if ( $element == 'input' ) {
                        $validTypes = array(