From 806c6d3cbe605cf0937eed3161b07a68a6c837e6 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Sat, 16 Apr 2011 22:05:54 +0000 Subject: [PATCH] Fix some type hints, documentation and potentially-undefined-variables which PhpStorm was complaining about. --- includes/SkinTemplate.php | 62 +++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index d40c073baf..11488459fe 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -116,10 +116,10 @@ class SkinTemplate extends Skin { * and eventually it spits out some HTML. Should have interface * roughly equivalent to PHPTAL 0.7. * - * @param $classname string (or file) + * @param $classname String * @param $repository string: subdirectory where we keep template files * @param $cache_dir string - * @return object + * @return QuickTemplate * @private */ function setupTemplate( $classname, $repository = false, $cache_dir = false ) { @@ -398,7 +398,7 @@ class SkinTemplate extends Skin { } else { $tpl->set( 'copyright', false ); $tpl->set( 'viewcount', false ); - $tpl->set( 'lastmod', false ); + $tpl->set( 'lastmod', false ); $tpl->set( 'credits', false ); $tpl->set( 'numberofwatchingusers', false ); } @@ -665,7 +665,7 @@ class SkinTemplate extends Skin { $createaccount_url['class'] = 'link-https'; # FIXME class depends on skin } } - + if( $this->showIPinHeader() ) { $href = &$this->userpageUrlDetails['href']; @@ -697,6 +697,15 @@ class SkinTemplate extends Skin { return $personal_urls; } + /** + * TODO document + * @param $title Title + * @param $message String message key + * @param $selected Bool + * @param $query String + * @param $checkEdit Bool + * @return array + */ function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) { $classes = array(); if( $selected ) { @@ -760,13 +769,13 @@ class SkinTemplate extends Skin { /** * a structured array of links usually used for the tabs in a skin - * + * * There are 4 standard sections * namespaces: Used for namespace tabs like special, page, and talk namespaces * views: Used for primary page views like read, edit, history * actions: Used for most extra page actions like deletion, protection, etc... * variants: Used to list the language variants for the page - * + * * Each section's value is a key/value array of links for that section. * The links themseves have these common keys: * - class: The css classes to apply to the tab @@ -776,11 +785,11 @@ class SkinTemplate extends Skin { * - redundant: If true the tab will be dropped in skins using content_actions * this is useful for tabs like "Read" which only have meaning in skins that * take special meaning from the grouped structure of content_navigation - * + * * Views also have an extra key which can be used: * - primary: If this is not true skins like vector may try to hide the tab * when the user has limited space in their browser window - * + * * content_navigation using code also expects these ids to be present on the * links, however these are usually automatically generated by SkinTemplate * itself and are not necessary when using a hook. The only things these may @@ -788,7 +797,7 @@ class SkinTemplate extends Skin { * - id: A "preferred" id, most skins are best off outputting this preferred id for best compatibility * - tooltiponly: This is set to true for some tabs in cases where the system * believes that the accesskey should not be added to the tab. - * + * * @return array */ protected function buildContentNavigationUrls( OutputPage $out ) { @@ -796,10 +805,10 @@ class SkinTemplate extends Skin { global $wgDisableLangConversion; wfProfileIn( __METHOD__ ); - + $title = $this->getRelevantTitle(); // Display tabs for the relevant title rather than always the title itself $onPage = $title->equals($this->getTitle()); - + $content_navigation = array( 'namespaces' => array(), 'views' => array(), @@ -997,7 +1006,7 @@ class SkinTemplate extends Skin { 'href' => $title->getLocalURL( 'action=' . $mode ) ); } - + wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$content_navigation ) ); } else { // If it's not content, it's got to be a special page @@ -1007,7 +1016,7 @@ class SkinTemplate extends Skin { 'href' => $wgRequest->getRequestURL(), // @bug 2457, 2510 'context' => 'subject' ); - + wfRunHooks( 'SkinTemplateNavigation::SpecialPage', array( &$this, &$content_navigation ) ); } @@ -1054,7 +1063,7 @@ class SkinTemplate extends Skin { $link['id'] = $xmlID; } } - + # We don't want to give the watch tab an accesskey if the # page is being edited, because that conflicts with the # accesskey on the watch checkbox. We also don't want to @@ -1072,7 +1081,7 @@ class SkinTemplate extends Skin { $content_navigation['actions']['unwatch']['tooltiponly'] = true; } } - + wfProfileOut( __METHOD__ ); return $content_navigation; @@ -1090,18 +1099,18 @@ class SkinTemplate extends Skin { // content_actions has been replaced with content_navigation for backwards // compatibility and also for skins that just want simple tabs content_actions // is now built by flattening the content_navigation arrays into one - + $content_actions = array(); - + foreach ( $content_navigation as $links ) { - + foreach ( $links as $key => $value ) { - + if ( isset($value["redundant"]) && $value["redundant"] ) { // Redundant tabs are dropped from content_actions continue; } - + // content_actions used to have ids built using the "ca-$key" pattern // so the xmlID based id is much closer to the actual $key that we want // for that reason we'll just strip out the ca- if present and use @@ -1109,20 +1118,20 @@ class SkinTemplate extends Skin { if ( isset($value["id"]) && substr($value["id"], 0, 3) == "ca-" ) { $key = substr($value["id"], 3); } - + if ( isset($content_actions[$key]) ) { wfDebug( __METHOD__ . ": Found a duplicate key for $key while flattening content_navigation into content_actions." ); continue; } - + $content_actions[$key] = $value; - + } - + } - + wfProfileOut( __METHOD__ ); - + return $content_actions; } @@ -1203,6 +1212,7 @@ class SkinTemplate extends Skin { } else { $id = 0; $ip = false; + $rootUser = null; } if( $id || $ip ) { # both anons and non-anons have contribs list -- 2.20.1