Remove most named character references from output
[lhc/web/wiklou.git] / skins / Vector.php
1 <?php
2 /**
3 * Vector - Branch of MonoBook which has many usability improvements and
4 * somewhat cleaner code.
5 *
6 * @todo document
7 * @file
8 * @ingroup Skins
9 */
10
11 if( !defined( 'MEDIAWIKI' ) )
12 die( -1 );
13
14 /**
15 * SkinTemplate class for Vector skin
16 * @ingroup Skins
17 */
18 class SkinVector extends SkinTemplate {
19
20 /* Functions */
21 var $skinname = 'vector', $stylename = 'vector',
22 $template = 'VectorTemplate', $useHeadElement = true;
23
24 /**
25 * Initializes output page and sets up skin-specific parameters
26 * @param $out OutputPage object to initialize
27 */
28 public function initPage( OutputPage $out ) {
29 global $wgLocalStylePath;
30
31 parent::initPage( $out );
32
33 // Append CSS which includes IE only behavior fixes for hover support -
34 // this is better than including this in a CSS fille since it doesn't
35 // wait for the CSS file to load before fetching the HTC file.
36 $out->addScript(
37 '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
38 $wgLocalStylePath .
39 '/vector/csshover.htc")}</style><![endif]-->'
40 );
41 }
42
43 /**
44 * Load skin and user css files in the correct order
45 * fixes bug 22916
46 * @param $out OutputPage object
47 */
48
49 function setupSkinUserCss( OutputPage $out ){
50 global $wgVectorExtraStyles;
51
52 parent::setupSkinUserCss( $out );
53
54 // Append skin-specific styles
55 $out->addStyle( 'vector/main-rtl.css', 'screen', '', 'rtl' );
56 $out->addStyle( 'vector/main-ltr.css', 'screen', '', 'ltr' );
57
58 // Add extra stylesheets
59 // THIS IS ONLY USEFUL FOR EXPERIMENTING WITH DIFFERNT STYLE OPTIONS! THIS WILL BE REMOVED IN THE NEAR FUTURE.
60 if ( is_array( $wgVectorExtraStyles ) ) {
61 foreach ( $wgVectorExtraStyles as $style ) {
62 $out->addStyle( 'vector/' . $style, 'screen' );
63 }
64 }
65 }
66
67 /**
68 * Builds a structured array of links used for tabs and menus
69 * @return array
70 * @private
71 */
72 function buildNavigationUrls() {
73 global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle, $wgStylePath;
74 global $wgDisableLangConversion, $wgVectorUseIconWatch;
75
76 wfProfileIn( __METHOD__ );
77
78 $links = array(
79 'namespaces' => array(),
80 'views' => array(),
81 'actions' => array(),
82 'variants' => array()
83 );
84
85 // Detects parameters
86 $action = $wgRequest->getVal( 'action', 'view' );
87 $section = $wgRequest->getVal( 'section' );
88
89 // Checks if page is some kind of content
90 if( $this->iscontent ) {
91
92 // Gets page objects for the related namespaces
93 $subjectPage = $this->mTitle->getSubjectPage();
94 $talkPage = $this->mTitle->getTalkPage();
95
96 // Determines if this is a talk page
97 $isTalk = $this->mTitle->isTalkPage();
98
99 // Generates XML IDs from namespace names
100 $subjectId = $this->mTitle->getNamespaceKey( '' );
101
102 if ( $subjectId == 'main' ) {
103 $talkId = 'talk';
104 } else {
105 $talkId = "{$subjectId}_talk";
106 }
107 $currentId = $isTalk ? $talkId : $subjectId;
108
109 // Adds namespace links
110 $links['namespaces'][$subjectId] = $this->tabAction(
111 $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
112 );
113 $links['namespaces'][$subjectId]['context'] = 'subject';
114 $links['namespaces'][$talkId] = $this->tabAction(
115 $talkPage, 'vector-namespace-talk', $isTalk, '', true
116 );
117 $links['namespaces'][$talkId]['context'] = 'talk';
118
119 // Adds view view link
120 if ( $this->mTitle->exists() ) {
121 $links['views']['view'] = $this->tabAction(
122 $isTalk ? $talkPage : $subjectPage,
123 'vector-view-view', ( $action == 'view' ), '', true
124 );
125 }
126
127 wfProfileIn( __METHOD__ . '-edit' );
128
129 // Checks if user can...
130 if (
131 // edit the current page
132 $this->mTitle->quickUserCan( 'edit' ) &&
133 (
134 // if it exists
135 $this->mTitle->exists() ||
136 // or they can create one here
137 $this->mTitle->quickUserCan( 'create' )
138 )
139 ) {
140 // Builds CSS class for talk page links
141 $isTalkClass = $isTalk ? ' istalk' : '';
142
143 // Determines if we're in edit mode
144 $selected = (
145 ( $action == 'edit' || $action == 'submit' ) &&
146 ( $section != 'new' )
147 );
148 $links['views']['edit'] = array(
149 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass,
150 'text' => $this->mTitle->exists()
151 ? wfMsg( 'vector-view-edit' )
152 : wfMsg( 'vector-view-create' ),
153 'href' =>
154 $this->mTitle->getLocalUrl( $this->editUrlOptions() )
155 );
156 // Checks if this is a current rev of talk page and we should show a new
157 // section link
158 if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
159 // Checks if we should ever show a new section link
160 if ( !$wgOut->forceHideNewSectionLink() ) {
161 // Adds new section link
162 //$links['actions']['addsection']
163 $links['views']['addsection'] = array(
164 'class' => 'collapsible ' . ( $section == 'new' ? 'selected' : false ),
165 'text' => wfMsg( 'vector-action-addsection' ),
166 'href' => $this->mTitle->getLocalUrl(
167 'action=edit&section=new'
168 )
169 );
170 }
171 }
172 // Checks if the page has some kind of viewable content
173 } elseif ( $this->mTitle->hasSourceText() ) {
174 // Adds view source view link
175 $links['views']['viewsource'] = array(
176 'class' => ( $action == 'edit' ) ? 'selected' : false,
177 'text' => wfMsg( 'vector-view-viewsource' ),
178 'href' =>
179 $this->mTitle->getLocalUrl( $this->editUrlOptions() )
180 );
181 }
182 wfProfileOut( __METHOD__ . '-edit' );
183
184 wfProfileIn( __METHOD__ . '-live' );
185
186 // Checks if the page exists
187 if ( $this->mTitle->exists() ) {
188 // Adds history view link
189 $links['views']['history'] = array(
190 'class' => 'collapsible ' . ( ($action == 'history') ? 'selected' : false ),
191 'text' => wfMsg( 'vector-view-history' ),
192 'href' => $this->mTitle->getLocalUrl( 'action=history' ),
193 'rel' => 'archives',
194 );
195
196 if( $wgUser->isAllowed( 'delete' ) ) {
197 $links['actions']['delete'] = array(
198 'class' => ($action == 'delete') ? 'selected' : false,
199 'text' => wfMsg( 'vector-action-delete' ),
200 'href' => $this->mTitle->getLocalUrl( 'action=delete' )
201 );
202 }
203 if ( $this->mTitle->quickUserCan( 'move' ) ) {
204 $moveTitle = SpecialPage::getTitleFor(
205 'Movepage', $this->thispage
206 );
207 $links['actions']['move'] = array(
208 'class' => $this->mTitle->isSpecial( 'Movepage' ) ?
209 'selected' : false,
210 'text' => wfMsg( 'vector-action-move' ),
211 'href' => $moveTitle->getLocalUrl()
212 );
213 }
214
215 if (
216 $this->mTitle->getNamespace() !== NS_MEDIAWIKI &&
217 $wgUser->isAllowed( 'protect' )
218 ) {
219 if ( !$this->mTitle->isProtected() ){
220 $links['actions']['protect'] = array(
221 'class' => ($action == 'protect') ?
222 'selected' : false,
223 'text' => wfMsg( 'vector-action-protect' ),
224 'href' =>
225 $this->mTitle->getLocalUrl( 'action=protect' )
226 );
227
228 } else {
229 $links['actions']['unprotect'] = array(
230 'class' => ($action == 'unprotect') ?
231 'selected' : false,
232 'text' => wfMsg( 'vector-action-unprotect' ),
233 'href' =>
234 $this->mTitle->getLocalUrl( 'action=unprotect' )
235 );
236 }
237 }
238 } else {
239 // article doesn't exist or is deleted
240 if (
241 $wgUser->isAllowed( 'deletedhistory' ) &&
242 $wgUser->isAllowed( 'undelete' )
243 ) {
244 if( $n = $this->mTitle->isDeleted() ) {
245 $undelTitle = SpecialPage::getTitleFor( 'Undelete' );
246 $links['actions']['undelete'] = array(
247 'class' => false,
248 'text' => wfMsgExt(
249 'vector-action-undelete',
250 array( 'parsemag' ),
251 $wgLang->formatNum( $n )
252 ),
253 'href' => $undelTitle->getLocalUrl(
254 'target=' . urlencode( $this->thispage )
255 )
256 );
257 }
258 }
259
260 if (
261 $this->mTitle->getNamespace() !== NS_MEDIAWIKI &&
262 $wgUser->isAllowed( 'protect' )
263 ) {
264 if ( !$this->mTitle->getRestrictions( 'create' ) ) {
265 $links['actions']['protect'] = array(
266 'class' => ($action == 'protect') ?
267 'selected' : false,
268 'text' => wfMsg( 'vector-action-protect' ),
269 'href' =>
270 $this->mTitle->getLocalUrl( 'action=protect' )
271 );
272
273 } else {
274 $links['actions']['unprotect'] = array(
275 'class' => ($action == 'unprotect') ?
276 'selected' : false,
277 'text' => wfMsg( 'vector-action-unprotect' ),
278 'href' =>
279 $this->mTitle->getLocalUrl( 'action=unprotect' )
280 );
281 }
282 }
283 }
284 wfProfileOut( __METHOD__ . '-live' );
285 /**
286 * The following actions use messages which, if made particular to
287 * the Vector skin, would break the Ajax code which makes this
288 * action happen entirely inline. Skin::makeGlobalVariablesScript
289 * defines a set of messages in a javascript object - and these
290 * messages are assumed to be global for all skins. Without making
291 * a change to that procedure these messages will have to remain as
292 * the global versions.
293 */
294 // Checks if the user is logged in
295 if ( $this->loggedin ) {
296 if ( $wgVectorUseIconWatch ) {
297 $class = 'icon ';
298 $place = 'views';
299 } else {
300 $class = '';
301 $place = 'actions';
302 }
303 $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch';
304 $links[$place][$mode] = array(
305 'class' => $class . ( ( $action == 'watch' || $action == 'unwatch' ) ? ' selected' : false ),
306 'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message
307 'href' => $this->mTitle->getLocalUrl( 'action=' . $mode )
308 );
309 }
310 // This is instead of SkinTemplateTabs - which uses a flat array
311 wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
312
313 // If it's not content, it's got to be a special page
314 } else {
315 $links['namespaces']['special'] = array(
316 'class' => 'selected',
317 'text' => wfMsg( 'vector-namespace-special' ),
318 'href' => $wgRequest->getRequestURL()
319 );
320 }
321
322 // Gets list of language variants
323 $variants = $wgContLang->getVariants();
324 // Checks that language conversion is enabled and variants exist
325 if( !$wgDisableLangConversion && count( $variants ) > 1 ) {
326 // Gets preferred variant
327 $preferred = $wgContLang->getPreferredVariant();
328 // Loops over each variant
329 foreach( $variants as $code ) {
330 // Gets variant name from language code
331 $varname = $wgContLang->getVariantname( $code );
332 // Checks if the variant is marked as disabled
333 if( $varname == 'disable' ) {
334 // Skips this variant
335 continue;
336 }
337 // Appends variant link
338 $links['variants'][] = array(
339 'class' => ( $code == $preferred ) ? 'selected' : false,
340 'text' => $varname,
341 'href' => $this->mTitle->getLocalURL( '', $code )
342 );
343 }
344 }
345
346 wfProfileOut( __METHOD__ );
347
348 return $links;
349 }
350 }
351
352 /**
353 * QuickTemplate class for Vector skin
354 * @ingroup Skins
355 */
356 class VectorTemplate extends QuickTemplate {
357
358 /* Members */
359
360 /**
361 * @var Cached skin object
362 */
363 var $skin;
364
365 /* Functions */
366
367 /**
368 * Outputs the entire contents of the XHTML page
369 */
370 public function execute() {
371 global $wgRequest, $wgOut, $wgContLang;
372
373 $this->skin = $this->data['skin'];
374 $action = $wgRequest->getText( 'action' );
375
376 // Build additional attributes for navigation urls
377 $nav = $this->skin->buildNavigationUrls();
378 foreach ( $nav as $section => $links ) {
379 foreach ( $links as $key => $link ) {
380 $xmlID = $key;
381 if ( isset( $link['context'] ) && $link['context'] == 'subject' ) {
382 $xmlID = 'ca-nstab-' . $xmlID;
383 } else if ( isset( $link['context'] ) && $link['context'] == 'talk' ) {
384 $xmlID = 'ca-talk';
385 } else {
386 $xmlID = 'ca-' . $xmlID;
387 }
388 $nav[$section][$key]['attributes'] =
389 ' id="' . Sanitizer::escapeId( $xmlID ) . '"';
390 if ( $nav[$section][$key]['class'] ) {
391 $nav[$section][$key]['attributes'] .=
392 ' class="' . htmlspecialchars( $link['class'] ) . '"';
393 unset( $nav[$section][$key]['class'] );
394 }
395 // We don't want to give the watch tab an accesskey if the page
396 // is being edited, because that conflicts with the accesskey on
397 // the watch checkbox. We also don't want to give the edit tab
398 // an accesskey, because that's fairly superfluous and conflicts
399 // with an accesskey (Ctrl-E) often used for editing in Safari.
400 if (
401 in_array( $action, array( 'edit', 'submit' ) ) &&
402 in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
403 ) {
404 $nav[$section][$key]['key'] =
405 $this->skin->tooltip( $xmlID );
406 } else {
407 $nav[$section][$key]['key'] =
408 $this->skin->tooltipAndAccesskey( $xmlID );
409 }
410 }
411 }
412 $this->data['namespace_urls'] = $nav['namespaces'];
413 $this->data['view_urls'] = $nav['views'];
414 $this->data['action_urls'] = $nav['actions'];
415 $this->data['variant_urls'] = $nav['variants'];
416 // Build additional attributes for personal_urls
417 foreach ( $this->data['personal_urls'] as $key => $item) {
418 $this->data['personal_urls'][$key]['attributes'] =
419 ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
420 if ( isset( $item['active'] ) && $item['active'] ) {
421 $this->data['personal_urls'][$key]['attributes'] .=
422 ' class="active"';
423 }
424 $this->data['personal_urls'][$key]['key'] =
425 $this->skin->tooltipAndAccesskey('pt-'.$key);
426 }
427
428 // Generate additional footer links
429 $footerlinks = array(
430 'info' => array(
431 'lastmod',
432 'viewcount',
433 'numberofwatchingusers',
434 'credits',
435 'copyright',
436 'tagline',
437 ),
438 'places' => array(
439 'privacy',
440 'about',
441 'disclaimer',
442 ),
443 );
444 // Reduce footer links down to only those which are being used
445 $validFooterLinks = array();
446 foreach( $footerlinks as $category => $links ) {
447 $validFooterLinks[$category] = array();
448 foreach( $links as $link ) {
449 if( isset( $this->data[$link] ) && $this->data[$link] ) {
450 $validFooterLinks[$category][] = $link;
451 }
452 }
453 }
454 // Reverse horizontally rendered navigation elements
455 if ( $wgContLang->isRTL() ) {
456 $this->data['view_urls'] =
457 array_reverse( $this->data['view_urls'] );
458 $this->data['namespace_urls'] =
459 array_reverse( $this->data['namespace_urls'] );
460 $this->data['personal_urls'] =
461 array_reverse( $this->data['personal_urls'] );
462 }
463 // Output HTML Page
464 $this->html( 'headelement' );
465 ?>
466 <div id="page-base" class="noprint"></div>
467 <div id="head-base" class="noprint"></div>
468 <!-- content -->
469 <div id="content"<?php $this->html('specialpageattributes') ?>>
470 <a id="top"></a>
471 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes') ?>></div>
472 <?php if ( $this->data['sitenotice'] ): ?>
473 <!-- sitenotice -->
474 <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
475 <!-- /sitenotice -->
476 <?php endif; ?>
477 <!-- firstHeading -->
478 <h1 id="firstHeading" class="firstHeading"><?php $this->html( 'title' ) ?></h1>
479 <!-- /firstHeading -->
480 <!-- bodyContent -->
481 <div id="bodyContent">
482 <!-- tagline -->
483 <h3 id="siteSub"><?php $this->msg( 'tagline' ) ?></h3>
484 <!-- /tagline -->
485 <!-- subtitle -->
486 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html( 'subtitle' ) ?></div>
487 <!-- /subtitle -->
488 <?php if ( $this->data['undelete'] ): ?>
489 <!-- undelete -->
490 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
491 <!-- /undelete -->
492 <?php endif; ?>
493 <?php if($this->data['newtalk'] ): ?>
494 <!-- newtalk -->
495 <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
496 <!-- /newtalk -->
497 <?php endif; ?>
498 <?php if ( $this->data['showjumplinks'] ): ?>
499 <!-- jumpto -->
500 <div id="jump-to-nav">
501 <?php $this->msg( 'jumpto' ) ?><a href="#head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
502 <a href="#p-search"><?php $this->msg( 'jumptosearch' ) ?></a>
503 </div>
504 <!-- /jumpto -->
505 <?php endif; ?>
506 <!-- bodytext -->
507 <?php $this->html( 'bodytext' ) ?>
508 <!-- /bodytext -->
509 <?php if ( $this->data['catlinks'] ): ?>
510 <!-- catlinks -->
511 <?php $this->html( 'catlinks' ); ?>
512 <!-- /catlinks -->
513 <?php endif; ?>
514 <?php if ( $this->data['dataAfterContent'] ): ?>
515 <!-- dataAfterContent -->
516 <?php $this->html( 'dataAfterContent' ); ?>
517 <!-- /dataAfterContent -->
518 <?php endif; ?>
519 <div class="visualClear"></div>
520 </div>
521 <!-- /bodyContent -->
522 </div>
523 <!-- /content -->
524 <!-- header -->
525 <div id="head" class="noprint">
526 <?php $this->renderNavigation( 'PERSONAL' ); ?>
527 <div id="left-navigation">
528 <?php $this->renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?>
529 </div>
530 <div id="right-navigation">
531 <?php $this->renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?>
532 </div>
533 </div>
534 <!-- /header -->
535 <!-- panel -->
536 <div id="panel" class="noprint">
537 <!-- logo -->
538 <div id="p-logo"><a style="background-image: url(<?php $this->text( 'logopath' ) ?>);" href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo $this->skin->tooltipAndAccesskey( 'p-logo' ) ?>></a></div>
539 <!-- /logo -->
540 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
541 </div>
542 <!-- /panel -->
543 <!-- footer -->
544 <div id="footer"<?php $this->html('userlangattributes') ?>>
545 <?php foreach( $validFooterLinks as $category => $links ): ?>
546 <?php if ( count( $links ) > 0 ): ?>
547 <ul id="footer-<?php echo $category ?>">
548 <?php foreach( $links as $link ): ?>
549 <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?>
550 <li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
551 <?php endif; ?>
552 <?php endforeach; ?>
553 </ul>
554 <?php endif; ?>
555 <?php endforeach; ?>
556 <ul id="footer-icons" class="noprint">
557 <?php if ( $this->data['poweredbyico'] ): ?>
558 <li id="footer-icon-poweredby"><?php $this->html( 'poweredbyico' ) ?></li>
559 <?php endif; ?>
560 <?php if ( $this->data['copyrightico'] ): ?>
561 <li id="footer-icon-copyright"><?php $this->html( 'copyrightico' ) ?></li>
562 <?php endif; ?>
563 </ul>
564 <div style="clear:both"></div>
565 </div>
566 <!-- /footer -->
567 <!-- fixalpha -->
568 <script type="<?php $this->text('jsmimetype') ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
569 <!-- /fixalpha -->
570 <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
571 <?php $this->html( 'reporttime' ) ?>
572 <?php if ( $this->data['debug'] ): ?>
573 <!-- Debug output: <?php $this->text( 'debug' ); ?> -->
574 <?php endif; ?>
575 </body>
576 </html>
577 <?php
578 }
579
580 /**
581 * Render a series of portals
582 */
583 private function renderPortals( $portals ) {
584 // Force the rendering of the following portals
585 if ( !isset( $portals['SEARCH'] ) ) $portals['SEARCH'] = true;
586 if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true;
587 if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true;
588 // Render portals
589 foreach ( $portals as $name => $content ) {
590 echo "\n<!-- {$name} -->\n";
591 switch( $name ) {
592 case 'SEARCH':
593 break;
594 case 'TOOLBOX':
595 ?>
596 <div class="portal" id="p-tb">
597 <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
598 <div class="body">
599 <ul>
600 <?php if( $this->data['notspecialpage'] ): ?>
601 <li id="t-whatlinkshere"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['whatlinkshere']['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-whatlinkshere' ) ?>><?php $this->msg( 'whatlinkshere' ) ?></a></li>
602 <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
603 <li id="t-recentchangeslinked"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['recentchangeslinked']['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-recentchangeslinked' ) ?>><?php $this->msg( 'recentchangeslinked-toolbox' ) ?></a></li>
604 <?php endif; ?>
605 <?php endif; ?>
606 <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?>
607 <li id="t-trackbacklink"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['trackbacklink']['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-trackbacklink' ) ?>><?php $this->msg( 'trackbacklink' ) ?></a></li>
608 <?php endif; ?>
609 <?php if( $this->data['feeds']): ?>
610 <li id="feedlinks">
611 <?php foreach( $this->data['feeds'] as $key => $feed ): ?>
612 <a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php echo htmlspecialchars( $feed['href'] ) ?>" rel="alternate" type="application/<?php echo $key ?>+xml" class="feedlink"<?php echo $this->skin->tooltipAndAccesskey( 'feed-' . $key ) ?>><?php echo htmlspecialchars( $feed['text'] ) ?></a>
613 <?php endforeach; ?>
614 </li>
615 <?php endif; ?>
616 <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?>
617 <?php if( $this->data['nav_urls'][$special]): ?>
618 <li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars( $this->data['nav_urls'][$special]['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-' . $special ) ?>><?php $this->msg( $special ) ?></a></li>
619 <?php endif; ?>
620 <?php endforeach; ?>
621 <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?>
622 <li id="t-print"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['print']['href'] ) ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey( 't-print' ) ?>><?php $this->msg( 'printableversion' ) ?></a></li>
623 <?php endif; ?>
624 <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
625 <li id="t-permalink"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['permalink']['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-permalink' ) ?>><?php $this->msg( 'permalink' ) ?></a></li>
626 <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?>
627 <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li>
628 <?php endif; ?>
629 <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
630 </ul>
631 </div>
632 </div>
633 <?php
634 break;
635 case 'LANGUAGES':
636 if ( $this->data['language_urls'] ) {
637 ?>
638 <div class="portal" id="p-lang">
639 <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
640 <div class="body">
641 <ul>
642 <?php foreach ( $this->data['language_urls'] as $langlink ): ?>
643 <li class="<?php echo htmlspecialchars( $langlink['class'] ) ?>"><a href="<?php echo htmlspecialchars( $langlink['href'] ) ?>"><?php echo $langlink['text'] ?></a></li>
644 <?php endforeach; ?>
645 </ul>
646 </div>
647 </div>
648 <?php
649 }
650 break;
651 default:
652 ?>
653 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>>
654 <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5>
655 <div class="body">
656 <?php if ( is_array( $content ) ): ?>
657 <ul>
658 <?php foreach( $content as $key => $val ): ?>
659 <li id="<?php echo Sanitizer::escapeId( $val['id'] ) ?>"<?php if ( $val['active'] ): ?> class="active" <?php endif; ?>><a href="<?php echo htmlspecialchars( $val['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( $val['id'] ) ?>><?php echo htmlspecialchars( $val['text'] ) ?></a></li>
660 <?php endforeach; ?>
661 </ul>
662 <?php else: ?>
663 <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?>
664 <?php endif; ?>
665 </div>
666 </div>
667 <?php
668 break;
669 }
670 echo "\n<!-- /{$name} -->\n";
671 }
672 }
673
674 /**
675 * Render one or more navigations elements by name, automatically reveresed
676 * when UI is in RTL mode
677 */
678 private function renderNavigation( $elements ) {
679 global $wgContLang, $wgVectorUseSimpleSearch, $wgVectorShowVariantName, $wgStylePath;
680
681 // If only one element was given, wrap it in an array, allowing more
682 // flexible arguments
683 if ( !is_array( $elements ) ) {
684 $elements = array( $elements );
685 // If there's a series of elements, reverse them when in RTL mode
686 } else if ( $wgContLang->isRTL() ) {
687 $elements = array_reverse( $elements );
688 }
689 // Render elements
690 foreach ( $elements as $name => $element ) {
691 echo "\n<!-- {$name} -->\n";
692 switch ( $element ) {
693 case 'NAMESPACES':
694 ?>
695 <div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
696 <h5><?php $this->msg('namespaces') ?></h5>
697 <ul<?php $this->html('userlangattributes') ?>>
698 <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
699 <li <?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><span><?php echo htmlspecialchars( $link['text'] ) ?></span></a></li>
700 <?php endforeach; ?>
701 </ul>
702 </div>
703 <?php
704 break;
705 case 'VARIANTS':
706 ?>
707 <div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
708 <?php if ( $wgVectorShowVariantName ): ?>
709 <h4>
710 <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
711 <?php if ( stripos( $link['attributes'], 'selected' ) !== false ): ?>
712 <?php echo htmlspecialchars( $link['text'] ) ?>
713 <?php endif; ?>
714 <?php endforeach; ?>
715 </h4>
716 <?php endif; ?>
717 <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
718 <div class="menu">
719 <ul<?php $this->html('userlangattributes') ?>>
720 <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
721 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
722 <?php endforeach; ?>
723 </ul>
724 </div>
725 </div>
726 <?php
727 break;
728 case 'VIEWS':
729 ?>
730 <div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
731 <h5><?php $this->msg('views') ?></h5>
732 <ul<?php $this->html('userlangattributes') ?>>
733 <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
734 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo (array_key_exists('img',$link) ? '<img src="'.$link['img'].'" alt="'.$link['text'].'" />' : '<span>'.htmlspecialchars( $link['text'] ).'</span>') ?></a></li>
735 <?php endforeach; ?>
736 </ul>
737 </div>
738 <?php
739 break;
740 case 'ACTIONS':
741 ?>
742 <div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
743 <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
744 <div class="menu">
745 <ul<?php $this->html('userlangattributes') ?>>
746 <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
747 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
748 <?php endforeach; ?>
749 </ul>
750 </div>
751 </div>
752 <?php
753 break;
754 case 'PERSONAL':
755 ?>
756 <div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
757 <h5><?php $this->msg('personaltools') ?></h5>
758 <ul<?php $this->html('userlangattributes') ?>>
759 <?php foreach($this->data['personal_urls'] as $key => $item): ?>
760 <li <?php echo $item['attributes'] ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php echo $item['key'] ?><?php if(!empty($item['class'])): ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php endif; ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
761 <?php endforeach; ?>
762 </ul>
763 </div>
764 <?php
765 break;
766 case 'SEARCH':
767 ?>
768 <div id="p-search">
769 <h5<?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
770 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
771 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
772 <?php if ( $wgVectorUseSimpleSearch ): ?>
773 <div id="simpleSearch">
774 <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search' ); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search' ) ?>"<?php endif; ?> />
775 <button id="searchButton" type='submit' name='button' <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?>>&#160;</button>
776 </div>
777 <?php else: ?>
778 <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search' ); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search' ) ?>"<?php endif; ?> />
779 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
780 <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
781 <?php endif; ?>
782 </form>
783 </div>
784 <?php
785
786 break;
787 }
788 echo "\n<!-- /{$name} -->\n";
789 }
790 }
791 }