r108708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108707‎ | r108708 | r108709 >
Date:05:04, 12 January 2012
Author:yaron
Status:ok
Tags:
Comment:
Removed backward compatibility for MW < 1.16, replaced some hardcoded HTML with calls to the Html class
Modified paths:
  • /trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php
@@ -15,10 +15,6 @@
1616 */
1717 public function __construct() {
1818 parent::__construct( 'BrowseData' );
19 - // Backwards compatibility for MediaWiki < 1.16
20 - if ( version_compare( $GLOBALS['wgVersion'], '1.16', '<' ) ) {
21 - wfLoadExtensionMessages( 'SemanticDrilldown' );
22 - }
2319 }
2420
2521 function execute( $query ) {
@@ -601,8 +597,7 @@
602598
603599 /**
604600 * Adds Javascript and CSS to the page for comboboxes, the long way.
605 - * This method exists for backward compatibiity for MediaWiki 1.16
606 - * and earlier.
 601+ * This method exists for backward compatibiity for MediaWiki 1.16.
607602 */
608603 function addJavascriptAndCSS() {
609604 global $smwgJQueryIncluded, $smwgJQueryUIIncluded, $sdgScriptPath, $wgOut;
@@ -669,7 +664,7 @@
670665 foreach ( $filter_values as $value => $num_instances ) {
671666 if ( $value != '_other' && $value != '_none' ) {
672667 $display_value = str_replace( '_', ' ', $value );
673 - $text .= ' <option value="'.$display_value.'">'.$display_value.'</option>';
 668+ $text .= "\t\t" . Html::element( 'option', array( 'value' => $display_value ), $display_value ) . "\n";
674669 }
675670 }
676671
@@ -680,18 +675,12 @@
681676 END;
682677
683678 foreach ( $wgRequest->getValues() as $key => $val ) {
684 - if ( $key != $input_id )
685 - $text .= <<<END
686 - <input type="hidden" name="$key" value="$val" />
687 -
688 -END;
 679+ if ( $key != $input_id ) {
 680+ $text .= Html::hidden( $key, $val ) . "\n";
 681+ }
689682 }
690 - $search_label = wfMsg( 'searchresultshead' );
691 - $text .= <<<END
692 - <input type="submit" value="$search_label" />
693 -</form>
694 -
695 -END;
 683+ $text .= Html::input( null, wfMsg( 'searchresultshead' ), 'submit' ) . "\n";
 684+ $text .= "</form>\n";
696685 return $text;
697686 }
698687
@@ -744,17 +733,11 @@
745734
746735 END;
747736 foreach ( $wgRequest->getValues() as $key => $val ) {
748 - $text .= <<<END
749 -<input type="hidden" name="$key" value="$val" />
750 -
751 -END;
 737+ $text .= Html::hidden( $key, $val ) . "\n";
752738 }
753 - $search_label = wfMsg( 'searchresultshead' );
754 - $text .= <<<END
755 -<p><input type="submit" value="$search_label" /></p>
756 -</form>
757 -
758 -END;
 739+ $submitButton = Html::input( null, wfMsg( 'searchresultshead' ), 'submit' );
 740+ $text .= Html::rawElement( 'p', null, $submitButton ) . "\n";
 741+ $text .= "</form>\n";
759742 return $text;
760743 }
761744
@@ -1114,12 +1097,7 @@
11151098 global $wgParser;
11161099 SMWOutputs::commitToParser( $wgParser );
11171100 if ( ! is_null( $wgParser->mOutput ) ) {
1118 - // getHeadItems() was added in MW 1.16
1119 - if ( method_exists( $wgParser->getOutput(), 'getHeadItems' ) ) {
1120 - $headItems = $wgParser->getOutput()->getHeadItems();
1121 - } else {
1122 - $headItems = $wgParser->getOutput()->mHeadItems;
1123 - }
 1101+ $headItems = $wgParser->getOutput()->getHeadItems();
11241102 foreach ( $headItems as $key => $item ) {
11251103 $out->addHeadItem( $key, $item );
11261104 }

Status & tagging log