r95403 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95402‎ | r95403 | r95404 >
Date:16:21, 24 August 2011
Author:reedy
Status:ok
Tags:
Comment:
Add documentation

Remove unused variables, and unload globals
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.hooks.php
@@ -24,6 +24,11 @@
2525 class CollectionHooks {
2626 /**
2727 * Callback for hook SkinBuildSidebar
 28+ *
 29+ * @param $skin Skin
 30+ * @param $bar
 31+ *
 32+ * @return bool
2833 */
2934 static function buildSidebar( $skin, &$bar ) {
3035 global $wgUser;
@@ -38,6 +43,11 @@
3944 return true;
4045 }
4146
 47+ /**
 48+ * @param $skin Skin
 49+ * @param $navUrls
 50+ * @return bool
 51+ */
4252 static function buildNavUrls( $skin, &$navUrls ) {
4353 global $wgUser;
4454 global $wgCollectionPortletForLoggedInUsersOnly;
@@ -53,6 +63,10 @@
5464
5565 /**
5666 * Return HTML-code to be inserted as portlet
 67+ *
 68+ * @param $sk Skin
 69+ *
 70+ * @return string
5771 */
5872 static function getPortlet( $sk ) {
5973 global $wgRequest;
@@ -215,14 +229,18 @@
216230 return true;
217231 }
218232
 233+ /**
 234+ * @param $title Title
 235+ * @param $skin Skin
 236+ * @param $mode string
 237+ * @return string
 238+ */
219239 static function renderBookCreatorBox( $title, $skin, $mode = '' ) {
220240 global $wgCollectionStyleVersion;
221 - global $wgJsMimeType;
222241 global $wgOut;
223242 global $wgScriptPath;
224243 global $wgRequest;
225244
226 - $jsPath = "$wgScriptPath/extensions/Collection/js";
227245 $imagePath = "$wgScriptPath/extensions/Collection/images";
228246 $ptext = $title->getPrefixedText();
229247 $oldid = $wgRequest->getVal( 'oldid', 0 );
@@ -315,6 +333,14 @@
316334 . self::getBookCreatorBoxSuggestLink( $skin, $imagePath, $ajaxHint );
317335 }
318336
 337+ /**
 338+ * @param $sk Skin
 339+ * @param $imagePath
 340+ * @param $ajaxHint
 341+ * @param $title Title
 342+ * @param $oldid
 343+ * @return string
 344+ */
319345 static function getBookCreatorBoxAddRemoveLink( $sk, $imagePath, $ajaxHint, $title, $oldid ) {
320346 $namespace = $title->getNamespace();
321347 $ptext = $title->getPrefixedText();
Index: trunk/extensions/Collection/Collection.body.php
@@ -306,7 +306,6 @@
307307
308308 function renderBookCreatorPage( $referer, $par ) {
309309 global $wgOut;
310 - global $wgScriptPath;
311310 global $wgUser;
312311 global $wgJsMimeType;
313312
@@ -315,12 +314,8 @@
316315
317316 $wgOut->addWikiMsg( 'coll-book_creator_intro' );
318317
319 - $imagepath = "$wgScriptPath/extensions/Collection/images";
320 - $jspath = "$wgScriptPath/extensions/Collection/js";
321 -
322318 $wgOut->addModules( 'ext.collection.checkLoadFromLocalStorage' );
323319
324 - $coll = CollectionSession::getCollection();
325320 $dialogtxt = wfMsg( 'coll-load_local_book' );
326321
327322 $wgOut->addScript(
@@ -464,17 +459,12 @@
465460
466461 function renderSpecialPage() {
467462 global $wgCollectionFormats;
468 - global $wgCollectionVersion;
469 - global $wgJsMimeType;
470 - global $wgScriptPath;
471463 global $wgOut;
472464
473465 if ( !CollectionSession::hasSession() ) {
474466 CollectionSession::startSession();
475467 }
476468
477 - $jspath = "$wgScriptPath/extensions/Collection/js";
478 -
479469 $this->setHeaders();
480470 $wgOut->setPageTitle( wfMsg( 'coll-manage_your_book' ) );
481471 $wgOut->addModules( 'ext.collection' );
@@ -541,10 +531,17 @@
542532
543533 static function addArticleFromName( $namespace, $name, $oldid = 0 ) {
544534 $title = Title::makeTitleSafe( $namespace, $name );
545 - if ( !$title ) return false;
 535+ if ( !$title ) {
 536+ return false;
 537+ }
546538 return self::addArticle( $title, $oldid );
547539 }
548540
 541+ /**
 542+ * @param $title Title
 543+ * @param $oldid int
 544+ * @return bool
 545+ */
549546 static function addArticle( $title, $oldid = 0 ) {
550547 global $wgCollectionHierarchyDelimiter;
551548
@@ -598,6 +595,11 @@
599596 return self::removeArticle( $title, $oldid );
600597 }
601598
 599+ /**
 600+ * @param $title Title
 601+ * @param $oldid int
 602+ * @return bool
 603+ */
602604 static function removeArticle( $title, $oldid = 0 ) {
603605 if ( !CollectionSession::hasSession() ) {
604606 return false;
@@ -773,6 +775,11 @@
774776 return null;
775777 }
776778
 779+ /**
 780+ * @param $title Title
 781+ * @param $append bool
 782+ * @return array|bool
 783+ */
777784 function loadCollection( $title, $append = false ) {
778785 global $wgOut;
779786
@@ -1011,7 +1018,7 @@
10121019 }
10131020
10141021 function renderRenderingPage() {
1015 - global $wgCollectionVersion, $wgJsMimeType, $wgLang, $wgOut, $wgRequest, $wgScriptPath;
 1022+ global $wgLang, $wgOut, $wgRequest;
10161023
10171024 $response = self::mwServeCommand( 'render_status', array(
10181025 'collection_id' => $wgRequest->getVal( 'collection_id' ),
@@ -1118,6 +1125,12 @@
11191126 $wgOut->disable();
11201127 }
11211128
 1129+ /**
 1130+ * @param $title Title
 1131+ * @param $oldid
 1132+ * @param $writer
 1133+ * @return
 1134+ */
11221135 function renderArticle( $title, $oldid, $writer ) {
11231136 global $wgOut;
11241137

Status & tagging log