Performance tweak
[lhc/web/wiklou.git] / skins / MonoBook.php
1 <?php
2 /**
3 * MonoBook nouveau
4 *
5 * Translated from gwicke's previous TAL template version to remove
6 * dependency on PHPTAL.
7 *
8 * @todo document
9 * @package MediaWiki
10 * @subpackage Skins
11 */
12
13 if( !defined( 'MEDIAWIKI' ) )
14 die( -1 );
15
16 /** */
17 require_once('includes/SkinTemplate.php');
18
19 /**
20 * Inherit main code from SkinTemplate, set the CSS and template filter.
21 * @todo document
22 * @package MediaWiki
23 * @subpackage Skins
24 */
25 class SkinMonoBook extends SkinTemplate {
26 /** Using monobook. */
27 function initPage( &$out ) {
28 SkinTemplate::initPage( $out );
29 $this->skinname = 'monobook';
30 $this->stylename = 'monobook';
31 $this->template = 'MonoBookTemplate';
32 }
33 }
34
35 /**
36 * @todo document
37 * @package MediaWiki
38 * @subpackage Skins
39 */
40 class MonoBookTemplate extends QuickTemplate {
41 /**
42 * Template filter callback for MonoBook skin.
43 * Takes an associative array of data set from a SkinTemplate-based
44 * class, and a wrapper for MediaWiki's localization database, and
45 * outputs a formatted page.
46 *
47 * @access private
48 */
49 function execute() {
50 // Suppress warnings to prevent notices about missing indexes in $this->data
51 wfSuppressWarnings();
52
53 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
54 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
55 <head>
56 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
57 <?php $this->html('headlinks') ?>
58 <?php $this->html('headscripts') ?>
59 <title><?php $this->text('pagetitle') ?></title>
60 <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?5"; /*]]>*/</style>
61 <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
62 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
63 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
64 <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
65 <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?1";</style><![endif]-->
66 <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
67 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
68 <?php if($this->data['jsvarurl' ]) { ?>
69 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script>
70 <?php } ?>
71 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"><!-- wikibits js --></script>
72 <?php if($this->data['pagecss' ]) { ?>
73 <style type="text/css"><?php $this->html('pagecss' ) ?></style>
74 <?php }
75 if($this->data['usercss' ]) { ?>
76 <style type="text/css"><?php $this->html('usercss' ) ?></style>
77 <?php }
78 if($this->data['userjs' ]) { ?>
79 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
80 <?php }
81 if($this->data['userjsprev']) { ?>
82 <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
83 <?php }
84 if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
85 </head>
86 <body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
87 <?php if($this->data['body_onload' ]) { ?>onload="<?php $this->text('body_onload') ?>"<?php } ?>
88 class="<?php $this->text('nsclass') ?> <?php $this->text('dir') ?>">
89 <div id="globalWrapper">
90 <div id="column-content">
91 <div id="content">
92 <a name="top" id="top"></a>
93 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
94 <h1 class="firstHeading"><?php $this->text('title') ?></h1>
95 <div id="bodyContent">
96 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
97 <div id="contentSub"><?php $this->html('subtitle') ?></div>
98 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
99 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
100 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
101 <!-- start content -->
102 <?php $this->html('bodytext') ?>
103 <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
104 <!-- end content -->
105 <div class="visualClear"></div>
106 </div>
107 </div>
108 </div>
109 <div id="column-one">
110 <div id="p-cactions" class="portlet">
111 <h5><?php $this->msg('views') ?></h5>
112 <ul>
113 <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
114 <li id="ca-<?php echo htmlspecialchars($key) ?>"<?php
115 if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
116 ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"><?php
117 echo htmlspecialchars($tab['text']) ?></a></li>
118 <?php } ?>
119 </ul>
120 </div>
121 <div class="portlet" id="p-personal">
122 <h5><?php $this->msg('personaltools') ?></h5>
123 <div class="pBody">
124 <ul>
125 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
126 <li id="pt-<?php echo htmlspecialchars($key) ?>"<?php
127 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
128 echo htmlspecialchars($item['href']) ?>"<?php
129 if(!empty($item['class'])) { ?> class="<?php
130 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
131 echo htmlspecialchars($item['text']) ?></a></li>
132 <?php } ?>
133 </ul>
134 </div>
135 </div>
136 <div class="portlet" id="p-logo">
137 <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
138 ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" <?php
139 ?>title="<?php $this->msg('mainpage') ?>"></a>
140 </div>
141 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
142 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
143 <div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
144 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
145 <div class='pBody'>
146 <ul>
147 <?php foreach($cont as $key => $val) { ?>
148 <li id="<?php echo htmlspecialchars($val['id']) ?>"<?php
149 if ( $val['active'] ) { ?> class="active" <?php }
150 ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"><?php echo htmlspecialchars($val['text']) ?></a></li>
151 <?php } ?>
152 </ul>
153 </div>
154 </div>
155 <?php } ?>
156 <div id="p-search" class="portlet">
157 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
158 <div id="searchBody" class="pBody">
159 <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
160 <input id="searchInput" name="search" type="text" <?php
161 if($this->haveMsg('accesskey-search')) {
162 ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
163 if( isset( $this->data['search'] ) ) {
164 ?> value="<?php $this->text('search') ?>"<?php } ?> />
165 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('go') ?>" />&nbsp;
166 <input type='submit' name="fulltext" class="searchButton" value="<?php $this->msg('search') ?>" />
167 </div></form>
168 </div>
169 </div>
170 <div class="portlet" id="p-tb">
171 <h5><?php $this->msg('toolbox') ?></h5>
172 <div class="pBody">
173 <ul>
174 <?php
175 if($this->data['notspecialpage']) { ?>
176 <li id="t-whatlinkshere"><a href="<?php
177 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
178 ?>"><?php $this->msg('whatlinkshere') ?></a></li>
179 <?php
180 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
181 <li id="t-recentchangeslinked"><a href="<?php
182 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
183 ?>"><?php $this->msg('recentchangeslinked') ?></a></li>
184 <?php }
185 }
186 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
187 <li id="t-trackbacklink"><a href="<?php
188 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
189 ?>"><?php $this->msg('trackbacklink') ?></a></li>
190 <?php }
191 if($this->data['feeds']) { ?>
192 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
193 ?><span id="feed-<?php echo htmlspecialchars($key) ?>"><a href="<?php
194 echo htmlspecialchars($feed['href']) ?>"><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
195 <?php } ?></li><?php
196 }
197
198 foreach( array('contributions', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
199
200 if($this->data['nav_urls'][$special]) {
201 ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
202 ?>"><?php $this->msg($special) ?></a></li>
203 <?php }
204 }
205
206 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
207 <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
208 ?>"><?php $this->msg('printableversion') ?></a></li><?php
209 }
210
211 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
212 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
213 ?>"><?php $this->msg('permalink') ?></a></li><?php
214 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
215 <li id="t-ispermalink"><?php $this->msg('permalink') ?></li><?php
216 }
217
218 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
219 ?>
220 </ul>
221 </div>
222 </div>
223 <?php
224 if( $this->data['language_urls'] ) { ?>
225 <div id="p-lang" class="portlet">
226 <h5><?php $this->msg('otherlanguages') ?></h5>
227 <div class="pBody">
228 <ul>
229 <?php foreach($this->data['language_urls'] as $langlink) { ?>
230 <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
231 ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
232 <?php } ?>
233 </ul>
234 </div>
235 </div>
236 <?php } ?>
237 </div><!-- end of the left (by default at least) column -->
238 <div class="visualClear"></div>
239 <div id="footer">
240 <?php
241 if($this->data['poweredbyico']) { ?>
242 <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
243 <?php }
244 if($this->data['copyrightico']) { ?>
245 <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
246 <?php }
247
248 // Generate additional footer links
249 ?>
250 <ul id="f-list">
251 <?php
252 $footerlinks = array(
253 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
254 'privacy', 'about', 'disclaimer', 'tagline',
255 );
256 foreach( $footerlinks as $aLink ) {
257 if( $this->data[$aLink] ) {
258 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
259 <?php }
260 }
261 ?>
262 </ul>
263 </div>
264 <script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
265 </div>
266 <?php $this->html('reporttime') ?>
267
268 </body></html>
269 <?php
270 wfRestoreWarnings();
271 } // end of execute() method
272 } // end of class
273 ?>