Merge "Tests: Make phpunit providers "public static"."
[mediawiki.git] / includes / SkinLegacy.php
blobb9766a9f7becb379a7ee328efbef56a5e5ba0aae
1 <?php
2 /**
3 * Base class for legacy skins.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
23 class SkinLegacy extends SkinTemplate {
24 var $useHeadElement = true;
25 protected $mWatchLinkNum = 0; // Appended to end of watch link id's
27 /**
28 * Add skin specific stylesheets
29 * @param $out OutputPage
31 function setupSkinUserCss( OutputPage $out ) {
32 $out->addModuleStyles( 'mediawiki.legacy.shared' );
33 $out->addModuleStyles( 'mediawiki.legacy.oldshared' );
36 public function commonPrintStylesheet() {
37 return true;
40 /**
41 * This was for the old skins and for users with 640x480 screen.
42 * Please note old skins are still used and might prove useful for
43 * users having old computers or visually impaired.
45 var $mSuppressQuickbar = false;
47 /**
48 * Suppress the quickbar from the output, only for skin supporting
49 * the quickbar
51 public function suppressQuickbar() {
52 $this->mSuppressQuickbar = true;
55 /**
56 * Return whether the quickbar should be suppressed from the output
58 * @return Boolean
60 public function isQuickbarSuppressed() {
61 return $this->mSuppressQuickbar;
64 function qbSetting() {
65 global $wgUser;
66 if ( $this->isQuickbarSuppressed() ) {
67 return 0;
69 $q = $wgUser->getOption( 'quickbar', 0 );
70 if( $q == 5 ) {
71 # 5 is the default, which chooses the setting
72 # depending on the directionality of your interface language
73 global $wgLang;
74 return $wgLang->isRTL() ? 2 : 1;
76 return $q;
81 class LegacyTemplate extends BaseTemplate {
83 // How many search boxes have we made? Avoid duplicate id's.
84 protected $searchboxes = '';
86 function execute() {
87 $this->html( 'headelement' );
88 echo $this->beforeContent();
89 $this->html( 'bodytext' );
90 echo "\n";
91 echo $this->afterContent();
92 $this->html( 'dataAfterContent' );
93 $this->printTrail();
94 echo "\n</body></html>";
97 /**
98 * This will be called immediately after the "<body>" tag. Split into
99 * two functions to make it easier to subclass.
100 * @return string
102 function beforeContent() {
103 return $this->doBeforeContent();
106 function doBeforeContent() {
107 global $wgLang;
108 wfProfileIn( __METHOD__ );
110 $s = '';
112 $langlinks = $this->otherLanguages();
113 if ( $langlinks ) {
114 $rows = 2;
115 $borderhack = '';
116 } else {
117 $rows = 1;
118 $langlinks = false;
119 $borderhack = 'class="top"';
122 $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
123 "<table cellspacing='0' style='width: 100%;'>\n<tr>\n";
125 if ( $this->getSkin()->qbSetting() == 0 ) {
126 $s .= "<td class='top' style='text-align: left; vertical-align: top;' rowspan='{$rows}'>\n" .
127 $this->getSkin()->logoText( $wgLang->alignStart() ) . '</td>';
130 $l = $wgLang->alignStart();
131 $s .= "<td {$borderhack} style='text-align: $l; vertical-align: top;'>\n";
133 $s .= $this->topLinks();
134 $s .= '<p class="subtitle">' . $this->pageTitleLinks() . "</p>\n";
136 $r = $wgLang->alignEnd();
137 $s .= "</td>\n<td {$borderhack} style='text-align: $r; vertical-align: top;' nowrap='nowrap'>";
138 $s .= $this->nameAndLogin();
139 $s .= "\n<br />" . $this->searchForm() . '</td>';
141 if ( $langlinks ) {
142 $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
145 $s .= "</tr>\n</table>\n</div>\n";
146 $s .= "\n<div id='article'>\n";
148 $notice = $this->getSkin()->getSiteNotice();
150 if ( $notice ) {
151 $s .= "\n<div id='siteNotice'>$notice</div>\n";
153 $s .= $this->pageTitle();
154 $s .= $this->pageSubtitle();
155 $s .= $this->getSkin()->getCategories();
157 wfProfileOut( __METHOD__ );
158 return $s;
162 * This gets called shortly before the "</body>" tag.
163 * @return String HTML to be put before "</body>"
165 function afterContent() {
166 return $this->doAfterContent();
169 /** overloaded by derived classes
170 * @return string
172 function doAfterContent() {
173 return '</div></div>';
176 function searchForm() {
177 global $wgRequest, $wgUseTwoButtonsSearchForm;
179 $search = $wgRequest->getText( 'search' );
181 $s = '<form id="searchform' . $this->searchboxes . '" name="search" class="inline" method="post" action="'
182 . $this->getSkin()->escapeSearchLink() . "\">\n"
183 . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="'
184 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n"
185 . '<input type="submit" name="go" value="' . wfMessage( 'searcharticle' )->text() . '" />';
187 if ( $wgUseTwoButtonsSearchForm ) {
188 $s .= '&#160;<input type="submit" name="fulltext" value="' . wfMessage( 'searchbutton' )->text() . "\" />\n";
189 } else {
190 $s .= ' <a href="' . $this->getSkin()->escapeSearchLink() . '" rel="search">' . wfMessage( 'powersearch-legend' )->text() . "</a>\n";
193 $s .= '</form>';
195 // Ensure unique id's for search boxes made after the first
196 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
198 return $s;
201 function pageStats() {
202 $ret = array();
203 $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' );
205 foreach( $items as $item ) {
206 if ( $this->data[$item] !== false ) {
207 $ret[] = $this->data[$item];
211 return implode( ' ', $ret );
214 function topLinks() {
215 global $wgOut;
217 $s = array(
218 $this->getSkin()->mainPageLink(),
219 Linker::specialLink( 'Recentchanges' )
222 if ( $wgOut->isArticleRelated() ) {
223 $s[] = $this->editThisPage();
224 $s[] = $this->historyLink();
227 # Many people don't like this dropdown box
228 # $s[] = $this->specialPagesList();
230 if ( $this->variantLinks() ) {
231 $s[] = $this->variantLinks();
234 if ( $this->extensionTabLinks() ) {
235 $s[] = $this->extensionTabLinks();
238 // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline
239 return implode( $s, wfMessage( 'pipe-separator' )->escaped() . "\n" );
243 * Language/charset variant links for classic-style skins
244 * @return string
246 function variantLinks() {
247 $s = '';
249 /* show links to different language variants */
250 global $wgDisableLangConversion, $wgLang;
252 $title = $this->getSkin()->getTitle();
253 $lang = $title->getPageLanguage();
254 $variants = $lang->getVariants();
256 if ( !$wgDisableLangConversion && count( $variants ) > 1
257 && !$title->isSpecialPage() ) {
258 foreach ( $variants as $code ) {
259 $varname = $lang->getVariantname( $code );
261 if ( $varname == 'disable' ) {
262 continue;
264 $s = $wgLang->pipeList( array(
266 '<a href="' . htmlspecialchars( $title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '" hreflang="' . $code . '">' . htmlspecialchars( $varname ) . '</a>'
267 ) );
271 return $s;
275 * Compatibility for extensions adding functionality through tabs.
276 * Eventually these old skins should be replaced with SkinTemplate-based
277 * versions, sigh...
278 * @return string
279 * @todo Exterminate! ...that, and replace it with normal SkinTemplate stuff
281 function extensionTabLinks() {
282 $tabs = array();
283 $out = '';
284 $s = array();
285 wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) );
286 foreach ( $tabs as $tab ) {
287 $s[] = Xml::element( 'a',
288 array( 'href' => $tab['href'] ),
289 $tab['text'] );
292 if ( count( $s ) ) {
293 global $wgLang;
295 $out = wfMessage( 'pipe-separator' )->escaped();
296 $out .= $wgLang->pipeList( $s );
299 return $out;
302 function bottomLinks() {
303 global $wgOut, $wgUser;
304 $sep = wfMessage( 'pipe-separator' )->escaped() . "\n";
306 $s = '';
307 if ( $wgOut->isArticleRelated() ) {
308 $element[] = '<strong>' . $this->editThisPage() . '</strong>';
310 if ( $wgUser->isLoggedIn() ) {
311 $element[] = $this->watchThisPage();
314 $element[] = $this->talkLink();
315 $element[] = $this->historyLink();
316 $element[] = $this->whatLinksHere();
317 $element[] = $this->watchPageLinksLink();
319 $title = $this->getSkin()->getTitle();
321 if (
322 $title->getNamespace() == NS_USER ||
323 $title->getNamespace() == NS_USER_TALK
325 $id = User::idFromName( $title->getText() );
326 $ip = User::isIP( $title->getText() );
328 # Both anons and non-anons have contributions list
329 if ( $id || $ip ) {
330 $element[] = $this->userContribsLink();
333 if ( $this->getSkin()->showEmailUser( $id ) ) {
334 $element[] = $this->emailUserLink();
338 $s = implode( $element, $sep );
340 if ( $title->getArticleID() ) {
341 $s .= "\n<br />";
343 // Delete/protect/move links for privileged users
344 if ( $wgUser->isAllowed( 'delete' ) ) {
345 $s .= $this->deleteThisPage();
348 if ( $wgUser->isAllowed( 'protect' ) && $title->getRestrictionTypes() ) {
349 $s .= $sep . $this->protectThisPage();
352 if ( $wgUser->isAllowed( 'move' ) ) {
353 $s .= $sep . $this->moveThisPage();
357 $s .= "<br />\n" . $this->otherLanguages();
360 return $s;
363 function otherLanguages() {
364 global $wgOut, $wgLang, $wgHideInterlanguageLinks;
366 if ( $wgHideInterlanguageLinks ) {
367 return '';
370 $a = $wgOut->getLanguageLinks();
372 if ( 0 == count( $a ) ) {
373 return '';
376 $s = wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text();
377 $first = true;
379 if ( $wgLang->isRTL() ) {
380 $s .= '<span dir="ltr">';
383 foreach ( $a as $l ) {
384 if ( !$first ) {
385 $s .= wfMessage( 'pipe-separator' )->escaped();
388 $first = false;
390 $nt = Title::newFromText( $l );
391 $text = Language::fetchLanguageName( $nt->getInterwiki() );
393 $s .= Html::element( 'a',
394 array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ),
395 $text == '' ? $l : $text );
398 if ( $wgLang->isRTL() ) {
399 $s .= '</span>';
402 return $s;
406 * Show a drop-down box of special pages
407 * @return string
409 function specialPagesList() {
410 global $wgScript;
412 $select = new XmlSelect( 'title' );
413 $pages = SpecialPageFactory::getUsablePages();
414 array_unshift( $pages, SpecialPageFactory::getPage( 'SpecialPages' ) );
415 foreach ( $pages as $obj ) {
416 $select->addOption( $obj->getDescription(),
417 $obj->getTitle()->getPrefixedDBkey() );
420 return Html::rawElement( 'form',
421 array( 'id' => 'specialpages', 'method' => 'get', 'action' => $wgScript ),
422 $select->getHTML() . Xml::submitButton( wfMessage( 'go' )->text() ) );
425 function pageTitleLinks() {
426 global $wgOut, $wgUser, $wgRequest, $wgLang;
428 $oldid = $wgRequest->getVal( 'oldid' );
429 $diff = $wgRequest->getVal( 'diff' );
430 $action = $wgRequest->getText( 'action' );
432 $skin = $this->getSkin();
433 $title = $skin->getTitle();
435 $s[] = $this->printableLink();
436 $disclaimer = $skin->disclaimerLink(); # may be empty
438 if ( $disclaimer ) {
439 $s[] = $disclaimer;
442 $privacy = $skin->privacyLink(); # may be empty too
444 if ( $privacy ) {
445 $s[] = $privacy;
448 if ( $wgOut->isArticleRelated() ) {
449 if ( $title->getNamespace() == NS_FILE ) {
450 $image = wfFindFile( $title );
452 if ( $image ) {
453 $href = $image->getURL();
454 $s[] = Html::element( 'a', array( 'href' => $href,
455 'title' => $href ), $title->getText() );
461 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
462 $s[] .= Linker::linkKnown(
463 $title,
464 wfMessage( 'currentrev' )->text()
468 if ( $wgUser->getNewtalk() ) {
469 # do not show "You have new messages" text when we are viewing our
470 # own talk page
471 if ( !$title->equals( $wgUser->getTalkPage() ) ) {
472 $tl = Linker::linkKnown(
473 $wgUser->getTalkPage(),
474 wfMessage( 'newmessageslink' )->escaped(),
475 array(),
476 array( 'redirect' => 'no' )
479 $dl = Linker::linkKnown(
480 $wgUser->getTalkPage(),
481 wfMessage( 'newmessagesdifflink' )->escaped(),
482 array(),
483 array( 'diff' => 'cur' )
485 $s[] = '<strong>' . wfMessage( 'youhavenewmessages', $tl, $dl )->text() . '</strong>';
486 # disable caching
487 $wgOut->setSquidMaxage( 0 );
488 $wgOut->enableClientCache( false );
492 $undelete = $skin->getUndeleteLink();
494 if ( !empty( $undelete ) ) {
495 $s[] = $undelete;
498 return $wgLang->pipeList( $s );
502 * Gets the h1 element with the page title.
503 * @return string
505 function pageTitle() {
506 global $wgOut;
507 $s = '<h1 class="pagetitle"><span dir="auto">' . $wgOut->getPageTitle() . '</span></h1>';
508 return $s;
511 function pageSubtitle() {
512 global $wgOut;
514 $sub = $wgOut->getSubtitle();
516 if ( $sub == '' ) {
517 global $wgExtraSubtitle;
518 $sub = wfMessage( 'tagline' )->parse() . $wgExtraSubtitle;
521 $subpages = $this->getSkin()->subPageSubtitle();
522 $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
523 $s = "<p class='subtitle'>{$sub}</p>\n";
525 return $s;
528 function printableLink() {
529 global $wgOut, $wgRequest, $wgLang;
531 $s = array();
533 if ( !$wgOut->isPrintable() ) {
534 $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl(
535 $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) );
536 $s[] = "<a href=\"$printurl\" rel=\"alternate\">"
537 . wfMessage( 'printableversion' )->text() . '</a>';
540 if ( $wgOut->isSyndicated() ) {
541 foreach ( $wgOut->getSyndicationLinks() as $format => $link ) {
542 $feedurl = htmlspecialchars( $link );
543 $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
544 . " class=\"feedlink\">" . wfMessage( "feed-$format" )->escaped() . "</a>";
547 return $wgLang->pipeList( $s );
551 * @deprecated in 1.19
552 * @return string
554 function getQuickbarCompensator( $rows = 1 ) {
555 wfDeprecated( __METHOD__, '1.19' );
556 return "<td style='width: 152px;' rowspan='{$rows}'>&#160;</td>";
559 function editThisPage() {
560 global $wgOut;
562 if ( !$wgOut->isArticleRelated() ) {
563 $s = wfMessage( 'protectedpage' )->text();
564 } else {
565 $title = $this->getSkin()->getTitle();
566 if ( $title->quickUserCan( 'edit' ) && $title->exists() ) {
567 $t = wfMessage( 'editthispage' )->text();
568 } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) {
569 $t = wfMessage( 'create-this-page' )->text();
570 } else {
571 $t = wfMessage( 'viewsource' )->text();
574 $s = Linker::linkKnown(
575 $title,
577 array(),
578 $this->getSkin()->editUrlOptions()
582 return $s;
585 function deleteThisPage() {
586 global $wgUser, $wgRequest;
588 $diff = $wgRequest->getVal( 'diff' );
589 $title = $this->getSkin()->getTitle();
591 if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
592 $t = wfMessage( 'deletethispage' )->text();
594 $s = Linker::linkKnown(
595 $title,
597 array(),
598 array( 'action' => 'delete' )
600 } else {
601 $s = '';
604 return $s;
607 function protectThisPage() {
608 global $wgUser, $wgRequest;
610 $diff = $wgRequest->getVal( 'diff' );
611 $title = $this->getSkin()->getTitle();
613 if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) && $title->getRestrictionTypes() ) {
614 if ( $title->isProtected() ) {
615 $text = wfMessage( 'unprotectthispage' )->text();
616 $query = array( 'action' => 'unprotect' );
617 } else {
618 $text = wfMessage( 'protectthispage' )->text();
619 $query = array( 'action' => 'protect' );
622 $s = Linker::linkKnown(
623 $title,
624 $text,
625 array(),
626 $query
628 } else {
629 $s = '';
632 return $s;
635 function watchThisPage() {
636 global $wgOut, $wgUser;
637 ++$this->mWatchLinkNum;
639 // Cache
640 $title = $this->getSkin()->getTitle();
642 if ( $wgOut->isArticleRelated() ) {
643 if ( $wgUser->isWatched( $title ) ) {
644 $text = wfMessage( 'unwatchthispage' )->text();
645 $query = array(
646 'action' => 'unwatch',
647 'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ),
649 $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
650 } else {
651 $text = wfMessage( 'watchthispage' )->text();
652 $query = array(
653 'action' => 'watch',
654 'token' => WatchAction::getWatchToken( $title, $wgUser ),
656 $id = 'mw-watch-link' . $this->mWatchLinkNum;
659 $s = Linker::linkKnown(
660 $title,
661 $text,
662 array( 'id' => $id ),
663 $query
665 } else {
666 $s = wfMessage( 'notanarticle' )->text();
669 return $s;
672 function moveThisPage() {
673 if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
674 return Linker::linkKnown(
675 SpecialPage::getTitleFor( 'Movepage' ),
676 wfMessage( 'movethispage' )->text(),
677 array(),
678 array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() )
680 } else {
681 // no message if page is protected - would be redundant
682 return '';
686 function historyLink() {
687 return Linker::link(
688 $this->getSkin()->getTitle(),
689 wfMessage( 'history' )->escaped(),
690 array( 'rel' => 'archives' ),
691 array( 'action' => 'history' )
695 function whatLinksHere() {
696 return Linker::linkKnown(
697 SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
698 wfMessage( 'whatlinkshere' )->escaped()
702 function userContribsLink() {
703 return Linker::linkKnown(
704 SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
705 wfMessage( 'contributions' )->escaped()
709 function emailUserLink() {
710 return Linker::linkKnown(
711 SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
712 wfMessage( 'emailuser' )->escaped()
716 function watchPageLinksLink() {
717 global $wgOut;
719 if ( !$wgOut->isArticleRelated() ) {
720 return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped();
721 } else {
722 return Linker::linkKnown(
723 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
724 wfMessage( 'recentchangeslinked-toolbox' )->escaped()
729 function talkLink() {
730 $title = $this->getSkin()->getTitle();
731 if ( NS_SPECIAL == $title->getNamespace() ) {
732 # No discussion links for special pages
733 return '';
736 $linkOptions = array();
738 if ( $title->isTalkPage() ) {
739 $link = $title->getSubjectPage();
740 switch( $link->getNamespace() ) {
741 case NS_MAIN:
742 $text = wfMessage( 'articlepage' );
743 break;
744 case NS_USER:
745 $text = wfMessage( 'userpage' );
746 break;
747 case NS_PROJECT:
748 $text = wfMessage( 'projectpage' );
749 break;
750 case NS_FILE:
751 $text = wfMessage( 'imagepage' );
752 # Make link known if image exists, even if the desc. page doesn't.
753 if ( wfFindFile( $link ) )
754 $linkOptions[] = 'known';
755 break;
756 case NS_MEDIAWIKI:
757 $text = wfMessage( 'mediawikipage' );
758 break;
759 case NS_TEMPLATE:
760 $text = wfMessage( 'templatepage' );
761 break;
762 case NS_HELP:
763 $text = wfMessage( 'viewhelppage' );
764 break;
765 case NS_CATEGORY:
766 $text = wfMessage( 'categorypage' );
767 break;
768 default:
769 $text = wfMessage( 'articlepage' );
771 } else {
772 $link = $title->getTalkPage();
773 $text = wfMessage( 'talkpage' );
776 $s = Linker::link( $link, $text->text(), array(), array(), $linkOptions );
778 return $s;
781 function commentLink() {
782 global $wgOut;
784 $title = $this->getSkin()->getTitle();
785 if ( $title->isSpecialPage() ) {
786 return '';
789 # __NEWSECTIONLINK___ changes behavior here
790 # If it is present, the link points to this page, otherwise
791 # it points to the talk page
792 if ( !$title->isTalkPage() && !$wgOut->showNewSectionLink() ) {
793 $title = $title->getTalkPage();
796 return Linker::linkKnown(
797 $title,
798 wfMessage( 'postcomment' )->text(),
799 array(),
800 array(
801 'action' => 'edit',
802 'section' => 'new'
807 function getUploadLink() {
808 global $wgUploadNavigationUrl;
810 if ( $wgUploadNavigationUrl ) {
811 # Using an empty class attribute to avoid automatic setting of "external" class
812 return Linker::makeExternalLink( $wgUploadNavigationUrl,
813 wfMessage( 'upload' )->escaped(),
814 false, null, array( 'class' => '' ) );
815 } else {
816 return Linker::linkKnown(
817 SpecialPage::getTitleFor( 'Upload' ),
818 wfMessage( 'upload' )->escaped()
823 function nameAndLogin() {
824 global $wgUser, $wgLang, $wgRequest;
826 $returnTo = $this->getSkin()->getTitle();
827 $ret = '';
829 if ( $wgUser->isAnon() ) {
830 if ( $this->getSkin()->showIPinHeader() ) {
831 $name = $wgRequest->getIP();
833 $talkLink = Linker::link( $wgUser->getTalkPage(),
834 $wgLang->getNsText( NS_TALK ) );
835 $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped();
837 $ret .= "$name $talkLink";
838 } else {
839 $ret .= wfMessage( 'notloggedin' )->text();
842 $query = array();
844 if ( !$returnTo->isSpecial( 'Userlogout' ) ) {
845 $query['returnto'] = $returnTo->getPrefixedDBkey();
848 $loginlink = $wgUser->isAllowed( 'createaccount' )
849 ? 'nav-login-createaccount'
850 : 'login';
851 $ret .= "\n<br />" . Linker::link(
852 SpecialPage::getTitleFor( 'Userlogin' ),
853 wfMessage( $loginlink )->text(), array(), $query
855 } else {
856 $talkLink = Linker::link( $wgUser->getTalkPage(),
857 $wgLang->getNsText( NS_TALK ) );
858 $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped();
860 $ret .= Linker::link( $wgUser->getUserPage(),
861 htmlspecialchars( $wgUser->getName() ) );
862 $ret .= " $talkLink<br />";
863 $ret .= $wgLang->pipeList( array(
864 Linker::link(
865 SpecialPage::getTitleFor( 'Userlogout' ), wfMessage( 'logout' )->text(),
866 array(), array( 'returnto' => $returnTo->getPrefixedDBkey() )
868 Linker::specialLink( 'Preferences' ),
869 ) );
872 $ret = $wgLang->pipeList( array(
873 $ret,
874 Linker::link(
875 Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ),
876 wfMessage( 'help' )->text()
878 ) );
880 return $ret;