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