summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Jorsch <bjorsch@wikimedia.org>2013-06-12 12:50:19 -0400
committerBrad Jorsch <bjorsch@wikimedia.org>2013-06-12 13:22:39 -0400
commit5f126b0053f99d7f06ec4e6150d17e6d7aec1bc7 (patch)
tree3ff95850bb3fb0b6185dd2e9a921c7aae74933b2
parent62988d1b2072bd0b9a988468b08b3c73f6a5ce66 (diff)
Add getPersonalToolsList to SkinTemplateorigin/sandbox/anomie/CentralAuth
This is for CentralAuth, so it can replace the p-personal list. Change-Id: I7385bcb36e45310fb08da05f8df8925acd7d9890
-rw-r--r--includes/SkinTemplate.php82
1 files changed, 56 insertions, 26 deletions
diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php
index fa9095454cd3..80a415a12414 100644
--- a/includes/SkinTemplate.php
+++ b/includes/SkinTemplate.php
@@ -165,39 +165,14 @@ class SkinTemplate extends Skin {
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' );
@@ -226,6 +201,47 @@ class SkinTemplate extends Skin {
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 );
@@ -516,6 +532,20 @@ class SkinTemplate extends Skin {
}
/**
+ * 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.
*