Index: trunk/extensions/ThemeDesigner/SpecialThemeDesigner.php |
— | — | @@ -10,6 +10,27 @@ |
11 | 11 | die( 'This is an extension to the MediaWiki package and cannot be run standalone.' ); |
12 | 12 | } |
13 | 13 | |
| 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 | + |
14 | 35 | class SpecialThemeDesigner extends SpecialPage { |
15 | 36 | |
16 | 37 | public function __construct() { |
— | — | @@ -24,7 +45,7 @@ |
25 | 46 | public function execute( $par ) { |
26 | 47 | global $wgOut, $wgExtensionAssetsPath; |
27 | 48 | |
28 | | - $this->mSkin = Skin::newFromKey( 'simple' ); |
| 49 | + $this->mSkin = new ThemeDesignerDummySkin; |
29 | 50 | |
30 | 51 | $this->setHeaders(); |
31 | 52 | |
— | — | @@ -43,7 +64,9 @@ |
44 | 65 | $wgOut->addInlineScript($varScript); |
45 | 66 | $wgOut->addScriptFile("$wgExtensionAssetsPath/ThemeDesigner/frame/designer.js"); |
46 | 67 | |
47 | | - $this->printHtmlHead(); |
| 68 | + echo $wgOut->headElement( $this->mSkin ); |
| 69 | + $wgOut->sendCacheControl(); |
| 70 | + $wgOut->disable(); |
48 | 71 | |
49 | 72 | // We've collected our html building into a separate file for readability |
50 | 73 | require(dirname(__FILE__).'/frame/layout.php'); |
— | — | @@ -54,53 +77,4 @@ |
55 | 78 | |
56 | 79 | } |
57 | 80 | |
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 | | - |
107 | 81 | } |