r95729 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95728‎ | r95729 | r95730 >
Date:23:55, 29 August 2011
Author:preilly
Status:ok (Comments)
Tags:
Comment:
use the html class to create raw elements
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -65,7 +65,7 @@
6666 );
6767
6868 class ExtMobileFrontend {
69 - const VERSION = '0.5.48';
 69+ const VERSION = '0.5.49';
7070
7171 /**
7272 * @var DOMDocument
@@ -522,18 +522,39 @@
523523 $backToTop = self::$messages['mobile-frontend-back-to-top-of-section'];
524524 ++$headings;
525525 // Back to top link
526 - $base = "<div class='section_anchors' id='anchor_" . intval( $headings - 1 ) .
527 - "'><a href='#section_" . intval( $headings - 1 ) .
528 - "' class='back_to_top'>&#8593; {$backToTop}</a></div>";
 526+ $base = Html::openElement( 'div',
 527+ array( 'id' => 'anchor_' . intval( $headings - 1 ),
 528+ 'class' => 'section_anchors', )
 529+ ) .
 530+ Html::rawElement( 'a',
 531+ array( 'href' => '#section_' . intval( $headings - 1 ),
 532+ 'class' => 'back_to_top' ),
 533+ '&#8593;' . $backToTop ) .
 534+ Html::closeElement( 'div' );
529535 // generate the HTML we are going to inject
530 - $buttons = "<button class='section_heading show' section_id='{$headings}'>{$show}</button>" .
531 - "<button class='section_heading hide' section_id='{$headings}'>{$hide}</button>";
532 - $base .= "<h2 class='section_heading' id='section_{$headings}'{$matches[1]}{$buttons} <span id='{$headlineId}'>" .
533 - "{$matches[2]}</span></h2><div class='content_block' id='content_{$headings}'>";
 536+ $buttons = Html::element( 'button',
 537+ array('class' => 'section_heading show',
 538+ 'section_id' => $headings ),
 539+ $show ) .
 540+ Html::element( 'button',
 541+ array('class' => 'section_heading hide',
 542+ 'section_id' => $headings ),
 543+ $hide );
 544+ $base .= Html::openElement( 'h2',
 545+ array('class' => 'section_heading',
 546+ 'id' => 'section_' . $headings) ) .
 547+ $buttons .
 548+ Html::element( 'span',
 549+ array( 'id' => $headlineId),
 550+ $matches[2] ) .
 551+ Html::closeElement( 'h2' ) .
 552+ Html::openElement( 'div',
 553+ array('class' => 'content_block',
 554+ 'id' => 'content_' . $headings) );
534555
535556 if ( $headings > 1 ) {
536557 // Close it up here
537 - $base = '</div>' . $base;
 558+ $base = Html::closeElement( 'div' ) . $base;
538559 }
539560
540561 self::$headings = $headings;

Comments

#Comment by MZMcBride (talk | contribs)   01:16, 30 August 2011

Indentation is strange here. It's almost cascading...

Status & tagging log