r89261 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89260‎ | r89261 | r89262 >
Date:14:12, 1 June 2011
Author:siebrand
Status:ok
Tags:
Comment:
Whitespace updates.
Modified paths:
  • /trunk/phase3/includes/Html.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Html.php
@@ -191,15 +191,18 @@
192192 'button',
193193 'search',
194194 );
 195+
195196 if ( isset( $attribs['type'] )
196197 && !in_array( $attribs['type'], $validTypes ) ) {
197198 unset( $attribs['type'] );
198199 }
 200+
199201 if ( isset( $attribs['type'] ) && $attribs['type'] == 'search'
200202 && !$wgHtml5 ) {
201203 unset( $attribs['type'] );
202204 }
203205 }
 206+
204207 if ( !$wgHtml5 && $element == 'textarea' && isset( $attribs['maxlength'] ) ) {
205208 unset( $attribs['maxlength'] );
206209 }
@@ -475,12 +478,15 @@
476479 global $wgHtml5, $wgJsMimeType, $wgWellFormedXml;
477480
478481 $attrs = array();
 482+
479483 if ( !$wgHtml5 ) {
480484 $attrs['type'] = $wgJsMimeType;
481485 }
 486+
482487 if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
483488 $contents = "/*<![CDATA[*/$contents/*]]>*/";
484489 }
 490+
485491 return self::rawElement( 'script', $attrs, $contents );
486492 }
487493
@@ -495,9 +501,11 @@
496502 global $wgHtml5, $wgJsMimeType;
497503
498504 $attrs = array( 'src' => $url );
 505+
499506 if ( !$wgHtml5 ) {
500507 $attrs['type'] = $wgJsMimeType;
501508 }
 509+
502510 return self::element( 'script', $attrs );
503511 }
504512
@@ -516,6 +524,7 @@
517525 if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
518526 $contents = "/*<![CDATA[*/$contents/*]]>*/";
519527 }
 528+
520529 return self::rawElement( 'style', array(
521530 'type' => 'text/css',
522531 'media' => $media,
@@ -587,15 +596,19 @@
588597 */
589598 public static function textarea( $name, $value = '', $attribs = array() ) {
590599 global $wgHtml5;
 600+
591601 $attribs['name'] = $name;
 602+
592603 if ( !$wgHtml5 ) {
593604 if ( !isset( $attribs['cols'] ) ) {
594605 $attribs['cols'] = "";
595606 }
 607+
596608 if ( !isset( $attribs['rows'] ) ) {
597609 $attribs['rows'] = "";
598610 }
599611 }
 612+
600613 return self::element( 'textarea', $attribs, $value );
601614 }
602615
@@ -611,29 +624,37 @@
612625 $ret = '';
613626
614627 global $wgMimeType;
 628+
615629 if ( self::isXmlMimeType( $wgMimeType ) ) {
616630 $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
617631 }
618632
619633 global $wgHtml5, $wgHtml5Version, $wgDocType, $wgDTD;
620634 global $wgXhtmlNamespaces, $wgXhtmlDefaultNamespace;
 635+
621636 if ( $wgHtml5 ) {
622637 $ret .= "<!DOCTYPE html>\n";
 638+
623639 if ( $wgHtml5Version ) {
624640 $attribs['version'] = $wgHtml5Version;
625641 }
626642 } else {
627643 $ret .= "<!DOCTYPE html PUBLIC \"$wgDocType\" \"$wgDTD\">\n";
628644 $attribs['xmlns'] = $wgXhtmlDefaultNamespace;
 645+
629646 foreach ( $wgXhtmlNamespaces as $tag => $ns ) {
630647 $attribs["xmlns:$tag"] = $ns;
631648 }
632649 }
 650+
633651 $html = Html::openElement( 'html', $attribs );
 652+
634653 if ( $html ) {
635654 $html .= "\n";
636655 }
 656+
637657 $ret .= $html;
 658+
638659 return $ret;
639660 }
640661
@@ -653,7 +674,7 @@
654675 return false;
655676 }
656677 }
657 -
 678+
658679 /**
659680 * Get HTML for an info box with an icon.
660681 *
@@ -667,14 +688,13 @@
668689 */
669690 static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) {
670691 global $wgStylePath;
671 -
 692+
672693 if ( $useStylePath ) {
673694 $icon = $wgStylePath.'/common/images/'.$icon;
674695 }
675 -
676 -
 696+
677697 $s = Xml::openElement( 'div', array( 'class' => "mw-infobox $class") );
678 -
 698+
679699 $s .= Xml::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ).
680700 Html::element( 'img',
681701 array(
@@ -692,8 +712,7 @@
693713 $s .= Xml::closeElement( 'div' );
694714
695715 $s .= Xml::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
696 -
 716+
697717 return $s;
698718 }
699 -
700719 }

Status & tagging log