r96343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96342‎ | r96343 | r96344 >
Date:15:27, 6 September 2011
Author:dantman
Status:resolved
Tags:
Comment:
Small MonoBook cleanup:
* Eliminate the unnecessary ->skin and $skin, $this->skin is only used in one spot and we have getSkin()
* Linker::tooltipAndAccesskeyAttribs isn't &, don't + it to an empty array(), just use a short inline array instead of this var
* Elimiate all this unnecessary code in cactions and just use makeListItem. It's shorter, outputs everything this code does, AND it outputs rel="archive" on history which was missing from MonoBook.
Modified paths:
  • /trunk/phase3/skins/MonoBook.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/MonoBook.php
@@ -54,11 +54,6 @@
5555 class MonoBookTemplate extends BaseTemplate {
5656
5757 /**
58 - * @var Skin
59 - */
60 - var $skin;
61 -
62 - /**
6358 * Template filter callback for MonoBook skin.
6459 * Takes an associative array of data set from a SkinTemplate-based
6560 * class, and a wrapper for MediaWiki's localization database, and
@@ -67,8 +62,6 @@
6863 * @access private
6964 */
7065 function execute() {
71 - $this->skin = $this->data['skin'];
72 -
7366 // Suppress warnings to prevent notices about missing indexes in $this->data
7467 wfSuppressWarnings();
7568
@@ -111,12 +104,11 @@
112105 </div>
113106 </div>
114107 <div class="portlet" id="p-logo">
115 - <?php
116 - $logoAttribs = array() + Linker::tooltipAndAccesskeyAttribs('p-logo');
117 - $logoAttribs['style'] = "background-image: url({$this->data['logopath']});";
118 - $logoAttribs['href'] = $this->data['nav_urls']['mainpage']['href'];
119 - echo Html::element( 'a', $logoAttribs );
120 - ?>
 108+<?php
 109+ echo Html::element( 'a', array(
 110+ 'href' => $this->data['nav_urls']['mainpage']['href'],
 111+ 'style' => "background-image: url({$this->data['logopath']});" )
 112+ + Linker::tooltipAndAccesskeyAttribs('p-logo') ); ?>
121113
122114 </div>
123115 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
@@ -139,7 +131,7 @@
140132 foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?>
141133 <div id="f-<?php echo htmlspecialchars($blockName); ?>ico">
142134 <?php foreach ( $footerIcons as $icon ) { ?>
143 - <?php echo $this->skin->makeFooterIcon( $icon ); ?>
 135+ <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?>
144136
145137 <?php }
146138 ?>
@@ -227,25 +219,8 @@
228220 <div class="pBody">
229221 <ul><?php
230222 foreach($this->data['content_actions'] as $key => $tab) {
231 - $linkAttribs = array( 'href' => $tab['href'] );
232 -
233 - if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
234 - $title = Linker::titleAttrib( "ca-$key" );
235 - if ( $title !== false ) {
236 - $linkAttribs['title'] = $title;
237 - }
238 - } else {
239 - $linkAttribs += Linker::tooltipAndAccesskeyAttribs( "ca-$key" );
240 - }
241 - $linkHtml = Html::element( 'a', $linkAttribs, $tab['text'] );
242 -
243 - /* Surround with a <li> */
244 - $liAttribs = array( 'id' => Sanitizer::escapeId( "ca-$key" ) );
245 - if( $tab['class'] ) {
246 - $liAttribs['class'] = $tab['class'];
247 - }
248 - echo '
249 - ' . Html::rawElement( 'li', $liAttribs, $linkHtml );
 223+ echo '
 224+ ' . $this->makeListItem( $key, $tab );
250225 } ?>
251226
252227 </ul>

Follow-up revisions

RevisionCommit summaryAuthorDate
r96361-rakkaus/#mediawiki-i18n- [06-Sep-2011 19:12:04] PHP Fatal error: Call to a ...reedy19:20, 6 September 2011

Status & tagging log