2 if ( ! defined( 'MEDIAWIKI' ) )
14 * The main skin class that provide methods and properties for all other skins.
15 * This base class is also the "Standard" skin.
18 class Skin
extends Linker
{
22 var $lastdate, $lastline;
23 var $rc_cache ; # Cache for Enhanced Recent Changes
24 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
28 /** Constructor, call parent constructor */
29 function Skin() { parent
::Linker(); }
32 * Fetch the set of available skins.
33 * @return array of strings
36 static function &getSkinNames() {
37 global $wgValidSkinNames;
38 static $skinsInitialised = false;
39 if ( !$skinsInitialised ) {
40 # Get a list of available skins
41 # Build using the regular expression '^(.*).php$'
42 # Array keys are all lower case, array value keep the case used by filename
44 wfProfileIn( __METHOD__
. '-init' );
45 global $wgStyleDirectory;
46 $skinDir = dir( $wgStyleDirectory );
48 # while code from www.php.net
49 while (false !== ($file = $skinDir->read())) {
50 // Skip non-PHP files, hidden files, and '.dep' includes
52 if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
54 $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
58 $skinsInitialised = true;
59 wfProfileOut( __METHOD__
. '-init' );
61 return $wgValidSkinNames;
65 * Normalize a skin preference value to a form that can be loaded.
66 * If a skin can't be found, it will fall back to the configured
67 * default (or the old 'Classic' skin if that's broken).
72 static function normalizeKey( $key ) {
73 global $wgDefaultSkin;
74 $skinNames = Skin
::getSkinNames();
77 // Don't return the default immediately;
78 // in a misconfiguration we need to fall back.
79 $key = $wgDefaultSkin;
82 if( isset( $skinNames[$key] ) ) {
86 // Older versions of the software used a numeric setting
87 // in the user preferences.
93 if( isset( $fallback[$key] ) ){
94 $key = $fallback[$key];
97 if( isset( $skinNames[$key] ) ) {
100 // The old built-in skin
106 * Factory method for loading a skin of a given type
107 * @param string $key 'monobook', 'standard', etc
111 static function &newFromKey( $key ) {
112 global $wgStyleDirectory;
114 $key = Skin
::normalizeKey( $key );
116 $skinNames = Skin
::getSkinNames();
117 $skinName = $skinNames[$key];
119 # Grab the skin class and initialise it.
120 // Preload base classes to work around APC/PHP5 bug
121 $deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
122 if( file_exists( $deps ) ) include_once( $deps );
123 require_once( "{$wgStyleDirectory}/{$skinName}.php" );
125 # Check if we got if not failback to default skin
126 $className = 'Skin'.$skinName;
127 if( !class_exists( $className ) ) {
128 # DO NOT die if the class isn't found. This breaks maintenance
129 # scripts and can cause a user account to be unrecoverable
130 # except by SQL manipulation if a previously valid skin name
131 # is no longer valid.
132 wfDebug( "Skin class does not exist: $className\n" );
133 $className = 'SkinStandard';
134 require_once( "{$wgStyleDirectory}/Standard.php" );
136 $skin = new $className;
140 /** @return string path to the skin stylesheet */
141 function getStylesheet() {
142 return 'common/wikistandard.css';
145 /** @return string skin name */
146 function getSkinName() {
150 function qbSetting() {
151 global $wgOut, $wgUser;
153 if ( $wgOut->isQuickbarSuppressed() ) { return 0; }
154 $q = $wgUser->getOption( 'quickbar', 0 );
158 function initPage( &$out ) {
159 global $wgFavicon, $wgScriptPath, $wgSitename, $wgLanguageCode, $wgLanguageNames;
161 $fname = 'Skin::initPage';
162 wfProfileIn( $fname );
164 if( false !== $wgFavicon ) {
165 $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
168 # OpenSearch description link
169 $out->addLink( array(
171 'type' => 'application/opensearchdescription+xml',
172 'href' => "$wgScriptPath/opensearch_desc.php",
173 'title' => "$wgSitename ({$wgLanguageNames[$wgLanguageCode]})",
176 $this->addMetadataLinks($out);
178 $this->mRevisionId
= $out->mRevisionId
;
180 $this->preloadExistence();
182 wfProfileOut( $fname );
186 * Preload the existence of three commonly-requested pages in a single query
188 function preloadExistence() {
189 global $wgUser, $wgTitle;
191 if ( $wgTitle->isTalkPage() ) {
192 $otherTab = $wgTitle->getSubjectPage();
194 $otherTab = $wgTitle->getTalkPage();
196 $lb = new LinkBatch( array(
197 $wgUser->getUserPage(),
198 $wgUser->getTalkPage(),
204 function addMetadataLinks( &$out ) {
205 global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
206 global $wgRightsPage, $wgRightsUrl;
208 if( $out->isArticleRelated() ) {
209 # note: buggy CC software only reads first "meta" link
210 if( $wgEnableCreativeCommonsRdf ) {
211 $out->addMetadataLink( array(
212 'title' => 'Creative Commons',
213 'type' => 'application/rdf+xml',
214 'href' => $wgTitle->getLocalURL( 'action=creativecommons') ) );
216 if( $wgEnableDublinCoreRdf ) {
217 $out->addMetadataLink( array(
218 'title' => 'Dublin Core',
219 'type' => 'application/rdf+xml',
220 'href' => $wgTitle->getLocalURL( 'action=dublincore' ) ) );
224 if( $wgRightsPage ) {
225 $copy = Title
::newFromText( $wgRightsPage );
227 $copyright = $copy->getLocalURL();
230 if( !$copyright && $wgRightsUrl ) {
231 $copyright = $wgRightsUrl;
234 $out->addLink( array(
235 'rel' => 'copyright',
236 'href' => $copyright ) );
240 function outputPage( &$out ) {
241 global $wgDebugComments;
243 wfProfileIn( 'Skin::outputPage' );
244 $this->initPage( $out );
246 $out->out( $out->headElement() );
248 $out->out( "\n<body" );
249 $ops = $this->getBodyOptions();
250 foreach ( $ops as $name => $val ) {
251 $out->out( " $name='$val'" );
254 if ( $wgDebugComments ) {
255 $out->out( "<!-- Wiki debugging output:\n" .
256 $out->mDebugtext
. "-->\n" );
259 $out->out( $this->beforeContent() );
261 $out->out( $out->mBodytext
. "\n" );
263 $out->out( $this->afterContent() );
265 $out->out( $this->bottomScripts() );
267 $out->out( $out->reportTime() );
269 $out->out( "\n</body></html>" );
272 static function makeVariablesScript( $data ) {
273 global $wgJsMimeType;
275 $r = "<script type= \"$wgJsMimeType\">/*<![CDATA[*/\n";
276 foreach ( $data as $name => $value ) {
277 $encValue = Xml
::encodeJsVar( $value );
278 $r .= "var $name = $encValue;\n";
280 $r .= "/*]]>*/</script>\n";
286 * Make a <script> tag containing global variables
287 * @param array $data Associative array containing one element:
288 * skinname => the skin name
289 * The odd calling convention is for backwards compatibility
291 static function makeGlobalVariablesScript( $data ) {
292 global $wgStylePath, $wgUser;
293 global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
294 global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
295 global $wgBreakFrames;
297 $ns = $wgTitle->getNamespace();
298 $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ?
$wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
301 'skin' => $data['skinname'],
302 'stylepath' => $wgStylePath,
303 'wgArticlePath' => $wgArticlePath,
304 'wgScriptPath' => $wgScriptPath,
305 'wgServer' => $wgServer,
306 'wgCanonicalNamespace' => $nsname,
307 'wgNamespaceNumber' => $wgTitle->getNamespace(),
308 'wgPageName' => $wgTitle->getPrefixedDBKey(),
309 'wgTitle' => $wgTitle->getText(),
310 'wgArticleId' => $wgTitle->getArticleId(),
311 'wgIsArticle' => $wgOut->isArticle(),
312 'wgUserName' => $wgUser->isAnon() ?
NULL : $wgUser->getName(),
313 'wgUserLanguage' => $wgLang->getCode(),
314 'wgContentLanguage' => $wgContLang->getCode(),
315 'wgBreakFrames' => $wgBreakFrames,
316 'wgCurRevisionId' => isset( $wgArticle ) ?
$wgArticle->getLatest() : 0,
319 return self
::makeVariablesScript( $vars );
322 function getHeadScripts() {
323 global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType, $wgStyleVersion;
325 $r = self
::makeGlobalVariablesScript( array( 'skinname' => $this->getSkinName() ) );
327 $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
330 if ($wgUser->isLoggedIn()) {
331 $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self
::makeUrl('-','action=raw&smaxage=0&gen=js'))."\"><!-- site js --></script>\n";
333 $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self
::makeUrl('-','action=raw&gen=js'))."\"><!-- site js --></script>\n";
336 if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
337 $userpage = $wgUser->getUserPage();
338 $userjs = htmlspecialchars( self
::makeUrl(
339 $userpage->getPrefixedText().'/'.$this->getSkinName().'.js',
340 'action=raw&ctype='.$wgJsMimeType));
341 $r .= '<script type="'.$wgJsMimeType.'" src="'.$userjs."\"></script>\n";
347 * To make it harder for someone to slip a user a fake
348 * user-JavaScript or user-CSS preview, a random token
349 * is associated with the login session. If it's not
350 * passed back with the preview request, we won't render
353 * @param string $action
357 function userCanPreview( $action ) {
358 global $wgTitle, $wgRequest, $wgUser;
360 if( $action != 'submit' )
362 if( !$wgRequest->wasPosted() )
364 if( !$wgTitle->userCanEditCssJsSubpage() )
366 return $wgUser->matchEditToken(
367 $wgRequest->getVal( 'wpEditToken' ) );
370 # get the user/site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way)
371 function getUserStylesheet() {
372 global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion;
373 $sheet = $this->getStylesheet();
374 $s = "@import \"$wgStylePath/common/common.css?$wgStyleVersion\";\n";
375 $s .= "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n";
376 if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n";
378 $query = "usemsgcache=yes&action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
379 $s .= '@import "' . self
::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI
) . "\";\n" .
380 '@import "' . self
::makeNSUrl( ucfirst( $this->getSkinName() . '.css' ), $query, NS_MEDIAWIKI
) . "\";\n";
382 $s .= $this->doGetUserStyles();
387 * This returns MediaWiki:Common.js. For some bizarre reason, it does
388 * *not* return any custom user JS from user subpages. Huh?
392 function getUserJs() {
393 $fname = 'Skin::getUserJs';
394 wfProfileIn( $fname );
397 $s = "/* generated javascript */\n";
398 $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
399 $s .= "\n\n/* MediaWiki:Common.js */\n";
400 $commonJs = wfMsgForContent('Common.js');
401 if ( !wfEmptyMsg ( 'Common.js', $commonJs ) ) {
405 wfProfileOut( $fname );
410 * Return html code that include User stylesheets
412 function getUserStyles() {
413 $s = "<style type='text/css'>\n";
414 $s .= "/*/*/ /*<![CDATA[*/\n"; # <-- Hide the styles from Netscape 4 without hiding them from IE/Mac
415 $s .= $this->getUserStylesheet();
416 $s .= "/*]]>*/ /* */\n";
422 * Some styles that are set by user through the user settings interface.
424 function doGetUserStyles() {
425 global $wgUser, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss;
429 if( $wgAllowUserCss && $wgUser->isLoggedIn() ) { # logged in
430 if($wgTitle->isCssSubpage() && $this->userCanPreview( $wgRequest->getText( 'action' ) ) ) {
431 $s .= $wgRequest->getText('wpTextbox1');
433 $userpage = $wgUser->getUserPage();
434 $s.= '@import "'.self
::makeUrl(
435 $userpage->getPrefixedText().'/'.$this->getSkinName().'.css',
436 'action=raw&ctype=text/css').'";'."\n";
440 return $s . $this->reallyDoGetUserStyles();
443 function reallyDoGetUserStyles() {
446 if (($undopt = $wgUser->getOption("underline")) != 2) {
447 $underline = $undopt ?
'underline' : 'none';
448 $s .= "a { text-decoration: $underline; }\n";
450 if( $wgUser->getOption( 'highlightbroken' ) ) {
451 $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
454 a.new, #quickbar a.new,
455 a.stub, #quickbar a.stub {
457 text-decoration: inherit;
459 a.new:after, #quickbar a.new:after {
462 text-decoration: $underline;
464 a.stub:after, #quickbar a.stub:after {
467 text-decoration: $underline;
471 if( $wgUser->getOption( 'justify' ) ) {
472 $s .= "#article, #bodyContent { text-align: justify; }\n";
474 if( !$wgUser->getOption( 'showtoc' ) ) {
475 $s .= "#toc { display: none; }\n";
477 if( !$wgUser->getOption( 'editsection' ) ) {
478 $s .= ".editsection { display: none; }\n";
483 function getBodyOptions() {
484 global $wgUser, $wgTitle, $wgOut, $wgRequest, $wgContLang;
486 extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
488 if ( 0 != $wgTitle->getNamespace() ) {
489 $a = array( 'bgcolor' => '#ffffec' );
491 else $a = array( 'bgcolor' => '#FFFFFF' );
492 if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
493 $wgTitle->userCanEdit() ) {
494 $s = $wgTitle->getFullURL( $this->editUrlOptions() );
495 $s = 'document.location = "' .wfEscapeJSString( $s ) .'";';
496 $a +
= array ('ondblclick' => $s);
499 $a['onload'] = $wgOut->getOnloadHandler();
500 if( $wgUser->getOption( 'editsectiononrightclick' ) ) {
501 if( $a['onload'] != '' ) {
504 $a['onload'] .= 'setupRightClickEdit()';
506 $a['class'] = 'ns-'.$wgTitle->getNamespace().' '.($wgContLang->isRTL() ?
"rtl" : "ltr").
507 ' '.Sanitizer
::escapeId( 'page-'.$wgTitle->getPrefixedText() );
520 * This will be called immediately after the <body> tag. Split into
521 * two functions to make it easier to subclass.
523 function beforeContent() {
524 return $this->doBeforeContent();
527 function doBeforeContent() {
529 $fname = 'Skin::doBeforeContent';
530 wfProfileIn( $fname );
533 $qb = $this->qbSetting();
535 if( $langlinks = $this->otherLanguages() ) {
541 $borderhack = 'class="top"';
544 $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
545 "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
548 $left = ($qb == 1 ||
$qb == 3);
549 if($wgContLang->isRTL()) $left = !$left;
552 $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
553 $this->logoText() . '</td>';
555 $s .= $this->getQuickbarCompensator( $rows );
557 $l = $wgContLang->isRTL() ?
'right' : 'left';
558 $s .= "<td {$borderhack} align='$l' valign='top'>\n";
560 $s .= $this->topLinks() ;
561 $s .= "<p class='subtitle'>" . $this->pageTitleLinks() . "</p>\n";
563 $r = $wgContLang->isRTL() ?
"left" : "right";
564 $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
565 $s .= $this->nameAndLogin();
566 $s .= "\n<br />" . $this->searchForm() . "</td>";
569 $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
572 if ( $shove && !$left ) { # Right
573 $s .= $this->getQuickbarCompensator( $rows );
575 $s .= "</tr>\n</table>\n</div>\n";
576 $s .= "\n<div id='article'>\n";
578 $notice = wfGetSiteNotice();
580 $s .= "\n<div id='siteNotice'>$notice</div>\n";
582 $s .= $this->pageTitle();
583 $s .= $this->pageSubtitle() ;
584 $s .= $this->getCategories();
585 wfProfileOut( $fname );
590 function getCategoryLinks () {
591 global $wgOut, $wgTitle, $wgUseCategoryBrowser;
594 if( count( $wgOut->mCategoryLinks
) == 0 ) return '';
597 $sep = wfMsgHtml( 'catseparator' );
599 // Use Unicode bidi embedding override characters,
600 // to make sure links don't smash each other up in ugly ways.
601 $dir = $wgContLang->isRTL() ?
'rtl' : 'ltr';
602 $embed = "<span dir='$dir'>";
604 $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks
) . $pop;
606 $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks
) );
607 $s = $this->makeLinkObj( Title
::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
610 # optional 'dmoz-like' category browser. Will be shown under the list
611 # of categories an article belong to
612 if($wgUseCategoryBrowser) {
613 $s .= '<br /><hr />';
615 # get a big array of the parents tree
616 $parenttree = $wgTitle->getParentCategoryTree();
617 # Skin object passed by reference cause it can not be
618 # accessed under the method subfunction drawCategoryBrowser
619 $tempout = explode("\n", Skin
::drawCategoryBrowser($parenttree, $this) );
620 # Clean out bogus first entry and sort them
623 # Output one per line
624 $s .= implode("<br />\n", $tempout);
630 /** Render the array as a serie of links.
631 * @param $tree Array: categories tree returned by Title::getParentCategoryTree
632 * @param &skin Object: skin passed by reference
633 * @return String separated by >, terminate with "\n"
635 function drawCategoryBrowser($tree, &$skin) {
637 foreach ($tree as $element => $parent) {
638 if (empty($parent)) {
639 # element start a new list
642 # grab the others elements
643 $return .= Skin
::drawCategoryBrowser($parent, $skin) . ' > ';
645 # add our current element to the list
646 $eltitle = Title
::NewFromText($element);
647 $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
652 function getCategories() {
653 $catlinks=$this->getCategoryLinks();
654 if(!empty($catlinks)) {
655 return "<p class='catlinks'>{$catlinks}</p>";
659 function getQuickbarCompensator( $rows = 1 ) {
660 return "<td width='152' rowspan='{$rows}'> </td>";
664 * This gets called shortly before the \</body\> tag.
665 * @return String HTML to be put before \</body\>
667 function afterContent() {
668 $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
669 return $printfooter . $this->doAfterContent();
673 * This gets called shortly before the \</body\> tag.
674 * @return String HTML-wrapped JS code to be put before \</body\>
676 function bottomScripts() {
677 global $wgJsMimeType;
678 return "\n\t\t<script type=\"$wgJsMimeType\">if (window.runOnloadHook) runOnloadHook();</script>\n";
681 /** @return string Retrievied from HTML text */
682 function printSource() {
684 $url = htmlspecialchars( $wgTitle->getFullURL() );
685 return wfMsg( 'retrievedfrom', '<a href="'.$url.'">'.$url.'</a>' );
688 function printFooter() {
689 return "<p>" . $this->printSource() .
690 "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
693 /** overloaded by derived classes */
694 function doAfterContent() { }
696 function pageTitleLinks() {
697 global $wgOut, $wgTitle, $wgUser, $wgRequest;
699 $oldid = $wgRequest->getVal( 'oldid' );
700 $diff = $wgRequest->getVal( 'diff' );
701 $action = $wgRequest->getText( 'action' );
703 $s = $this->printableLink();
704 $disclaimer = $this->disclaimerLink(); # may be empty
706 $s .= ' | ' . $disclaimer;
708 $privacy = $this->privacyLink(); # may be empty too
710 $s .= ' | ' . $privacy;
713 if ( $wgOut->isArticleRelated() ) {
714 if ( $wgTitle->getNamespace() == NS_IMAGE
) {
715 $name = $wgTitle->getDBkey();
716 $image = new Image( $wgTitle );
717 if( $image->exists() ) {
718 $link = htmlspecialchars( $image->getURL() );
719 $style = $this->getInternalLinkAttributes( $link, $name );
720 $s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
724 if ( 'history' == $action ||
isset( $diff ) ||
isset( $oldid ) ) {
725 $s .= ' | ' . $this->makeKnownLinkObj( $wgTitle,
726 wfMsg( 'currentrev' ) );
729 if ( $wgUser->getNewtalk() ) {
730 # do not show "You have new messages" text when we are viewing our
732 if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
733 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
734 $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
735 $s.= ' | <strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
737 $wgOut->setSquidMaxage(0);
738 $wgOut->enableClientCache(false);
742 $undelete = $this->getUndeleteLink();
743 if( !empty( $undelete ) ) {
744 $s .= ' | '.$undelete;
749 function getUndeleteLink() {
750 global $wgUser, $wgTitle, $wgContLang, $action;
751 if( $wgUser->isAllowed( 'deletedhistory' ) &&
752 (($wgTitle->getArticleId() == 0) ||
($action == "history")) &&
753 ($n = $wgTitle->isDeleted() ) )
755 if ( $wgUser->isAllowed( 'delete' ) ) {
756 $msg = 'thisisdeleted';
758 $msg = 'viewdeleted';
761 $this->makeKnownLinkObj(
762 SpecialPage
::getTitleFor( 'Undelete', $wgTitle->getPrefixedDBkey() ),
763 wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) );
768 function printableLink() {
769 global $wgOut, $wgFeedClasses, $wgRequest;
771 $baseurl = $_SERVER['REQUEST_URI'];
772 if( strpos( '?', $baseurl ) == false ) {
777 $baseurl = htmlspecialchars( $baseurl );
778 $printurl = $wgRequest->escapeAppendQuery( 'printable=yes' );
780 $s = "<a href=\"$printurl\">" . wfMsg( 'printableversion' ) . '</a>';
781 if( $wgOut->isSyndicated() ) {
782 foreach( $wgFeedClasses as $format => $class ) {
783 $feedurl = $wgRequest->escapeAppendQuery( "feed=$format" );
784 $s .= " | <a href=\"$feedurl\">{$format}</a>";
790 function pageTitle() {
792 $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>';
796 function pageSubtitle() {
799 $sub = $wgOut->getSubtitle();
801 global $wgExtraSubtitle;
802 $sub = wfMsg( 'tagline' ) . $wgExtraSubtitle;
804 $subpages = $this->subPageSubtitle();
805 $sub .= !empty($subpages)?
"</p><p class='subpages'>$subpages":'';
806 $s = "<p class='subtitle'>{$sub}</p>\n";
810 function subPageSubtitle() {
811 global $wgOut,$wgTitle,$wgNamespacesWithSubpages;
813 if($wgOut->isArticle() && !empty($wgNamespacesWithSubpages[$wgTitle->getNamespace()])) {
814 $ptext=$wgTitle->getPrefixedText();
815 if(preg_match('/\//',$ptext)) {
816 $links = explode('/',$ptext);
819 foreach($links as $link) {
821 if ($c<count($links)) {
822 $growinglink .= $link;
823 $getlink = $this->makeLink( $growinglink, htmlspecialchars( $link ) );
824 if(preg_match('/class="new"/i',$getlink)) { break; } # this is a hack, but it saves time
828 $subpages .= '< ';
830 $subpages .= $getlink;
839 function nameAndLogin() {
840 global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader;
842 $lo = $wgContLang->specialPage( 'Userlogout' );
845 if ( $wgUser->isAnon() ) {
846 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
849 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
850 $wgLang->getNsText( NS_TALK
) );
852 $s .= $n . ' ('.$tl.')';
854 $s .= wfMsg('notloggedin');
857 $rt = $wgTitle->getPrefixedURL();
858 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
860 } else { $q = "returnto={$rt}"; }
862 $s .= "\n<br />" . $this->makeKnownLinkObj(
863 SpecialPage
::getTitleFor( 'Userlogin' ),
864 wfMsg( 'login' ), $q );
866 $n = $wgUser->getName();
867 $rt = $wgTitle->getPrefixedURL();
868 $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
869 $wgLang->getNsText( NS_TALK
) );
873 $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
874 $n ) . "{$tl}<br />" .
875 $this->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
876 "returnto={$rt}" ) . ' | ' .
877 $this->specialLink( 'preferences' );
879 $s .= ' | ' . $this->makeKnownLink( wfMsgForContent( 'helppage' ),
885 function getSearchLink() {
886 $searchPage = SpecialPage
::getTitleFor( 'Search' );
887 return $searchPage->getLocalURL();
890 function escapeSearchLink() {
891 return htmlspecialchars( $this->getSearchLink() );
894 function searchForm() {
896 $search = $wgRequest->getText( 'search' );
898 $s = '<form name="search" class="inline" method="post" action="'
899 . $this->escapeSearchLink() . "\">\n"
900 . '<input type="text" name="search" size="19" value="'
901 . htmlspecialchars(substr($search,0,256)) . "\" />\n"
902 . '<input type="submit" name="go" value="' . wfMsg ('searcharticle') . '" /> '
903 . '<input type="submit" name="fulltext" value="' . wfMsg ('searchbutton') . "\" />\n</form>";
908 function topLinks() {
912 $s = $this->mainPageLink() . $sep
913 . $this->specialLink( 'recentchanges' );
915 if ( $wgOut->isArticleRelated() ) {
916 $s .= $sep . $this->editThisPage()
917 . $sep . $this->historyLink();
919 # Many people don't like this dropdown box
920 #$s .= $sep . $this->specialPagesList();
922 $s .= $this->variantLinks();
924 $s .= $this->extensionTabLinks();
930 * Compatibility for extensions adding functionality through tabs.
931 * Eventually these old skins should be replaced with SkinTemplate-based
935 function extensionTabLinks() {
938 wfRunHooks( 'SkinTemplateTabs', array( $this, &$tabs ) );
939 foreach( $tabs as $tab ) {
940 $s .= ' | ' . Xml
::element( 'a',
941 array( 'href' => $tab['href'] ),
948 * Language/charset variant links for classic-style skins
951 function variantLinks() {
953 /* show links to different language variants */
954 global $wgDisableLangConversion, $wgContLang, $wgTitle;
955 $variants = $wgContLang->getVariants();
956 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
957 foreach( $variants as $code ) {
958 $varname = $wgContLang->getVariantname( $code );
959 if( $varname == 'disable' )
961 $s .= ' | <a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>';
967 function bottomLinks() {
968 global $wgOut, $wgUser, $wgTitle, $wgUseTrackbacks;
972 if ( $wgOut->isArticleRelated() ) {
973 $s .= '<strong>' . $this->editThisPage() . '</strong>';
974 if ( $wgUser->isLoggedIn() ) {
975 $s .= $sep . $this->watchThisPage();
977 $s .= $sep . $this->talkLink()
978 . $sep . $this->historyLink()
979 . $sep . $this->whatLinksHere()
980 . $sep . $this->watchPageLinksLink();
982 if ($wgUseTrackbacks)
983 $s .= $sep . $this->trackbackLink();
985 if ( $wgTitle->getNamespace() == NS_USER
986 ||
$wgTitle->getNamespace() == NS_USER_TALK
)
989 $id=User
::idFromName($wgTitle->getText());
990 $ip=User
::isIP($wgTitle->getText());
992 if($id ||
$ip) { # both anons and non-anons have contri list
993 $s .= $sep . $this->userContribsLink();
995 if( $this->showEmailUser( $id ) ) {
996 $s .= $sep . $this->emailUserLink();
999 if ( $wgTitle->getArticleId() ) {
1001 if($wgUser->isAllowed('delete')) { $s .= $this->deleteThisPage(); }
1002 if($wgUser->isAllowed('protect')) { $s .= $sep . $this->protectThisPage(); }
1003 if($wgUser->isAllowed('move')) { $s .= $sep . $this->moveThisPage(); }
1005 $s .= "<br />\n" . $this->otherLanguages();
1010 function pageStats() {
1011 global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
1012 global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
1014 $oldid = $wgRequest->getVal( 'oldid' );
1015 $diff = $wgRequest->getVal( 'diff' );
1016 if ( ! $wgOut->isArticle() ) { return ''; }
1017 if ( isset( $oldid ) ||
isset( $diff ) ) { return ''; }
1018 if ( 0 == $wgArticle->getID() ) { return ''; }
1021 if ( !$wgDisableCounters ) {
1022 $count = $wgLang->formatNum( $wgArticle->getCount() );
1024 $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
1028 if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
1029 require_once('Credits.php');
1030 $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
1032 $s .= $this->lastModified();
1035 if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
1036 $dbr =& wfGetDB( DB_SLAVE
);
1037 $watchlist = $dbr->tableName( 'watchlist' );
1038 $sql = "SELECT COUNT(*) AS n FROM $watchlist
1039 WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) .
1040 "' AND wl_namespace=" . $wgTitle->getNamespace() ;
1041 $res = $dbr->query( $sql, 'Skin::pageStats');
1042 $x = $dbr->fetchObject( $res );
1043 $s .= ' ' . wfMsg('number_of_watching_users_pageview', $x->n
);
1046 return $s . ' ' . $this->getCopyright();
1049 function getCopyright( $type = 'detect' ) {
1050 global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest;
1052 if ( $type == 'detect' ) {
1053 $oldid = $wgRequest->getVal( 'oldid' );
1054 $diff = $wgRequest->getVal( 'diff' );
1056 if ( !is_null( $oldid ) && is_null( $diff ) && wfMsgForContent( 'history_copyright' ) !== '-' ) {
1063 if ( $type == 'history' ) {
1064 $msg = 'history_copyright';
1070 if( $wgRightsPage ) {
1071 $link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
1072 } elseif( $wgRightsUrl ) {
1073 $link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
1078 $out .= wfMsgForContent( $msg, $link );
1082 function getCopyrightIcon() {
1083 global $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgCopyrightIcon;
1085 if ( isset( $wgCopyrightIcon ) && $wgCopyrightIcon ) {
1086 $out = $wgCopyrightIcon;
1087 } else if ( $wgRightsIcon ) {
1088 $icon = htmlspecialchars( $wgRightsIcon );
1089 if ( $wgRightsUrl ) {
1090 $url = htmlspecialchars( $wgRightsUrl );
1091 $out .= '<a href="'.$url.'">';
1093 $text = htmlspecialchars( $wgRightsText );
1094 $out .= "<img src=\"$icon\" alt='$text' />";
1095 if ( $wgRightsUrl ) {
1102 function getPoweredBy() {
1103 global $wgStylePath;
1104 $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
1105 $img = '<a href="http://www.mediawiki.org/"><img src="'.$url.'" alt="MediaWiki" /></a>';
1109 function lastModified() {
1110 global $wgLang, $wgArticle, $wgLoadBalancer;
1112 $timestamp = $wgArticle->getTimestamp();
1114 $d = $wgLang->date( $timestamp, true );
1115 $t = $wgLang->time( $timestamp, true );
1116 $s = ' ' . wfMsg( 'lastmodifiedat', $d, $t );
1120 if ( $wgLoadBalancer->getLaggedSlaveMode() ) {
1121 $s .= ' <strong>' . wfMsg( 'laggedslavemode' ) . '</strong>';
1126 function logoText( $align = '' ) {
1127 if ( '' != $align ) { $a = " align='{$align}'"; }
1130 $mp = wfMsg( 'mainpage' );
1131 $mptitle = Title
::newMainPage();
1132 $url = ( is_object($mptitle) ?
$mptitle->escapeLocalURL() : '' );
1134 $logourl = $this->getLogo();
1135 $s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
1140 * show a drop-down box of special pages
1142 function specialPagesList() {
1143 global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
1144 $pages = array_merge( SpecialPage
::getRegularPages(), SpecialPage
::getRestrictedPages() );
1145 foreach ( $pages as $name => $page ) {
1146 $pages[$name] = $page->getDescription();
1149 $go = wfMsg( 'go' );
1150 $sp = wfMsg( 'specialpages' );
1151 $spp = $wgContLang->specialPage( 'Specialpages' );
1153 $s = '<form id="specialpages" method="get" class="inline" ' .
1154 'action="' . htmlspecialchars( "{$wgServer}{$wgRedirectScript}" ) . "\">\n";
1155 $s .= "<select name=\"wpDropdown\">\n";
1156 $s .= "<option value=\"{$spp}\">{$sp}</option>\n";
1159 foreach ( $pages as $name => $desc ) {
1160 $p = $wgContLang->specialPage( $name );
1161 $s .= "<option value=\"{$p}\">{$desc}</option>\n";
1163 $s .= "</select>\n";
1164 $s .= "<input type='submit' value=\"{$go}\" name='redirect' />\n";
1169 function mainPageLink() {
1170 $s = $this->makeKnownLinkObj( Title
::newMainPage(), wfMsg( 'mainpage' ) );
1174 function copyrightLink() {
1175 $s = $this->makeKnownLink( wfMsgForContent( 'copyrightpage' ),
1176 wfMsg( 'copyrightpagename' ) );
1180 function privacyLink() {
1181 $privacy = wfMsg( 'privacy' );
1182 if ($privacy == '-') {
1185 return $this->makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
1189 function aboutLink() {
1190 $s = $this->makeKnownLink( wfMsgForContent( 'aboutpage' ),
1191 wfMsg( 'aboutsite' ) );
1195 function disclaimerLink() {
1196 $disclaimers = wfMsg( 'disclaimers' );
1197 if ($disclaimers == '-') {
1200 return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
1205 function editThisPage() {
1206 global $wgOut, $wgTitle;
1208 if ( ! $wgOut->isArticleRelated() ) {
1209 $s = wfMsg( 'protectedpage' );
1211 if ( $wgTitle->userCanEdit() ) {
1212 $t = wfMsg( 'editthispage' );
1214 $t = wfMsg( 'viewsource' );
1217 $s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
1223 * Return URL options for the 'edit page' link.
1224 * This may include an 'oldid' specifier, if the current page view is such.
1229 function editUrlOptions() {
1232 if( $this->mRevisionId
&& ! $wgArticle->isCurrent() ) {
1233 return "action=edit&oldid=" . intval( $this->mRevisionId
);
1235 return "action=edit";
1239 function deleteThisPage() {
1240 global $wgUser, $wgTitle, $wgRequest;
1242 $diff = $wgRequest->getVal( 'diff' );
1243 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
1244 $t = wfMsg( 'deletethispage' );
1246 $s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
1253 function protectThisPage() {
1254 global $wgUser, $wgTitle, $wgRequest;
1256 $diff = $wgRequest->getVal( 'diff' );
1257 if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
1258 if ( $wgTitle->isProtected() ) {
1259 $t = wfMsg( 'unprotectthispage' );
1260 $q = 'action=unprotect';
1262 $t = wfMsg( 'protectthispage' );
1263 $q = 'action=protect';
1265 $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
1272 function watchThisPage() {
1273 global $wgOut, $wgTitle;
1275 if ( $wgOut->isArticleRelated() ) {
1276 if ( $wgTitle->userIsWatching() ) {
1277 $t = wfMsg( 'unwatchthispage' );
1278 $q = 'action=unwatch';
1280 $t = wfMsg( 'watchthispage' );
1281 $q = 'action=watch';
1283 $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
1285 $s = wfMsg( 'notanarticle' );
1290 function moveThisPage() {
1293 if ( $wgTitle->userCanMove() ) {
1294 return $this->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Movepage' ),
1295 wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
1297 // no message if page is protected - would be redundant
1302 function historyLink() {
1305 return $this->makeKnownLinkObj( $wgTitle,
1306 wfMsg( 'history' ), 'action=history' );
1309 function whatLinksHere() {
1312 return $this->makeKnownLinkObj(
1313 SpecialPage
::getTitleFor( 'Whatlinkshere', $wgTitle->getPrefixedDBkey() ),
1314 wfMsg( 'whatlinkshere' ) );
1317 function userContribsLink() {
1320 return $this->makeKnownLinkObj(
1321 SpecialPage
::getTitleFor( 'Contributions', $wgTitle->getDBkey() ),
1322 wfMsg( 'contributions' ) );
1325 function showEmailUser( $id ) {
1326 global $wgEnableEmail, $wgEnableUserEmail, $wgUser;
1327 return $wgEnableEmail &&
1328 $wgEnableUserEmail &&
1329 $wgUser->isLoggedIn() && # show only to signed in users
1330 0 != $id; # we can only email to non-anons ..
1331 # '' != $id->getEmail() && # who must have an email address stored ..
1332 # 0 != $id->getEmailauthenticationtimestamp() && # .. which is authenticated
1333 # 1 != $wgUser->getOption('disablemail'); # and not disabled
1336 function emailUserLink() {
1339 return $this->makeKnownLinkObj(
1340 SpecialPage
::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ),
1341 wfMsg( 'emailuser' ) );
1344 function watchPageLinksLink() {
1345 global $wgOut, $wgTitle;
1347 if ( ! $wgOut->isArticleRelated() ) {
1348 return '(' . wfMsg( 'notanarticle' ) . ')';
1350 return $this->makeKnownLinkObj(
1351 SpecialPage
::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ),
1352 wfMsg( 'recentchangeslinked' ) );
1356 function trackbackLink() {
1359 return "<a href=\"" . $wgTitle->trackbackURL() . "\">"
1360 . wfMsg('trackbacklink') . "</a>";
1363 function otherLanguages() {
1364 global $wgOut, $wgContLang, $wgHideInterlanguageLinks;
1366 if ( $wgHideInterlanguageLinks ) {
1370 $a = $wgOut->getLanguageLinks();
1371 if ( 0 == count( $a ) ) {
1375 $s = wfMsg( 'otherlanguages' ) . ': ';
1377 if($wgContLang->isRTL()) $s .= '<span dir="LTR">';
1378 foreach( $a as $l ) {
1379 if ( ! $first ) { $s .= ' | '; }
1382 $nt = Title
::newFromText( $l );
1383 $url = $nt->escapeFullURL();
1384 $text = $wgContLang->getLanguageName( $nt->getInterwiki() );
1386 if ( '' == $text ) { $text = $l; }
1387 $style = $this->getExternalLinkAttributes( $l, $text );
1388 $s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
1390 if($wgContLang->isRTL()) $s .= '</span>';
1394 function bugReportsLink() {
1395 $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
1396 wfMsg( 'bugreports' ) );
1400 function dateLink() {
1401 $t1 = Title
::newFromText( gmdate( 'F j' ) );
1402 $t2 = Title
::newFromText( gmdate( 'Y' ) );
1404 $id = $t1->getArticleID();
1407 $s = $this->makeBrokenLink( $t1->getText() );
1409 $s = $this->makeKnownLink( $t1->getText() );
1413 $id = $t2->getArticleID();
1416 $s .= $this->makeBrokenLink( $t2->getText() );
1418 $s .= $this->makeKnownLink( $t2->getText() );
1423 function talkLink() {
1426 if ( NS_SPECIAL
== $wgTitle->getNamespace() ) {
1427 # No discussion links for special pages
1431 if( $wgTitle->isTalkPage() ) {
1432 $link = $wgTitle->getSubjectPage();
1433 switch( $link->getNamespace() ) {
1435 $text = wfMsg( 'articlepage' );
1438 $text = wfMsg( 'userpage' );
1441 $text = wfMsg( 'projectpage' );
1444 $text = wfMsg( 'imagepage' );
1447 $text = wfMsg( 'mediawikipage' );
1450 $text = wfMsg( 'templatepage' );
1453 $text = wfMsg( 'viewhelppage' );
1456 $text = wfMsg( 'categorypage' );
1459 $text = wfMsg( 'articlepage' );
1462 $link = $wgTitle->getTalkPage();
1463 $text = wfMsg( 'talkpage' );
1466 $s = $this->makeLinkObj( $link, $text );
1471 function commentLink() {
1472 global $wgTitle, $wgOut;
1474 if ( $wgTitle->getNamespace() == NS_SPECIAL
) {
1478 # __NEWSECTIONLINK___ changes behaviour here
1479 # If it's present, the link points to this page, otherwise
1480 # it points to the talk page
1481 if( $wgTitle->isTalkPage() ) {
1483 } elseif( $wgOut->showNewSectionLink() ) {
1486 $title =& $wgTitle->getTalkPage();
1489 return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
1492 /* these are used extensively in SkinTemplate, but also some other places */
1493 static function makeMainPageUrl( $urlaction = '' ) {
1494 $title = Title
::newMainPage();
1495 self
::checkTitle( $title, $name );
1496 return $title->getLocalURL( $urlaction );
1499 static function makeSpecialUrl( $name, $urlaction = '' ) {
1500 $title = SpecialPage
::getTitleFor( $name );
1501 return $title->getLocalURL( $urlaction );
1504 static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) {
1505 $title = SpecialPage
::getSafeTitleFor( $name, $subpage );
1506 return $title->getLocalURL( $urlaction );
1509 static function makeI18nUrl( $name, $urlaction = '' ) {
1510 $title = Title
::newFromText( wfMsgForContent( $name ) );
1511 self
::checkTitle( $title, $name );
1512 return $title->getLocalURL( $urlaction );
1515 static function makeUrl( $name, $urlaction = '' ) {
1516 $title = Title
::newFromText( $name );
1517 self
::checkTitle( $title, $name );
1518 return $title->getLocalURL( $urlaction );
1521 # If url string starts with http, consider as external URL, else
1523 static function makeInternalOrExternalUrl( $name ) {
1524 if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $name ) ) {
1527 return self
::makeUrl( $name );
1531 # this can be passed the NS number as defined in Language.php
1532 static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN
) {
1533 $title = Title
::makeTitleSafe( $namespace, $name );
1534 self
::checkTitle( $title, $name );
1535 return $title->getLocalURL( $urlaction );
1538 /* these return an array with the 'href' and boolean 'exists' */
1539 static function makeUrlDetails( $name, $urlaction = '' ) {
1540 $title = Title
::newFromText( $name );
1541 self
::checkTitle( $title, $name );
1543 'href' => $title->getLocalURL( $urlaction ),
1544 'exists' => $title->getArticleID() != 0 ?
true : false
1549 * Make URL details where the article exists (or at least it's convenient to think so)
1551 static function makeKnownUrlDetails( $name, $urlaction = '' ) {
1552 $title = Title
::newFromText( $name );
1553 self
::checkTitle( $title, $name );
1555 'href' => $title->getLocalURL( $urlaction ),
1560 # make sure we have some title to operate on
1561 static function checkTitle( &$title, &$name ) {
1562 if( !is_object( $title ) ) {
1563 $title = Title
::newFromText( $name );
1564 if( !is_object( $title ) ) {
1565 $title = Title
::newFromText( '--error: link target missing--' );
1571 * Build an array that represents the sidebar(s), the navigation bar among them
1576 function buildSidebar() {
1577 global $parserMemc, $wgEnableSidebarCache;
1578 global $wgLang, $wgContLang;
1580 $fname = 'SkinTemplate::buildSidebar';
1582 wfProfileIn( $fname );
1584 $key = wfMemcKey( 'sidebar' );
1585 $cacheSidebar = $wgEnableSidebarCache &&
1586 ($wgLang->getCode() == $wgContLang->getCode());
1588 if ($cacheSidebar) {
1589 $cachedsidebar = $parserMemc->get( $key );
1590 if ($cachedsidebar!="") {
1591 wfProfileOut($fname);
1592 return $cachedsidebar;
1597 $lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
1598 foreach ($lines as $line) {
1599 if (strpos($line, '*') !== 0)
1601 if (strpos($line, '**') !== 0) {
1602 $line = trim($line, '* ');
1605 if (strpos($line, '|') !== false) { // sanity check
1606 $line = explode( '|' , trim($line, '* '), 2 );
1607 $link = wfMsgForContent( $line[0] );
1610 if (wfEmptyMsg($line[1], $text = wfMsg($line[1])))
1612 if (wfEmptyMsg($line[0], $link))
1615 if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) {
1618 $title = Title
::newFromText( $link );
1620 $title = $title->fixSpecialName();
1621 $href = $title->getLocalURL();
1623 $href = 'INVALID-TITLE';
1627 $bar[$heading][] = array(
1630 'id' => 'n-' . strtr($line[1], ' ', '-'),
1633 } else { continue; }
1637 $parserMemc->set( $key, $bar, 86400 );
1638 wfProfileOut( $fname );