r78307 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78306‎ | r78307 | r78308 >
Date:15:26, 13 December 2010
Author:dantman
Status:deferred
Tags:
Comment:
Switch out printHtmlHead and the Simple skin for a dummy skin that disables the extra stuff we don't want in the theme designer.
Modified paths:
  • /trunk/extensions/ThemeDesigner/SpecialThemeDesigner.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ThemeDesigner/SpecialThemeDesigner.php
@@ -10,6 +10,27 @@
1111 die( 'This is an extension to the MediaWiki package and cannot be run standalone.' );
1212 }
1313
 14+class ThemeDesignerDummySkin extends Skin {
 15+
 16+ function __construct() {
 17+ parent::__construct();
 18+ $this->setMembers();
 19+ }
 20+
 21+ function commonPrintStylesheet() {
 22+ return false;
 23+ }
 24+
 25+ function setupUserCss( OutputPage $out ) {
 26+
 27+ foreach ( $out->getExtStyle() as $url ) {
 28+ $out->addStyle( $url );
 29+ }
 30+
 31+ }
 32+
 33+}
 34+
1435 class SpecialThemeDesigner extends SpecialPage {
1536
1637 public function __construct() {
@@ -24,7 +45,7 @@
2546 public function execute( $par ) {
2647 global $wgOut, $wgExtensionAssetsPath;
2748
28 - $this->mSkin = Skin::newFromKey( 'simple' );
 49+ $this->mSkin = new ThemeDesignerDummySkin;
2950
3051 $this->setHeaders();
3152
@@ -43,7 +64,9 @@
4465 $wgOut->addInlineScript($varScript);
4566 $wgOut->addScriptFile("$wgExtensionAssetsPath/ThemeDesigner/frame/designer.js");
4667
47 - $this->printHtmlHead();
 68+ echo $wgOut->headElement( $this->mSkin );
 69+ $wgOut->sendCacheControl();
 70+ $wgOut->disable();
4871
4972 // We've collected our html building into a separate file for readability
5073 require(dirname(__FILE__).'/frame/layout.php');
@@ -54,53 +77,4 @@
5578
5679 }
5780
58 - /**
59 - * Prints a raw html header for our page complete takeover specialpage
60 - * Note that this matches most of the functionality of OutputPage::headElement
61 - * however that method ads extra we can't have in our head so we have to reimplement
62 - */
63 - function printHtmlHead() {
64 - global $wgOut, $wgHtml5, $wgMimeType, $wgOutputEncoding;
65 - echo Html::htmlHeader( array( 'lang' => wfUILang()->getCode() ) );
66 - if ( $wgOut->getHTMLTitle() == '' ) {
67 - $wgOut->setHTMLTitle( wfMsg( 'pagetitle', $wgOut->getPageTitle() ) );
68 - }
69 - $openHead = Html::openElement( 'head' );
70 - if ( $openHead ) {
71 - echo "$openHead\n";
72 - }
73 -
74 - if ( $wgHtml5 ) {
75 - # More succinct than <meta http-equiv=Content-Type>, has the
76 - # same effect
77 - echo Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) ) . "\n";
78 - } else {
79 - $wgOut->addMeta( 'http:Content-Type', "$wgMimeType; charset=$wgOutputEncoding" );
80 - }
81 -
82 - echo Html::element( 'title', null, $wgOut->getHTMLTitle() ) . "\n";
83 -
84 - foreach ( $wgOut->mExtStyles as $extstyle ) {
85 - $wgOut->styles[$extstyle] = array();
86 - }
87 -
88 - echo implode( "\n", array(
89 - $wgOut->getHeadLinks(),
90 - $wgOut->buildCssLinks( $this->mSkin ),
91 - $wgOut->getHeadItems()
92 - ) );
93 -
94 - $closeHead = Html::closeElement( 'head' );
95 - if ( $closeHead ) {
96 - echo "$closeHead\n";
97 - }
98 -
99 - $bodyAttrs = array();
100 -
101 - echo Html::openElement( 'body', $bodyAttrs ) . "\n";
102 -
103 - $wgOut->sendCacheControl();
104 - $wgOut->disable();
105 - }
106 -
10781 }

Status & tagging log