* cleaner source output
[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();
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 <title><?php $this->text('pagetitle') ?></title>
59 <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?5"; /*]]>*/</style>
60 <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
61 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
62 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
63 <!--[if gte IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
64 <!--[if IE]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
65 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
66 <?php if($this->data['jsvarurl' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script><?php } ?>
67 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"><!-- wikibits js --></script>
68 <?php if($this->data['pagecss' ]) { ?><style type="text/css"><?php $this->html('pagecss' ) ?></style><?php } ?>
69 <?php if($this->data['usercss' ]) { ?><style type="text/css"><?php $this->html('usercss' ) ?></style><?php } ?>
70 <?php if($this->data['userjs' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script><?php } ?>
71 <?php if($this->data['userjsprev']) { ?><script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script><?php } ?>
72 <?php if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
73 </head>
74
75 <body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
76 <?php if($this->data['body_onload' ]) { ?>onload="<?php $this->text('body_onload') ?>"<?php } ?>
77 <?php if($this->data['nsclass' ]) { ?>class="<?php $this->text('nsclass') ?>"<?php } ?>>
78
79 <div id="globalWrapper">
80 <div id="column-content">
81 <div id="content">
82 <a name="top" id="top"></a>
83 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
84 <h1 class="firstHeading"><?php $this->text('title') ?></h1>
85 <div id="bodyContent">
86 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
87 <div id="contentSub"><?php $this->html('subtitle') ?></div>
88 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
89 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
90 <?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 } ?>
91 <!-- start content -->
92 <?php $this->html('bodytext') ?>
93 <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
94 <!-- end content -->
95 <div class="visualClear"></div>
96 </div>
97 </div>
98 </div>
99 <div id="column-one">
100 <div id="p-cactions" class="portlet">
101 <h5><?php $this->msg('views') ?></h5>
102 <ul>
103 <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
104 <li id="ca-<?= htmlspecialchars($key) ?>"<?php
105 if($tab['class']) { ?> class="<?= htmlspecialchars($tab['class']) ?>"<?php }
106 ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"><?php
107 echo htmlspecialchars($tab['text']) ?></a></li>
108 <?php } ?>
109 </ul>
110 </div>
111 <div class="portlet" id="p-personal">
112 <h5><?php $this->msg('personaltools') ?></h5>
113 <div class="pBody">
114 <ul>
115 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
116 <li id="pt-<?php echo htmlspecialchars($key) ?>"<?php
117 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
118 echo htmlspecialchars($item['href']) ?>"<?php
119 if(!empty($item['class'])) { ?> class="<?php
120 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
121 echo htmlspecialchars($item['text']) ?></a></li>
122 <?php } ?>
123 </ul>
124 </div>
125 </div>
126 <div class="portlet" id="p-logo">
127 <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
128 ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" <?php
129 ?>title="<?php $this->msg('mainpage') ?>"></a>
130 </div>
131 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
132 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
133 <div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
134 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
135 <div class='pBody'>
136 <ul>
137 <?php foreach($cont as $key => $val) { ?>
138 <li id="<?= htmlspecialchars($val['id']) ?>"<?php
139 if ( $val['active'] ) { ?> class="active" <?php }
140 ?>><a href="<?= htmlspecialchars($val['href']) ?>"><?= htmlspecialchars($val['text']) ?></a></li>
141 <?php } ?>
142 </ul>
143 </div>
144 </div>
145 <?php } ?>
146 <div id="p-search" class="portlet">
147 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
148 <div class="pBody">
149 <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
150 <input id="searchInput" name="search" type="text" <?php
151 if($this->haveMsg('accesskey-search')) {
152 ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
153 if( isset( $this->data['search'] ) ) {
154 ?> value="<?php $this->text('search') ?>"<?php } ?> />
155 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('go') ?>" />&nbsp;
156 <input type='submit' name="fulltext" class="searchButton" value="<?php $this->msg('search') ?>" />
157 </div></form>
158 </div>
159 </div>
160 <div class="portlet" id="p-tb">
161 <h5><?php $this->msg('toolbox') ?></h5>
162 <div class="pBody">
163 <ul>
164 <?php
165 if($this->data['notspecialpage']) { ?>
166 <li id="t-whatlinkshere"><a href="<?php
167 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
168 ?>"><?= $this->msg('whatlinkshere') ?></a></li>
169 <?php
170 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
171 <li id="t-recentchangeslinked"><a href="<?php
172 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
173 ?>"><?= $this->msg('recentchangeslinked') ?></a></li>
174 <?php }
175 }
176 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
177 <li id="t-trackbacklink"><a href="<?php
178 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
179 ?>"><?php echo $this->msg('trackbacklink') ?></a></li>
180 <?php }
181 if($this->data['feeds']) { ?>
182 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
183 ?><span id="feed-<?= htmlspecialchars($key) ?>"><a href="<?php
184 echo htmlspecialchars($feed['href']) ?>"><?= htmlspecialchars($feed['text'])?></a>&nbsp;</span>
185 <?php } ?></li><?php
186 }
187
188 foreach( array('contributions', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
189
190 if($this->data['nav_urls'][$special]) {
191 ?><li id="t-<?= $special ?>"><a href="<?= htmlspecialchars($this->data['nav_urls'][$special]['href'])
192 ?>"><?php $this->msg($special) ?></a></li>
193 <?php }
194 }
195
196 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
197 <li id="t-print"><a href="<?= htmlspecialchars($this->data['nav_urls']['print']['href'])
198 ?>"><?= $this->msg('printableversion') ?></a></li><?php
199 }
200
201 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
202 <li id="t-permalink"><a href="<?= htmlspecialchars($this->data['nav_urls']['permalink']['href'])
203 ?>"><?= $this->msg('permalink') ?></a></li><?php
204 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
205 <li id="t-ispermalink"><?= $this->msg('permalink') ?></li><?php
206 }
207
208 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
209 ?>
210 </ul>
211 </div>
212 </div>
213 <?php
214 if( $this->data['language_urls'] ) { ?>
215 <div id="p-lang" class="portlet">
216 <h5><?= $this->msg('otherlanguages') ?></h5>
217 <div class="pBody">
218 <ul>
219 <?php foreach($this->data['language_urls'] as $langlink) { ?>
220 <li class="<?= htmlspecialchars($langlink['class'])?>"><?php
221 ?><a href="<?= htmlspecialchars($langlink['href']) ?>"><?= $langlink['text'] ?></a></li>
222 <?php } ?>
223 </ul>
224 </div>
225 </div>
226 <?php } ?>
227 </div><!-- end of the left (by default at least) column -->
228 <div class="visualClear"></div>
229 <div id="footer">
230 <?php
231 if($this->data['poweredbyico']) { ?>
232 <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
233 <?php }
234 if($this->data['copyrightico']) { ?>
235 <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
236 <?php }
237
238 // Generate additional footer links
239 ?>
240 <ul id="f-list">
241 <?php
242 $footerlinks = array(
243 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
244 'privacy', 'about', 'disclaimer', 'tagline',
245 );
246 foreach( $footerlinks as $aLink ) {
247 if( $this->data[$aLink] ) {
248 ?> <li id="<?=$aLink?>"><?= $this->html($aLink) ?></li>
249 <?php }
250 }
251 ?>
252 </ul>
253 </div>
254 <script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
255 </div>
256 <?= $this->html('reporttime') ?>
257
258 </body></html>
259 <?php
260 wfRestoreWarnings();
261 } // end of execute() method
262 } // end of class
263 ?>