Merge "Specify licence of mediawiki ontology.owl"
[lhc/web/wiklou.git] / includes / Html.php
index d066eff..61785d5 100644 (file)
@@ -213,7 +213,7 @@ class Html {
                        // Silly XML.
                        return substr( $start, 0, -1 ) . '/>';
                } else {
-                       return "$start$contents" . self::closeElement( $element );
+                       return $start . $contents . self::closeElement( $element );
                }
        }
 
@@ -255,6 +255,12 @@ class Html {
                // consistency and better compression.
                $element = strtolower( $element );
 
+               // Some people were abusing this by passing things like
+               // 'h1 id="foo" to $element, which we don't want.
+               if ( strpos( $element, ' ' ) !== false ) {
+                       wfWarn( __METHOD__ . " given element name with space '$element'" );
+               }
+
                // Remove invalid input types
                if ( $element == 'input' ) {
                        $validTypes = [
@@ -967,7 +973,7 @@ class Html {
                if ( $isXHTML ) { // XHTML5
                        // XML MIME-typed markup should have an xml header.
                        // However a DOCTYPE is not needed.
-                       $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
+                       $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
 
                        // Add the standard xmlns
                        $attribs['xmlns'] = 'http://www.w3.org/1999/xhtml';
@@ -977,7 +983,6 @@ class Html {
                                $attribs["xmlns:$tag"] = $ns;
                        }
                } else { // HTML5
-                       // DOCTYPE
                        $ret .= "<!DOCTYPE html>\n";
                }