MediaWiki
REL1_21
|
00001 <?php 00023 class SkinLegacy extends SkinTemplate { 00024 var $useHeadElement = true; 00025 protected $mWatchLinkNum = 0; // Appended to end of watch link id's 00026 00031 function setupSkinUserCss( OutputPage $out ) { 00032 $out->addModuleStyles( 'mediawiki.legacy.shared' ); 00033 $out->addModuleStyles( 'mediawiki.legacy.oldshared' ); 00034 } 00035 00036 public function commonPrintStylesheet() { 00037 return true; 00038 } 00039 00045 var $mSuppressQuickbar = false; 00046 00051 public function suppressQuickbar() { 00052 $this->mSuppressQuickbar = true; 00053 } 00054 00060 public function isQuickbarSuppressed() { 00061 return $this->mSuppressQuickbar; 00062 } 00063 00064 function qbSetting() { 00065 global $wgUser; 00066 if ( $this->isQuickbarSuppressed() ) { 00067 return 0; 00068 } 00069 $q = $wgUser->getOption( 'quickbar', 0 ); 00070 if( $q == 5 ) { 00071 # 5 is the default, which chooses the setting 00072 # depending on the directionality of your interface language 00073 global $wgLang; 00074 return $wgLang->isRTL() ? 2 : 1; 00075 } 00076 return $q; 00077 } 00078 00079 } 00080 00081 class LegacyTemplate extends BaseTemplate { 00082 00083 // How many search boxes have we made? Avoid duplicate id's. 00084 protected $searchboxes = ''; 00085 00086 function execute() { 00087 $this->html( 'headelement' ); 00088 echo $this->beforeContent(); 00089 $this->html( 'bodytext' ); 00090 echo "\n"; 00091 echo $this->afterContent(); 00092 $this->html( 'dataAfterContent' ); 00093 $this->printTrail(); 00094 echo "\n</body></html>"; 00095 } 00096 00102 function beforeContent() { 00103 return $this->doBeforeContent(); 00104 } 00105 00106 function doBeforeContent() { 00107 global $wgLang; 00108 wfProfileIn( __METHOD__ ); 00109 00110 $s = ''; 00111 00112 $langlinks = $this->otherLanguages(); 00113 if ( $langlinks ) { 00114 $rows = 2; 00115 $borderhack = ''; 00116 } else { 00117 $rows = 1; 00118 $langlinks = false; 00119 $borderhack = 'class="top"'; 00120 } 00121 00122 $s .= "\n<div id='content'>\n<div id='topbar'>\n" . 00123 "<table cellspacing='0' style='width: 100%;'>\n<tr>\n"; 00124 00125 if ( $this->getSkin()->qbSetting() == 0 ) { 00126 $s .= "<td class='top' style='text-align: left; vertical-align: top;' rowspan='{$rows}'>\n" . 00127 $this->getSkin()->logoText( $wgLang->alignStart() ) . '</td>'; 00128 } 00129 00130 $l = $wgLang->alignStart(); 00131 $s .= "<td {$borderhack} style='text-align: $l; vertical-align: top;'>\n"; 00132 00133 $s .= $this->topLinks(); 00134 $s .= '<p class="subtitle">' . $this->pageTitleLinks() . "</p>\n"; 00135 00136 $r = $wgLang->alignEnd(); 00137 $s .= "</td>\n<td {$borderhack} style='text-align: $r; vertical-align: top;' nowrap='nowrap'>"; 00138 $s .= $this->nameAndLogin(); 00139 $s .= "\n<br />" . $this->searchForm() . '</td>'; 00140 00141 if ( $langlinks ) { 00142 $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n"; 00143 } 00144 00145 $s .= "</tr>\n</table>\n</div>\n"; 00146 $s .= "\n<div id='article'>\n"; 00147 00148 $notice = $this->getSkin()->getSiteNotice(); 00149 00150 if ( $notice ) { 00151 $s .= "\n<div id='siteNotice'>$notice</div>\n"; 00152 } 00153 $s .= $this->pageTitle(); 00154 $s .= $this->pageSubtitle(); 00155 $s .= $this->getSkin()->getCategories(); 00156 00157 wfProfileOut( __METHOD__ ); 00158 return $s; 00159 } 00160 00165 function afterContent() { 00166 return $this->doAfterContent(); 00167 } 00168 00172 function doAfterContent() { 00173 return '</div></div>'; 00174 } 00175 00176 function searchForm() { 00177 global $wgRequest, $wgUseTwoButtonsSearchForm; 00178 00179 $search = $wgRequest->getText( 'search' ); 00180 00181 $s = '<form id="searchform' . $this->searchboxes . '" name="search" class="inline" method="post" action="' 00182 . $this->getSkin()->escapeSearchLink() . "\">\n" 00183 . '<input type="text" id="searchInput' . $this->searchboxes . '" name="search" size="19" value="' 00184 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />\n" 00185 . '<input type="submit" name="go" value="' . wfMessage( 'searcharticle' )->text() . '" />'; 00186 00187 if ( $wgUseTwoButtonsSearchForm ) { 00188 $s .= ' <input type="submit" name="fulltext" value="' . wfMessage( 'searchbutton' )->text() . "\" />\n"; 00189 } else { 00190 $s .= ' <a href="' . $this->getSkin()->escapeSearchLink() . '" rel="search">' . wfMessage( 'powersearch-legend' )->text() . "</a>\n"; 00191 } 00192 00193 $s .= '</form>'; 00194 00195 // Ensure unique id's for search boxes made after the first 00196 $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1; 00197 00198 return $s; 00199 } 00200 00201 function pageStats() { 00202 $ret = array(); 00203 $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' ); 00204 00205 foreach( $items as $item ) { 00206 if ( $this->data[$item] !== false ) { 00207 $ret[] = $this->data[$item]; 00208 } 00209 } 00210 00211 return implode( ' ', $ret ); 00212 } 00213 00214 function topLinks() { 00215 global $wgOut; 00216 00217 $s = array( 00218 $this->getSkin()->mainPageLink(), 00219 Linker::specialLink( 'Recentchanges' ) 00220 ); 00221 00222 if ( $wgOut->isArticleRelated() ) { 00223 $s[] = $this->editThisPage(); 00224 $s[] = $this->historyLink(); 00225 } 00226 00227 # Many people don't like this dropdown box 00228 # $s[] = $this->specialPagesList(); 00229 00230 if ( $this->variantLinks() ) { 00231 $s[] = $this->variantLinks(); 00232 } 00233 00234 if ( $this->extensionTabLinks() ) { 00235 $s[] = $this->extensionTabLinks(); 00236 } 00237 00238 // @todo FIXME: Is using Language::pipeList impossible here? Do not quite understand the use of the newline 00239 return implode( $s, wfMessage( 'pipe-separator' )->escaped() . "\n" ); 00240 } 00241 00246 function variantLinks() { 00247 $s = ''; 00248 00249 /* show links to different language variants */ 00250 global $wgDisableLangConversion, $wgLang; 00251 00252 $title = $this->getSkin()->getTitle(); 00253 $lang = $title->getPageLanguage(); 00254 $variants = $lang->getVariants(); 00255 00256 if ( !$wgDisableLangConversion && count( $variants ) > 1 00257 && !$title->isSpecialPage() ) { 00258 foreach ( $variants as $code ) { 00259 $varname = $lang->getVariantname( $code ); 00260 00261 if ( $varname == 'disable' ) { 00262 continue; 00263 } 00264 $s = $wgLang->pipeList( array( 00265 $s, 00266 '<a href="' . htmlspecialchars( $title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '" hreflang="' . $code . '">' . htmlspecialchars( $varname ) . '</a>' 00267 ) ); 00268 } 00269 } 00270 00271 return $s; 00272 } 00273 00281 function extensionTabLinks() { 00282 $tabs = array(); 00283 $out = ''; 00284 $s = array(); 00285 wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) ); 00286 foreach ( $tabs as $tab ) { 00287 $s[] = Xml::element( 'a', 00288 array( 'href' => $tab['href'] ), 00289 $tab['text'] ); 00290 } 00291 00292 if ( count( $s ) ) { 00293 global $wgLang; 00294 00295 $out = wfMessage( 'pipe-separator' )->escaped(); 00296 $out .= $wgLang->pipeList( $s ); 00297 } 00298 00299 return $out; 00300 } 00301 00302 function bottomLinks() { 00303 global $wgOut, $wgUser; 00304 $sep = wfMessage( 'pipe-separator' )->escaped() . "\n"; 00305 00306 $s = ''; 00307 if ( $wgOut->isArticleRelated() ) { 00308 $element[] = '<strong>' . $this->editThisPage() . '</strong>'; 00309 00310 if ( $wgUser->isLoggedIn() ) { 00311 $element[] = $this->watchThisPage(); 00312 } 00313 00314 $element[] = $this->talkLink(); 00315 $element[] = $this->historyLink(); 00316 $element[] = $this->whatLinksHere(); 00317 $element[] = $this->watchPageLinksLink(); 00318 00319 $title = $this->getSkin()->getTitle(); 00320 00321 if ( 00322 $title->getNamespace() == NS_USER || 00323 $title->getNamespace() == NS_USER_TALK 00324 ) { 00325 $id = User::idFromName( $title->getText() ); 00326 $ip = User::isIP( $title->getText() ); 00327 00328 # Both anons and non-anons have contributions list 00329 if ( $id || $ip ) { 00330 $element[] = $this->userContribsLink(); 00331 } 00332 00333 if ( $this->getSkin()->showEmailUser( $id ) ) { 00334 $element[] = $this->emailUserLink(); 00335 } 00336 } 00337 00338 $s = implode( $element, $sep ); 00339 00340 if ( $title->getArticleID() ) { 00341 $s .= "\n<br />"; 00342 00343 // Delete/protect/move links for privileged users 00344 if ( $wgUser->isAllowed( 'delete' ) ) { 00345 $s .= $this->deleteThisPage(); 00346 } 00347 00348 if ( $wgUser->isAllowed( 'protect' ) && $title->getRestrictionTypes() ) { 00349 $s .= $sep . $this->protectThisPage(); 00350 } 00351 00352 if ( $wgUser->isAllowed( 'move' ) ) { 00353 $s .= $sep . $this->moveThisPage(); 00354 } 00355 } 00356 00357 $s .= "<br />\n" . $this->otherLanguages(); 00358 } 00359 00360 return $s; 00361 } 00362 00363 function otherLanguages() { 00364 global $wgOut, $wgLang, $wgHideInterlanguageLinks; 00365 00366 if ( $wgHideInterlanguageLinks ) { 00367 return ''; 00368 } 00369 00370 $a = $wgOut->getLanguageLinks(); 00371 00372 if ( 0 == count( $a ) ) { 00373 return ''; 00374 } 00375 00376 $s = wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text(); 00377 $first = true; 00378 00379 if ( $wgLang->isRTL() ) { 00380 $s .= '<span dir="ltr">'; 00381 } 00382 00383 foreach ( $a as $l ) { 00384 if ( !$first ) { 00385 $s .= wfMessage( 'pipe-separator' )->escaped(); 00386 } 00387 00388 $first = false; 00389 00390 $nt = Title::newFromText( $l ); 00391 $text = Language::fetchLanguageName( $nt->getInterwiki() ); 00392 00393 $s .= Html::element( 'a', 00394 array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ), 00395 $text == '' ? $l : $text ); 00396 } 00397 00398 if ( $wgLang->isRTL() ) { 00399 $s .= '</span>'; 00400 } 00401 00402 return $s; 00403 } 00404 00409 function specialPagesList() { 00410 global $wgScript; 00411 00412 $select = new XmlSelect( 'title' ); 00413 $pages = SpecialPageFactory::getUsablePages(); 00414 array_unshift( $pages, SpecialPageFactory::getPage( 'SpecialPages' ) ); 00415 foreach ( $pages as $obj ) { 00416 $select->addOption( $obj->getDescription(), 00417 $obj->getTitle()->getPrefixedDBkey() ); 00418 } 00419 00420 return Html::rawElement( 'form', 00421 array( 'id' => 'specialpages', 'method' => 'get', 'action' => $wgScript ), 00422 $select->getHTML() . Xml::submitButton( wfMessage( 'go' )->text() ) ); 00423 } 00424 00425 function pageTitleLinks() { 00426 global $wgOut, $wgUser, $wgRequest, $wgLang; 00427 00428 $oldid = $wgRequest->getVal( 'oldid' ); 00429 $diff = $wgRequest->getVal( 'diff' ); 00430 $action = $wgRequest->getText( 'action' ); 00431 00432 $skin = $this->getSkin(); 00433 $title = $skin->getTitle(); 00434 00435 $s[] = $this->printableLink(); 00436 $disclaimer = $skin->disclaimerLink(); # may be empty 00437 00438 if ( $disclaimer ) { 00439 $s[] = $disclaimer; 00440 } 00441 00442 $privacy = $skin->privacyLink(); # may be empty too 00443 00444 if ( $privacy ) { 00445 $s[] = $privacy; 00446 } 00447 00448 if ( $wgOut->isArticleRelated() ) { 00449 if ( $title->getNamespace() == NS_FILE ) { 00450 $image = wfFindFile( $title ); 00451 00452 if ( $image ) { 00453 $href = $image->getURL(); 00454 $s[] = Html::element( 'a', array( 'href' => $href, 00455 'title' => $href ), $title->getText() ); 00456 00457 } 00458 } 00459 } 00460 00461 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) { 00462 $s[] .= Linker::linkKnown( 00463 $title, 00464 wfMessage( 'currentrev' )->text() 00465 ); 00466 } 00467 00468 if ( $wgUser->getNewtalk() ) { 00469 # do not show "You have new messages" text when we are viewing our 00470 # own talk page 00471 if ( !$title->equals( $wgUser->getTalkPage() ) ) { 00472 $tl = Linker::linkKnown( 00473 $wgUser->getTalkPage(), 00474 wfMessage( 'newmessageslink' )->escaped(), 00475 array(), 00476 array( 'redirect' => 'no' ) 00477 ); 00478 00479 $dl = Linker::linkKnown( 00480 $wgUser->getTalkPage(), 00481 wfMessage( 'newmessagesdifflink' )->escaped(), 00482 array(), 00483 array( 'diff' => 'cur' ) 00484 ); 00485 $s[] = '<strong>' . wfMessage( 'youhavenewmessages', $tl, $dl )->text() . '</strong>'; 00486 # disable caching 00487 $wgOut->setSquidMaxage( 0 ); 00488 $wgOut->enableClientCache( false ); 00489 } 00490 } 00491 00492 $undelete = $skin->getUndeleteLink(); 00493 00494 if ( !empty( $undelete ) ) { 00495 $s[] = $undelete; 00496 } 00497 00498 return $wgLang->pipeList( $s ); 00499 } 00500 00505 function pageTitle() { 00506 global $wgOut; 00507 $s = '<h1 class="pagetitle"><span dir="auto">' . $wgOut->getPageTitle() . '</span></h1>'; 00508 return $s; 00509 } 00510 00511 function pageSubtitle() { 00512 global $wgOut; 00513 00514 $sub = $wgOut->getSubtitle(); 00515 00516 if ( $sub == '' ) { 00517 global $wgExtraSubtitle; 00518 $sub = wfMessage( 'tagline' )->parse() . $wgExtraSubtitle; 00519 } 00520 00521 $subpages = $this->getSkin()->subPageSubtitle(); 00522 $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : ''; 00523 $s = "<p class='subtitle'>{$sub}</p>\n"; 00524 00525 return $s; 00526 } 00527 00528 function printableLink() { 00529 global $wgOut, $wgRequest, $wgLang; 00530 00531 $s = array(); 00532 00533 if ( !$wgOut->isPrintable() ) { 00534 $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl( 00535 $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) ); 00536 $s[] = "<a href=\"$printurl\" rel=\"alternate\">" 00537 . wfMessage( 'printableversion' )->text() . '</a>'; 00538 } 00539 00540 if ( $wgOut->isSyndicated() ) { 00541 foreach ( $wgOut->getSyndicationLinks() as $format => $link ) { 00542 $feedurl = htmlspecialchars( $link ); 00543 $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\"" 00544 . " class=\"feedlink\">" . wfMessage( "feed-$format" )->escaped() . "</a>"; 00545 } 00546 } 00547 return $wgLang->pipeList( $s ); 00548 } 00549 00554 function getQuickbarCompensator( $rows = 1 ) { 00555 wfDeprecated( __METHOD__, '1.19' ); 00556 return "<td style='width: 152px;' rowspan='{$rows}'> </td>"; 00557 } 00558 00559 function editThisPage() { 00560 global $wgOut; 00561 00562 if ( !$wgOut->isArticleRelated() ) { 00563 $s = wfMessage( 'protectedpage' )->text(); 00564 } else { 00565 $title = $this->getSkin()->getTitle(); 00566 if ( $title->quickUserCan( 'edit' ) && $title->exists() ) { 00567 $t = wfMessage( 'editthispage' )->text(); 00568 } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) { 00569 $t = wfMessage( 'create-this-page' )->text(); 00570 } else { 00571 $t = wfMessage( 'viewsource' )->text(); 00572 } 00573 00574 $s = Linker::linkKnown( 00575 $title, 00576 $t, 00577 array(), 00578 $this->getSkin()->editUrlOptions() 00579 ); 00580 } 00581 00582 return $s; 00583 } 00584 00585 function deleteThisPage() { 00586 global $wgUser, $wgRequest; 00587 00588 $diff = $wgRequest->getVal( 'diff' ); 00589 $title = $this->getSkin()->getTitle(); 00590 00591 if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) { 00592 $t = wfMessage( 'deletethispage' )->text(); 00593 00594 $s = Linker::linkKnown( 00595 $title, 00596 $t, 00597 array(), 00598 array( 'action' => 'delete' ) 00599 ); 00600 } else { 00601 $s = ''; 00602 } 00603 00604 return $s; 00605 } 00606 00607 function protectThisPage() { 00608 global $wgUser, $wgRequest; 00609 00610 $diff = $wgRequest->getVal( 'diff' ); 00611 $title = $this->getSkin()->getTitle(); 00612 00613 if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) && $title->getRestrictionTypes() ) { 00614 if ( $title->isProtected() ) { 00615 $text = wfMessage( 'unprotectthispage' )->text(); 00616 $query = array( 'action' => 'unprotect' ); 00617 } else { 00618 $text = wfMessage( 'protectthispage' )->text(); 00619 $query = array( 'action' => 'protect' ); 00620 } 00621 00622 $s = Linker::linkKnown( 00623 $title, 00624 $text, 00625 array(), 00626 $query 00627 ); 00628 } else { 00629 $s = ''; 00630 } 00631 00632 return $s; 00633 } 00634 00635 function watchThisPage() { 00636 global $wgOut, $wgUser; 00637 ++$this->mWatchLinkNum; 00638 00639 // Cache 00640 $title = $this->getSkin()->getTitle(); 00641 00642 if ( $wgOut->isArticleRelated() ) { 00643 if ( $wgUser->isWatched( $title ) ) { 00644 $text = wfMessage( 'unwatchthispage' )->text(); 00645 $query = array( 00646 'action' => 'unwatch', 00647 'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ), 00648 ); 00649 $id = 'mw-unwatch-link' . $this->mWatchLinkNum; 00650 } else { 00651 $text = wfMessage( 'watchthispage' )->text(); 00652 $query = array( 00653 'action' => 'watch', 00654 'token' => WatchAction::getWatchToken( $title, $wgUser ), 00655 ); 00656 $id = 'mw-watch-link' . $this->mWatchLinkNum; 00657 } 00658 00659 $s = Linker::linkKnown( 00660 $title, 00661 $text, 00662 array( 'id' => $id ), 00663 $query 00664 ); 00665 } else { 00666 $s = wfMessage( 'notanarticle' )->text(); 00667 } 00668 00669 return $s; 00670 } 00671 00672 function moveThisPage() { 00673 if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) { 00674 return Linker::linkKnown( 00675 SpecialPage::getTitleFor( 'Movepage' ), 00676 wfMessage( 'movethispage' )->text(), 00677 array(), 00678 array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() ) 00679 ); 00680 } else { 00681 // no message if page is protected - would be redundant 00682 return ''; 00683 } 00684 } 00685 00686 function historyLink() { 00687 return Linker::link( 00688 $this->getSkin()->getTitle(), 00689 wfMessage( 'history' )->escaped(), 00690 array( 'rel' => 'archives' ), 00691 array( 'action' => 'history' ) 00692 ); 00693 } 00694 00695 function whatLinksHere() { 00696 return Linker::linkKnown( 00697 SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ), 00698 wfMessage( 'whatlinkshere' )->escaped() 00699 ); 00700 } 00701 00702 function userContribsLink() { 00703 return Linker::linkKnown( 00704 SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ), 00705 wfMessage( 'contributions' )->escaped() 00706 ); 00707 } 00708 00709 function emailUserLink() { 00710 return Linker::linkKnown( 00711 SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ), 00712 wfMessage( 'emailuser' )->escaped() 00713 ); 00714 } 00715 00716 function watchPageLinksLink() { 00717 global $wgOut; 00718 00719 if ( !$wgOut->isArticleRelated() ) { 00720 return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped(); 00721 } else { 00722 return Linker::linkKnown( 00723 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ), 00724 wfMessage( 'recentchangeslinked-toolbox' )->escaped() 00725 ); 00726 } 00727 } 00728 00729 function talkLink() { 00730 $title = $this->getSkin()->getTitle(); 00731 if ( NS_SPECIAL == $title->getNamespace() ) { 00732 # No discussion links for special pages 00733 return ''; 00734 } 00735 00736 $linkOptions = array(); 00737 00738 if ( $title->isTalkPage() ) { 00739 $link = $title->getSubjectPage(); 00740 switch( $link->getNamespace() ) { 00741 case NS_MAIN: 00742 $text = wfMessage( 'articlepage' ); 00743 break; 00744 case NS_USER: 00745 $text = wfMessage( 'userpage' ); 00746 break; 00747 case NS_PROJECT: 00748 $text = wfMessage( 'projectpage' ); 00749 break; 00750 case NS_FILE: 00751 $text = wfMessage( 'imagepage' ); 00752 # Make link known if image exists, even if the desc. page doesn't. 00753 if ( wfFindFile( $link ) ) 00754 $linkOptions[] = 'known'; 00755 break; 00756 case NS_MEDIAWIKI: 00757 $text = wfMessage( 'mediawikipage' ); 00758 break; 00759 case NS_TEMPLATE: 00760 $text = wfMessage( 'templatepage' ); 00761 break; 00762 case NS_HELP: 00763 $text = wfMessage( 'viewhelppage' ); 00764 break; 00765 case NS_CATEGORY: 00766 $text = wfMessage( 'categorypage' ); 00767 break; 00768 default: 00769 $text = wfMessage( 'articlepage' ); 00770 } 00771 } else { 00772 $link = $title->getTalkPage(); 00773 $text = wfMessage( 'talkpage' ); 00774 } 00775 00776 $s = Linker::link( $link, $text->text(), array(), array(), $linkOptions ); 00777 00778 return $s; 00779 } 00780 00781 function commentLink() { 00782 global $wgOut; 00783 00784 $title = $this->getSkin()->getTitle(); 00785 if ( $title->isSpecialPage() ) { 00786 return ''; 00787 } 00788 00789 # __NEWSECTIONLINK___ changes behavior here 00790 # If it is present, the link points to this page, otherwise 00791 # it points to the talk page 00792 if ( !$title->isTalkPage() && !$wgOut->showNewSectionLink() ) { 00793 $title = $title->getTalkPage(); 00794 } 00795 00796 return Linker::linkKnown( 00797 $title, 00798 wfMessage( 'postcomment' )->text(), 00799 array(), 00800 array( 00801 'action' => 'edit', 00802 'section' => 'new' 00803 ) 00804 ); 00805 } 00806 00807 function getUploadLink() { 00808 global $wgUploadNavigationUrl; 00809 00810 if ( $wgUploadNavigationUrl ) { 00811 # Using an empty class attribute to avoid automatic setting of "external" class 00812 return Linker::makeExternalLink( $wgUploadNavigationUrl, 00813 wfMessage( 'upload' )->escaped(), 00814 false, null, array( 'class' => '' ) ); 00815 } else { 00816 return Linker::linkKnown( 00817 SpecialPage::getTitleFor( 'Upload' ), 00818 wfMessage( 'upload' )->escaped() 00819 ); 00820 } 00821 } 00822 00823 function nameAndLogin() { 00824 global $wgUser, $wgLang, $wgRequest; 00825 00826 $returnTo = $this->getSkin()->getTitle(); 00827 $ret = ''; 00828 00829 if ( $wgUser->isAnon() ) { 00830 if ( $this->getSkin()->showIPinHeader() ) { 00831 $name = $wgRequest->getIP(); 00832 00833 $talkLink = Linker::link( $wgUser->getTalkPage(), 00834 $wgLang->getNsText( NS_TALK ) ); 00835 $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped(); 00836 00837 $ret .= "$name $talkLink"; 00838 } else { 00839 $ret .= wfMessage( 'notloggedin' )->text(); 00840 } 00841 00842 $query = array(); 00843 00844 if ( !$returnTo->isSpecial( 'Userlogout' ) ) { 00845 $query['returnto'] = $returnTo->getPrefixedDBkey(); 00846 } 00847 00848 $loginlink = $wgUser->isAllowed( 'createaccount' ) 00849 ? 'nav-login-createaccount' 00850 : 'login'; 00851 $ret .= "\n<br />" . Linker::link( 00852 SpecialPage::getTitleFor( 'Userlogin' ), 00853 wfMessage( $loginlink )->text(), array(), $query 00854 ); 00855 } else { 00856 $talkLink = Linker::link( $wgUser->getTalkPage(), 00857 $wgLang->getNsText( NS_TALK ) ); 00858 $talkLink = wfMessage( 'parentheses' )->rawParams( $talkLink )->escaped(); 00859 00860 $ret .= Linker::link( $wgUser->getUserPage(), 00861 htmlspecialchars( $wgUser->getName() ) ); 00862 $ret .= " $talkLink<br />"; 00863 $ret .= $wgLang->pipeList( array( 00864 Linker::link( 00865 SpecialPage::getTitleFor( 'Userlogout' ), wfMessage( 'logout' )->text(), 00866 array(), array( 'returnto' => $returnTo->getPrefixedDBkey() ) 00867 ), 00868 Linker::specialLink( 'Preferences' ), 00869 ) ); 00870 } 00871 00872 $ret = $wgLang->pipeList( array( 00873 $ret, 00874 Linker::link( 00875 Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ), 00876 wfMessage( 'help' )->text() 00877 ), 00878 ) ); 00879 00880 return $ret; 00881 } 00882 }