'text' => $ilLangName,
'title' => $languageLinkTitle->getText(),
'class' => $class,
- 'lang' => $ilInterwikiCode,
- 'hreflang' => $ilInterwikiCode
+ 'lang' => wfBCP47( $ilInterwikiCode ),
+ 'hreflang' => wfBCP47( $ilInterwikiCode ),
);
}
}
return $language_urls;
}
- /**
- * initialize various variables and generate the template
- *
- * @param $out OutputPage
- */
- function outputPage( OutputPage $out = null ) {
- global $wgContLang;
- global $wgScript, $wgStylePath;
- global $wgMimeType, $wgJsMimeType;
- global $wgXhtmlNamespaces, $wgHtml5Version;
- global $wgDisableCounters, $wgSitename, $wgLogo;
- global $wgMaxCredits, $wgShowCreditsIfMax;
- global $wgPageShowWatchingUsers;
- global $wgArticlePath, $wgScriptPath, $wgServer;
-
+ protected function setupTemplateForOutput() {
wfProfileIn( __METHOD__ );
- Profiler::instance()->setTemplated( true );
- $oldContext = null;
- if ( $out !== null ) {
- // @todo Add wfDeprecated in 1.20
- $oldContext = $this->getContext();
- $this->setContext( $out->getContext() );
- }
-
- $out = $this->getOutput();
$request = $this->getRequest();
$user = $this->getUser();
$title = $this->getTitle();
wfProfileIn( __METHOD__ . '-init' );
- $this->initPage( $out );
-
$tpl = $this->setupTemplate( $this->template, 'skins' );
wfProfileOut( __METHOD__ . '-init' );
wfProfileOut( __METHOD__ . '-stuff' );
+ wfProfileOut( __METHOD__ );
+
+ return $tpl;
+ }
+
+ /**
+ * initialize various variables and generate the template
+ *
+ * @param $out OutputPage
+ */
+ function outputPage( OutputPage $out = null ) {
+ global $wgContLang;
+ global $wgScript, $wgStylePath;
+ global $wgMimeType, $wgJsMimeType;
+ global $wgXhtmlNamespaces, $wgHtml5Version;
+ global $wgDisableCounters, $wgSitename, $wgLogo;
+ global $wgMaxCredits, $wgShowCreditsIfMax;
+ global $wgPageShowWatchingUsers;
+ global $wgArticlePath, $wgScriptPath, $wgServer;
+
+ wfProfileIn( __METHOD__ );
+ Profiler::instance()->setTemplated( true );
+
+ $oldContext = null;
+ if ( $out !== null ) {
+ // @todo Add wfDeprecated in 1.20
+ $oldContext = $this->getContext();
+ $this->setContext( $out->getContext() );
+ }
+
+ $out = $this->getOutput();
+ $request = $this->getRequest();
+ $user = $this->getUser();
+ $title = $this->getTitle();
+
+ wfProfileIn( __METHOD__ . '-init' );
+ $this->initPage( $out );
+ wfProfileOut( __METHOD__ . '-init' );
+
+ $tpl = $this->setupTemplateForOutput();
+
wfProfileIn( __METHOD__ . '-stuff-head' );
if ( !$this->useHeadElement ) {
$tpl->set( 'pagecss', false );
wfProfileOut( __METHOD__ );
}
+ /**
+ * Get the HTML for the p-personal list
+ * @return string
+ */
+ public function getPersonalToolsList() {
+ $tpl = $this->setupTemplateForOutput();
+ $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
+ $html = '';
+ foreach ( $tpl->getPersonalTools() as $key => $item ) {
+ $html .= $tpl->makeListItem( $key, $item );
+ }
+ return $html;
+ }
+
/**
* Format language name for use in sidebar interlanguage links list.
* By default it is capitalized.
'href' => $href,
'active' => ( $href == $pageurl )
);
- $href = self::makeSpecialUrl( 'Watchlist' );
- $personal_urls['watchlist'] = array(
- 'text' => $this->msg( 'mywatchlist' )->text(),
- 'href' => $href,
- 'active' => ( $href == $pageurl )
- );
+
+ if ( $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
+ $href = self::makeSpecialUrl( 'Watchlist' );
+ $personal_urls['watchlist'] = array(
+ 'text' => $this->msg( 'mywatchlist' )->text(),
+ 'href' => $href,
+ 'active' => ( $href == $pageurl )
+ );
+ }
# We need to do an explicit check for Special:Contributions, as we
# have to match both the title, and the target, which could come
wfProfileOut( __METHOD__ . '-live' );
// Checks if the user is logged in
- if ( $this->loggedin ) {
+ if ( $this->loggedin && $user->isAllowedAll( 'viewmywatchlist', 'editmywatchlist' ) ) {
/**
* The following actions use messages which, if made particular to
* the any specific skins, would break the Ajax code which makes this
'class' => ( $code == $preferred ) ? 'selected' : false,
'text' => $varname,
'href' => $title->getLocalURL( array( 'variant' => $code ) + $params ),
- 'lang' => $code,
- 'hreflang' => $code
+ 'lang' => wfBCP47( $code ),
+ 'hreflang' => wfBCP47( $code ),
);
}
}
// A print stylesheet is attached to all pages, but nobody ever
// figures that out. :) Add a link...
- if ( $out->isArticle() ) {
- if ( !$out->isPrintable() ) {
- $nav_urls['print'] = array(
- 'text' => $this->msg( 'printableversion' )->text(),
- 'href' => $this->getTitle()->getLocalURL(
- $request->appendQueryValue( 'printable', 'yes', true ) )
- );
- }
+ if ( !$out->isPrintable() && ( $out->isArticle() || $this->getTitle()->isSpecialPage() ) ) {
+ $nav_urls['print'] = array(
+ 'text' => $this->msg( 'printableversion' )->text(),
+ 'href' => $this->getTitle()->getLocalURL(
+ $request->appendQueryValue( 'printable', 'yes', true ) )
+ );
+ }
+ if ( $out->isArticle() ) {
// Also add a "permalink" while we're at it
$revid = $this->getRevisionId();
if ( $revid ) {