r39082 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39081‎ | r39082 | r39083 >
Date:20:10, 10 August 2008
Author:brion
Status:old
Tags:
Comment:
More style cleanup -- encapsulate the page name class along with the naemspace classes.
* Reduce code duplication
* Fix Modern class since my last commit
* Update offline skin for DumpHTML
Modified paths:
  • /trunk/extensions/DumpHTML/SkinOffline.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/skins/Modern.php (modified) (history)
  • /trunk/phase3/skins/MonoBook.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/MonoBook.php
@@ -104,7 +104,7 @@
105105 </head>
106106 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
107107 <?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
108 - class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
 108+ class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
109109 <div id="globalWrapper">
110110 <div id="column-content">
111111 <div id="content">
Index: trunk/phase3/skins/Modern.php
@@ -95,7 +95,7 @@
9696 </head>
9797 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
9898 <?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
99 - class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('talkclass') ?> <?php $this->text('skinnameclass') ?>">
 99+ class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
100100
101101 <!-- heading -->
102102 <div id="mw_header"><h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1></div>
Index: trunk/phase3/includes/SkinTemplate.php
@@ -191,7 +191,7 @@
192192 $tpl->set( 'title', $wgOut->getPageTitle() );
193193 $tpl->set( 'pagetitle', $wgOut->getHTMLTitle() );
194194 $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle );
195 - $tpl->set( 'pageclass', Sanitizer::escapeClass( 'page-'.$this->mTitle->getPrefixedText() ) );
 195+ $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) );
196196 $tpl->set( 'skinnameclass', ( "skin-" . Sanitizer::escapeClass( $this->getSkinName ( ) ) ) );
197197
198198 $nsname = isset( $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] ) ?
@@ -254,7 +254,6 @@
255255 $tpl->set( 'handheld', $wgRequest->getBool( 'handheld' ) );
256256 $tpl->set( 'csslinks', $this->buildCssLinks() );
257257 $tpl->setRef( 'loggedin', $this->loggedin );
258 - $tpl->set( 'nsclass', $this->getNamespaceClasses( $this->mTitle ) );
259258 $tpl->set('notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL);
260259 /* XXX currently unused, might get useful later
261260 $tpl->set( "editable", ($this->mTitle->getNamespace() != NS_SPECIAL ) );
Index: trunk/phase3/includes/Skin.php
@@ -589,14 +589,13 @@
590590 $a['onload'] = $wgOut->getOnloadHandler();
591591 $a['class'] =
592592 'mediawiki' .
593 - ' '.$this->getNamespaceClasses( $wgTitle ) .
594593 ' '.( $wgContLang->isRTL() ? "rtl" : "ltr" ).
595 - ' '.Sanitizer::escapeClass( 'page-'.$wgTitle->getPrefixedText() ).
 594+ ' '.$this->getPageClasses( $wgTitle ) .
596595 ' skin-'. Sanitizer::escapeClass( $this->getSkinName( ) );
597596 return $a;
598597 }
599598
600 - function getNamespaceClasses( $title ) {
 599+ function getPageClasses( $title ) {
601600 $numeric = 'ns-'.$title->getNamespace();
602601 if( $title->getNamespace() == NS_SPECIAL ) {
603602 $type = "ns-special";
@@ -605,7 +604,8 @@
606605 } else {
607606 $type = "ns-subject";
608607 }
609 - return "$numeric $type";
 608+ $name = Sanitizer::escapeClass( 'page-'.$title->getPrefixedText() );
 609+ return "$numeric $type $name";
610610 }
611611
612612 /**
Index: trunk/extensions/DumpHTML/SkinOffline.php
@@ -141,7 +141,7 @@
142142 <?php if($this->data['userjsprev']) { ?><script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script><?php } ?>
143143 </head>
144144 <body
145 - <?php if($this->data['nsclass' ]) { ?>class="<?php $this->text('nsclass') ?>"<?php } ?>>
 145+ <?php if($this->data['pageclass']) { ?>class="<?php $this->text('pageclass') ?>"<?php } ?>>
146146 <div id="globalWrapper">
147147 <div id="column-content">
148148 <div id="content">

Status & tagging log