Index: trunk/phase3/includes/Html.php |
— | — | @@ -191,15 +191,18 @@ |
192 | 192 | 'button', |
193 | 193 | 'search', |
194 | 194 | ); |
| 195 | + |
195 | 196 | if ( isset( $attribs['type'] ) |
196 | 197 | && !in_array( $attribs['type'], $validTypes ) ) { |
197 | 198 | unset( $attribs['type'] ); |
198 | 199 | } |
| 200 | + |
199 | 201 | if ( isset( $attribs['type'] ) && $attribs['type'] == 'search' |
200 | 202 | && !$wgHtml5 ) { |
201 | 203 | unset( $attribs['type'] ); |
202 | 204 | } |
203 | 205 | } |
| 206 | + |
204 | 207 | if ( !$wgHtml5 && $element == 'textarea' && isset( $attribs['maxlength'] ) ) { |
205 | 208 | unset( $attribs['maxlength'] ); |
206 | 209 | } |
— | — | @@ -475,12 +478,15 @@ |
476 | 479 | global $wgHtml5, $wgJsMimeType, $wgWellFormedXml; |
477 | 480 | |
478 | 481 | $attrs = array(); |
| 482 | + |
479 | 483 | if ( !$wgHtml5 ) { |
480 | 484 | $attrs['type'] = $wgJsMimeType; |
481 | 485 | } |
| 486 | + |
482 | 487 | if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) { |
483 | 488 | $contents = "/*<![CDATA[*/$contents/*]]>*/"; |
484 | 489 | } |
| 490 | + |
485 | 491 | return self::rawElement( 'script', $attrs, $contents ); |
486 | 492 | } |
487 | 493 | |
— | — | @@ -495,9 +501,11 @@ |
496 | 502 | global $wgHtml5, $wgJsMimeType; |
497 | 503 | |
498 | 504 | $attrs = array( 'src' => $url ); |
| 505 | + |
499 | 506 | if ( !$wgHtml5 ) { |
500 | 507 | $attrs['type'] = $wgJsMimeType; |
501 | 508 | } |
| 509 | + |
502 | 510 | return self::element( 'script', $attrs ); |
503 | 511 | } |
504 | 512 | |
— | — | @@ -516,6 +524,7 @@ |
517 | 525 | if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) { |
518 | 526 | $contents = "/*<![CDATA[*/$contents/*]]>*/"; |
519 | 527 | } |
| 528 | + |
520 | 529 | return self::rawElement( 'style', array( |
521 | 530 | 'type' => 'text/css', |
522 | 531 | 'media' => $media, |
— | — | @@ -587,15 +596,19 @@ |
588 | 597 | */ |
589 | 598 | public static function textarea( $name, $value = '', $attribs = array() ) { |
590 | 599 | global $wgHtml5; |
| 600 | + |
591 | 601 | $attribs['name'] = $name; |
| 602 | + |
592 | 603 | if ( !$wgHtml5 ) { |
593 | 604 | if ( !isset( $attribs['cols'] ) ) { |
594 | 605 | $attribs['cols'] = ""; |
595 | 606 | } |
| 607 | + |
596 | 608 | if ( !isset( $attribs['rows'] ) ) { |
597 | 609 | $attribs['rows'] = ""; |
598 | 610 | } |
599 | 611 | } |
| 612 | + |
600 | 613 | return self::element( 'textarea', $attribs, $value ); |
601 | 614 | } |
602 | 615 | |
— | — | @@ -611,29 +624,37 @@ |
612 | 625 | $ret = ''; |
613 | 626 | |
614 | 627 | global $wgMimeType; |
| 628 | + |
615 | 629 | if ( self::isXmlMimeType( $wgMimeType ) ) { |
616 | 630 | $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n"; |
617 | 631 | } |
618 | 632 | |
619 | 633 | global $wgHtml5, $wgHtml5Version, $wgDocType, $wgDTD; |
620 | 634 | global $wgXhtmlNamespaces, $wgXhtmlDefaultNamespace; |
| 635 | + |
621 | 636 | if ( $wgHtml5 ) { |
622 | 637 | $ret .= "<!DOCTYPE html>\n"; |
| 638 | + |
623 | 639 | if ( $wgHtml5Version ) { |
624 | 640 | $attribs['version'] = $wgHtml5Version; |
625 | 641 | } |
626 | 642 | } else { |
627 | 643 | $ret .= "<!DOCTYPE html PUBLIC \"$wgDocType\" \"$wgDTD\">\n"; |
628 | 644 | $attribs['xmlns'] = $wgXhtmlDefaultNamespace; |
| 645 | + |
629 | 646 | foreach ( $wgXhtmlNamespaces as $tag => $ns ) { |
630 | 647 | $attribs["xmlns:$tag"] = $ns; |
631 | 648 | } |
632 | 649 | } |
| 650 | + |
633 | 651 | $html = Html::openElement( 'html', $attribs ); |
| 652 | + |
634 | 653 | if ( $html ) { |
635 | 654 | $html .= "\n"; |
636 | 655 | } |
| 656 | + |
637 | 657 | $ret .= $html; |
| 658 | + |
638 | 659 | return $ret; |
639 | 660 | } |
640 | 661 | |
— | — | @@ -653,7 +674,7 @@ |
654 | 675 | return false; |
655 | 676 | } |
656 | 677 | } |
657 | | - |
| 678 | + |
658 | 679 | /** |
659 | 680 | * Get HTML for an info box with an icon. |
660 | 681 | * |
— | — | @@ -667,14 +688,13 @@ |
668 | 689 | */ |
669 | 690 | static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) { |
670 | 691 | global $wgStylePath; |
671 | | - |
| 692 | + |
672 | 693 | if ( $useStylePath ) { |
673 | 694 | $icon = $wgStylePath.'/common/images/'.$icon; |
674 | 695 | } |
675 | | - |
676 | | - |
| 696 | + |
677 | 697 | $s = Xml::openElement( 'div', array( 'class' => "mw-infobox $class") ); |
678 | | - |
| 698 | + |
679 | 699 | $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ). |
680 | 700 | Html::element( 'img', |
681 | 701 | array( |
— | — | @@ -692,8 +712,7 @@ |
693 | 713 | $s .= Xml::closeElement( 'div' ); |
694 | 714 | |
695 | 715 | $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' ); |
696 | | - |
| 716 | + |
697 | 717 | return $s; |
698 | 718 | } |
699 | | - |
700 | 719 | } |