r113035 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113034‎ | r113035 | r113036 >
Date:14:31, 5 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.19wmf1/extensions (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CategoryTree (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryPageSubclass.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreePage.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialCentralAuth.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryPageSubclass.php
@@ -7,11 +7,21 @@
88 class CategoryTreeCategoryViewer extends CategoryViewer {
99 var $child_cats;
1010
 11+ /**
 12+ * @var CategoryTree
 13+ */
 14+ var $categorytree;
 15+
 16+ /**
 17+ * @return CategoryTree
 18+ */
1119 function getCategoryTree() {
1220 global $wgOut, $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeForceHeaders;
1321
14 - if ( ! isset( $this->categorytree ) ) {
15 - if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut );
 22+ if ( !isset( $this->categorytree ) ) {
 23+ if ( !$wgCategoryTreeForceHeaders ) {
 24+ CategoryTree::setHeaders( $wgOut );
 25+ }
1626
1727 $this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
1828 }
@@ -21,6 +31,10 @@
2232
2333 /**
2434 * Add a subcategory to the internal lists
 35+ * @param $cat Category
 36+ * @param $sortkey
 37+ * @param $pageLength
 38+ * @return
2539 */
2640 function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
2741 global $wgRequest;
@@ -28,7 +42,8 @@
2943 $title = $cat->getTitle();
3044
3145 if ( $wgRequest->getCheck( 'notree' ) ) {
32 - return parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
 46+ parent::addSubcategoryObject( $cat, $sortkey, $pageLength );
 47+ return;
3348 }
3449
3550 $tree = $this->getCategoryTree();
Index: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreePage.php
@@ -19,13 +19,14 @@
2020 var $target = '';
2121 var $tree = null;
2222
23 - /**
24 - * Constructor
25 - */
2623 function __construct() {
2724 parent::__construct( 'CategoryTree', '', true );
2825 }
2926
 27+ /**
 28+ * @param $name
 29+ * @return mixed
 30+ */
3031 function getOption( $name ) {
3132 global $wgCategoryTreeDefaultOptions;
3233
@@ -38,16 +39,19 @@
3940
4041 /**
4142 * Main execution function
42 - * @param $par Parameters passed to the page
 43+ * @param $par array Parameters passed to the page
4344 */
4445 function execute( $par ) {
45 - global $wgRequest, $wgOut, $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
 46+ global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
4647
4748 $this->setHeaders();
 49+ $request = $this->getRequest();
 50+ if ( $par ) {
 51+ $this->target = $par;
 52+ } else {
 53+ $this->target = $request->getVal( 'target', wfMsg( 'rootcategory' ) );
 54+ }
4855
49 - if ( $par ) $this->target = $par;
50 - else $this->target = $wgRequest->getVal( 'target', wfMsg( 'rootcategory' ) );
51 -
5256 $this->target = trim( $this->target );
5357
5458 # HACK for undefined root category
@@ -59,47 +63,50 @@
6064
6165 # grab all known options from the request. Normalization is done by the CategoryTree class
6266 foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
63 - if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) )
 67+ if ( isset( $wgCategoryTreeSpecialPageOptions[$option] ) ) {
6468 $default = $wgCategoryTreeSpecialPageOptions[$option];
 69+ }
6570
66 - $options[$option] = $wgRequest->getVal( $option, $default );
 71+ $options[$option] = $request->getVal( $option, $default );
6772 }
6873
6974 $this->tree = new CategoryTree( $options );
7075
71 - $wgOut->addWikiMsg( 'categorytree-header' );
 76+ $output = $this->getOutput();
 77+ $output->addWikiMsg( 'categorytree-header' );
7278
7379 $this->executeInputForm();
7480
7581 if ( $this->target !== '' && $this->target !== null ) {
76 - if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut );
 82+ if ( !$wgCategoryTreeForceHeaders ) {
 83+ CategoryTree::setHeaders( $output );
 84+ }
7785
7886 $title = CategoryTree::makeTitle( $this->target );
7987
8088 if ( $title && $title->getArticleID() ) {
81 - $wgOut->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeParents' ) ) );
82 - $wgOut->addHTML( wfMsgExt( 'categorytree-parents', 'parseinline' ) );
83 - $wgOut->addHTML( wfMsg( 'colon-separator' ) );
 89+ $output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeParents' ) ) );
 90+ $output->addHTML( wfMsgExt( 'categorytree-parents', 'parseinline' ) );
 91+ $output->addHTML( wfMsg( 'colon-separator' ) );
8492
8593 $parents = $this->tree->renderParents( $title );
8694
8795 if ( $parents == '' ) {
88 - $wgOut->addHTML( wfMsgExt( 'categorytree-no-parent-categories', 'parseinline' ) );
 96+ $output->addHTML( wfMsgExt( 'categorytree-no-parent-categories', 'parseinline' ) );
8997 } else {
90 - $wgOut->addHTML( $parents );
 98+ $output->addHTML( $parents );
9199 }
92100
93 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 101+ $output->addHTML( Xml::closeElement( 'div' ) );
94102
95 - $wgOut->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeResult' ) ) );
96 - $wgOut->addHTML( $this->tree->renderNode( $title, 1 ) );
97 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
 103+ $output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeResult' ) ) );
 104+ $output->addHTML( $this->tree->renderNode( $title, 1 ) );
 105+ $output->addHTML( Xml::closeElement( 'div' ) );
 106+ } else {
 107+ $output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeNotice' ) ) );
 108+ $output->addHTML( wfMsgExt( 'categorytree-not-found', 'parseinline' , $this->target ) );
 109+ $output->addHTML( Xml::closeElement( 'div' ) );
98110 }
99 - else {
100 - $wgOut->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeNotice' ) ) );
101 - $wgOut->addHTML( wfMsgExt( 'categorytree-not-found', 'parseinline' , $this->target ) );
102 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
103 - }
104111 }
105112 }
106113
@@ -107,22 +114,23 @@
108115 * Input form for entering a category
109116 */
110117 function executeInputForm() {
111 - global $wgScript, $wgOut;
 118+ global $wgScript;
112119 $thisTitle = SpecialPage::getTitleFor( $this->getName() );
113120 $mode = $this->getOption( 'mode' );
114121
115 - $wgOut->addHTML( Xml::openElement( 'form', array( 'name' => 'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-categorytree-form' ) ) );
116 - $wgOut->addHTML( Xml::openElement( 'fieldset' ) );
117 - $wgOut->addHTML( Xml::element( 'legend', null, wfMsgNoTrans( 'categorytree-legend' ) ) );
118 - $wgOut->addHTML( Html::Hidden( 'title', $thisTitle->getPrefixedDbKey() ) );
119 - $wgOut->addHTML( Xml::inputLabel( wfMsgNoTrans( 'categorytree-category' ), 'target', 'target', 20, $this->target ) . ' ' );
120 - $wgOut->addHTML( Xml::openElement( 'select', array( 'name' => 'mode' ) ) );
121 - $wgOut->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-categories' ), 'categories', $mode == CT_MODE_CATEGORIES ? true : false ) );
122 - $wgOut->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-pages' ), 'pages', $mode == CT_MODE_PAGES ? true : false ) );
123 - $wgOut->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-all' ), 'all', $mode == CT_MODE_ALL ? true : false ) );
124 - $wgOut->addHTML( Xml::closeElement( 'select' ) . ' ' );
125 - $wgOut->addHTML( Xml::submitButton( wfMsgNoTrans( 'categorytree-go' ), array( 'name' => 'dotree' ) ) );
126 - $wgOut->addHTML( Xml::closeElement( 'fieldset' ) );
127 - $wgOut->addHTML( Xml::closeElement( 'form' ) );
 122+ $output = $this->getOutput();
 123+ $output->addHTML( Xml::openElement( 'form', array( 'name' => 'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-categorytree-form' ) ) );
 124+ $output->addHTML( Xml::openElement( 'fieldset' ) );
 125+ $output->addHTML( Xml::element( 'legend', null, wfMsgNoTrans( 'categorytree-legend' ) ) );
 126+ $output->addHTML( Html::Hidden( 'title', $thisTitle->getPrefixedDbKey() ) );
 127+ $output->addHTML( Xml::inputLabel( wfMsgNoTrans( 'categorytree-category' ), 'target', 'target', 20, $this->target ) . ' ' );
 128+ $output->addHTML( Xml::openElement( 'select', array( 'name' => 'mode' ) ) );
 129+ $output->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-categories' ), 'categories', $mode == CT_MODE_CATEGORIES ) );
 130+ $output->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-pages' ), 'pages', $mode == CT_MODE_PAGES ) );
 131+ $output->addHTML( Xml::option( wfMsgNoTrans( 'categorytree-mode-all' ), 'all', $mode == CT_MODE_ALL ) );
 132+ $output->addHTML( Xml::closeElement( 'select' ) . ' ' );
 133+ $output->addHTML( Xml::submitButton( wfMsgNoTrans( 'categorytree-go' ), array( 'name' => 'dotree' ) ) );
 134+ $output->addHTML( Xml::closeElement( 'fieldset' ) );
 135+ $output->addHTML( Xml::closeElement( 'form' ) );
128136 }
129137 }
Index: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php
@@ -217,6 +217,10 @@
218218 $wgHooks['MakeGlobalVariablesScript'][] = 'efCategoryTreeGetConfigVars';
219219 }
220220
 221+/**
 222+ * @param $parser Parser
 223+ * @return bool
 224+ */
221225 function efCategoryTreeSetHooks( $parser ) {
222226 $parser->setHook( 'categorytree' , 'efCategoryTreeParserHook' );
223227 $parser->setFunctionHook( 'categorytree' , 'efCategoryTreeParserFunction' );
@@ -229,6 +233,10 @@
230234 * If $enc is not given, '' is asumed, which simulates the old call interface,
231235 * namely, only providing the mode name or number.
232236 * This loads CategoryTreeFunctions.php and calls CategoryTree::ajax()
 237+ * @param $category
 238+ * @param $options array
 239+ * @param $enc string
 240+ * @return AjaxResponse|bool
233241 */
234242 function efCategoryTreeAjaxWrapper( $category, $options = array(), $enc = '' ) {
235243 global $wgCategoryTreeHTTPCache, $wgSquidMaxage, $wgUseSquid;
@@ -254,8 +262,10 @@
255263
256264 /**
257265 * Internal function to cap depth
 266+ * @param $mode
 267+ * @param $depth
 268+ * @return int|mixed
258269 */
259 -
260270 function efCategoryTreeCapDepth( $mode, $depth ) {
261271 global $wgCategoryTreeMaxDepth;
262272
@@ -280,6 +290,8 @@
281291 /**
282292 * Entry point for the {{#categorytree}} tag parser function.
283293 * This is a wrapper around efCategoryTreeParserHook
 294+ * @param $parser Parser
 295+ * @return array|string
284296 */
285297 function efCategoryTreeParserFunction( $parser ) {
286298 $params = func_get_args();
@@ -297,8 +309,7 @@
298310 if ( preg_match( '/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) {
299311 $k = $m[1];
300312 $v = preg_replace( '/^"\s*(.*?)\s*"$/', '$1', $m[2] ); // strip any quotes enclusing the value
301 - }
302 - else {
 313+ } else {
303314 $k = trim( $p );
304315 $v = true;
305316 }
@@ -314,13 +325,16 @@
315326 /**
316327 * Hook implementation for injecting a category tree into the sidebar.
317328 * Registered automatically if $wgCategoryTreeSidebarRoot is set to a category name.
 329+ * @param $skin
 330+ * @param $tpl SkinTemplate
 331+ * @return bool
318332 */
319333 function efCategoryTreeSkinTemplateOutputPageBeforeExec( $skin, $tpl ) {
320334 global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
321335
322336 $html = efCategoryTreeParserHook( $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions );
323337 if ( $html ) {
324 - $tpl->data['sidebar']['categorytree-portlet'] = $html; // requires MW 1.13, r36917
 338+ $tpl->data['sidebar']['categorytree-portlet'] = $html;
325339 }
326340
327341 return true;
@@ -329,6 +343,11 @@
330344 /**
331345 * Entry point for the <categorytree> tag parser hook.
332346 * This loads CategoryTreeFunctions.php and calls CategoryTree::getTag()
 347+ * @param $cat
 348+ * @param $argv
 349+ * @param $parser Parser
 350+ * @param $allowMissing bool
 351+ * @return bool|string
333352 */
334353 function efCategoryTreeParserHook( $cat, $argv, $parser = null, $allowMissing = false ) {
335354 global $wgOut;
@@ -356,9 +375,12 @@
357376 }
358377
359378 /**
360 -* Hook callback that injects messages and things into the <head> tag
361 -* Does nothing if $parserOutput->mCategoryTreeTag is not set
362 -*/
 379+ * Hook callback that injects messages and things into the <head> tag
 380+ * Does nothing if $parserOutput->mCategoryTreeTag is not set
 381+ * @param $outputPage OutputPage
 382+ * @param $parserOutput ParserOutput
 383+ * @return bool
 384+ */
363385 function efCategoryTreeParserOutput( $outputPage, $parserOutput ) {
364386 if ( !empty( $parserOutput->mCategoryTreeTag ) ) {
365387 CategoryTree::setHeaders( $outputPage );
@@ -371,6 +393,7 @@
372394 *
373395 * @param $title Title
374396 * @param $article Article
 397+ * @return bool
375398 */
376399 function efCategoryTreeArticleFromTitle( $title, &$article ) {
377400 if ( $title->getNamespace() == NS_CATEGORY ) {
@@ -381,6 +404,10 @@
382405
383406 /**
384407 * OutputPageMakeCategoryLinks hook, override category links
 408+ * @param $out
 409+ * @param $categories
 410+ * @param $links
 411+ * @return bool
385412 */
386413 function efCategoryTreeOutputPageMakeCategoryLinks( $out, &$categories, &$links ) {
387414 global $wgCategoryTreePageCategoryOptions;
@@ -392,6 +419,12 @@
393420 return false;
394421 }
395422
 423+/**
 424+ * @param $skin
 425+ * @param $links
 426+ * @param $result
 427+ * @return bool
 428+ */
396429 function efCategoryTreeSkinJoinCategoryLinks( $skin, &$links, &$result ) {
397430 $embed = '<div class="CategoryTreeCategoryBarItem">';
398431 $pop = '</div>';
@@ -402,6 +435,10 @@
403436 return false;
404437 }
405438
 439+/**
 440+ * @param $vars
 441+ * @return bool
 442+ */
406443 function efCategoryTreeGetConfigVars( &$vars ) {
407444 global $wgCategoryTreeCategoryPageOptions;
408445
@@ -409,4 +446,4 @@
410447 $ct = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
411448 $vars['wgCategoryTreePageCategoryOptions'] = $ct->getOptionsAsJsStructure();
412449 return true;
413 -}
\ No newline at end of file
 450+}
Index: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -19,6 +19,10 @@
2020 var $mIsAjaxRequest = false;
2121 var $mOptions = array();
2222
 23+ /**
 24+ * @param $options array
 25+ * @param $ajax bool
 26+ */
2327 function __construct( $options, $ajax = false ) {
2428 global $wgCategoryTreeDefaultOptions;
2529
@@ -56,38 +60,56 @@
5761 }
5862 }
5963
 64+ /**
 65+ * @param $name string
 66+ * @return mixed
 67+ */
6068 function getOption( $name ) {
6169 return $this->mOptions[$name];
6270 }
6371
 72+ /**
 73+ * @return bool
 74+ */
6475 function isInverse( ) {
6576 return $this->getOption( 'mode' ) == CT_MODE_PARENTS;
6677 }
6778
 79+ /**
 80+ * @param $nn
 81+ * @return array|bool
 82+ */
6883 static function decodeNamespaces( $nn ) {
6984 global $wgContLang;
7085
71 - if ( !$nn )
 86+ if ( !$nn ) {
7287 return false;
 88+ }
7389
74 - if ( !is_array( $nn ) )
 90+ if ( !is_array( $nn ) ) {
7591 $nn = preg_split( '![\s#:|]+!', $nn );
 92+ }
7693
7794 $namespaces = array();
7895
7996 foreach ( $nn as $n ) {
8097 if ( is_int( $n ) ) {
8198 $ns = $n;
82 - }
83 - else {
 99+ } else {
84100 $n = trim( $n );
85 - if ( $n === '' ) continue;
 101+ if ( $n === '' ) {
 102+ continue;
 103+ }
86104
87105 $lower = strtolower( $n );
88106
89 - if ( is_numeric( $n ) ) $ns = (int)$n;
90 - elseif ( $n == '-' || $n == '_' || $n == '*' || $lower == 'main' ) $ns = NS_MAIN;
91 - else $ns = $wgContLang->getNsIndex( $n );
 107+ if ( is_numeric( $n ) ) {
 108+ $ns = (int)$n;
 109+ } elseif ( $n == '-' || $n == '_' || $n == '*' || $lower == 'main' ) {
 110+ $ns = NS_MAIN;
 111+ } else {
 112+ $ns = $wgContLang->getNsIndex( $n );
 113+ }
92114 }
93115
94116 if ( is_int( $ns ) ) {
@@ -99,61 +121,111 @@
100122 return $namespaces;
101123 }
102124
 125+ /**
 126+ * @param $mode
 127+ * @return int|string
 128+ */
103129 static function decodeMode( $mode ) {
104130 global $wgCategoryTreeDefaultOptions;
105131
106 - if ( is_null( $mode ) ) return $wgCategoryTreeDefaultOptions['mode'];
107 - if ( is_int( $mode ) ) return $mode;
 132+ if ( is_null( $mode ) ) {
 133+ return $wgCategoryTreeDefaultOptions['mode'];
 134+ }
 135+ if ( is_int( $mode ) ) {
 136+ return $mode;
 137+ }
108138
109139 $mode = trim( strtolower( $mode ) );
110140
111 - if ( is_numeric( $mode ) ) return (int)$mode;
 141+ if ( is_numeric( $mode ) ) {
 142+ return (int)$mode;
 143+ }
112144
113 - if ( $mode == 'all' ) $mode = CT_MODE_ALL;
114 - elseif ( $mode == 'pages' ) $mode = CT_MODE_PAGES;
115 - elseif ( $mode == 'categories' || $mode == 'sub' ) $mode = CT_MODE_CATEGORIES;
116 - elseif ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) $mode = CT_MODE_PARENTS;
117 - elseif ( $mode == 'default' ) $mode = $wgCategoryTreeDefaultOptions['mode'];
 145+ if ( $mode == 'all' ) {
 146+ $mode = CT_MODE_ALL;
 147+ } elseif ( $mode == 'pages' ) {
 148+ $mode = CT_MODE_PAGES;
 149+ } elseif ( $mode == 'categories' || $mode == 'sub' ) {
 150+ $mode = CT_MODE_CATEGORIES;
 151+ } elseif ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) {
 152+ $mode = CT_MODE_PARENTS;
 153+ } elseif ( $mode == 'default' ) {
 154+ $mode = $wgCategoryTreeDefaultOptions['mode'];
 155+ }
118156
119157 return (int)$mode;
120158 }
121159
122160 /**
123 - * Helper function to convert a string to a boolean value.
124 - * Perhaps make this a global function in MediaWiki proper
125 - */
 161+ * Helper function to convert a string to a boolean value.
 162+ * Perhaps make this a global function in MediaWiki proper
 163+ * @param $value
 164+ * @return bool|null|string
 165+ */
126166 static function decodeBoolean( $value ) {
127 - if ( is_null( $value ) ) return null;
128 - if ( is_bool( $value ) ) return $value;
129 - if ( is_int( $value ) ) return ( $value > 0 );
 167+ if ( is_null( $value ) ) {
 168+ return null;
 169+ }
 170+ if ( is_bool( $value ) ) {
 171+ return $value;
 172+ }
 173+ if ( is_int( $value ) ) {
 174+ return ( $value > 0 );
 175+ }
130176
131177 $value = trim( strtolower( $value ) );
132 - if ( is_numeric( $value ) ) return ( (int)$value > 0 );
 178+ if ( is_numeric( $value ) ) {
 179+ return ( (int)$value > 0 );
 180+ }
133181
134 - if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return true;
135 - elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return false;
136 - elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return null;
137 - else return false;
 182+ if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) {
 183+ return true;
 184+ } elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) {
 185+ return false;
 186+ } elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) {
 187+ return null;
 188+ } else {
 189+ return false;
 190+ }
138191 }
139192
 193+ /**
 194+ * @param $value
 195+ * @return int|string
 196+ */
140197 static function decodeHidePrefix( $value ) {
141198 global $wgCategoryTreeDefaultOptions;
142199
143 - if ( is_null( $value ) ) return $wgCategoryTreeDefaultOptions['hideprefix'];
144 - if ( is_int( $value ) ) return $value;
145 - if ( $value === true ) return CT_HIDEPREFIX_ALWAYS;
146 - if ( $value === false ) return CT_HIDEPREFIX_NEVER;
 200+ if ( is_null( $value ) ) {
 201+ return $wgCategoryTreeDefaultOptions['hideprefix'];
 202+ }
 203+ if ( is_int( $value ) ) {
 204+ return $value;
 205+ }
 206+ if ( $value === true ) {
 207+ return CT_HIDEPREFIX_ALWAYS;
 208+ }
 209+ if ( $value === false ) {
 210+ return CT_HIDEPREFIX_NEVER;
 211+ }
147212
148213 $value = trim( strtolower( $value ) );
149214
150 - if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return CT_HIDEPREFIX_ALWAYS;
151 - elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return CT_HIDEPREFIX_NEVER;
152 - // elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix'];
153 - elseif ( $value == 'always' ) return CT_HIDEPREFIX_ALWAYS;
154 - elseif ( $value == 'never' ) return CT_HIDEPREFIX_NEVER;
155 - elseif ( $value == 'auto' ) return CT_HIDEPREFIX_AUTO;
156 - elseif ( $value == 'categories' || $value == 'category' || $value == 'smart' ) return CT_HIDEPREFIX_CATEGORIES;
157 - else return $wgCategoryTreeDefaultOptions['hideprefix'];
 215+ if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) {
 216+ return CT_HIDEPREFIX_ALWAYS;
 217+ } elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) {
 218+ return CT_HIDEPREFIX_NEVER;
 219+ } elseif ( $value == 'always' ) {
 220+ return CT_HIDEPREFIX_ALWAYS;
 221+ } elseif ( $value == 'never' ) {
 222+ return CT_HIDEPREFIX_NEVER;
 223+ } elseif ( $value == 'auto' ) {
 224+ return CT_HIDEPREFIX_AUTO;
 225+ } elseif ( $value == 'categories' || $value == 'category' || $value == 'smart' ) {
 226+ return CT_HIDEPREFIX_CATEGORIES;
 227+ } else {
 228+ return $wgCategoryTreeDefaultOptions['hideprefix'];
 229+ }
158230 }
159231
160232 /**
@@ -166,6 +238,12 @@
167239 $outputPage->addModules( 'ext.categoryTree' );
168240 }
169241
 242+ /**
 243+ * @param $options
 244+ * @param $enc
 245+ * @return mixed
 246+ * @throws MWException
 247+ */
170248 static function encodeOptions( $options, $enc ) {
171249 if ( $enc == 'mode' || $enc == '' ) {
172250 $opt = $options['mode'];
@@ -178,6 +256,12 @@
179257 return $opt;
180258 }
181259
 260+ /**
 261+ * @param $options
 262+ * @param $enc
 263+ * @return array|mixed
 264+ * @throws MWException
 265+ */
182266 static function decodeOptions( $options, $enc ) {
183267 if ( $enc == 'mode' || $enc == '' ) {
184268 $opt = array( "mode" => $options );
@@ -191,6 +275,10 @@
192276 return $opt;
193277 }
194278
 279+ /**
 280+ * @param $depth null
 281+ * @return string
 282+ */
195283 function getOptionsAsCacheKey( $depth = null ) {
196284 $key = "";
197285
@@ -199,10 +287,16 @@
200288 $key .= $k . ':' . $v . ';';
201289 }
202290
203 - if ( !is_null( $depth ) ) $key .= ";depth=" . $depth;
 291+ if ( !is_null( $depth ) ) {
 292+ $key .= ";depth=" . $depth;
 293+ }
204294 return $key;
205295 }
206296
 297+ /**
 298+ * @param $depthnull
 299+ * @return mixed
 300+ */
207301 function getOptionsAsJsStructure( $depth = null ) {
208302 if ( !is_null( $depth ) ) {
209303 $opt = $this->mOptions;
@@ -215,10 +309,17 @@
216310 return $s;
217311 }
218312
219 - function getOptionsAsJsString( $depth = NULL ) {
 313+ /**
 314+ * @param $depth null
 315+ * @return String
 316+ */
 317+ function getOptionsAsJsString( $depth = null ) {
220318 return Xml::escapeJsString( $this->getOptionsAsJsStructure( $depth ) );
221319 }
222320
 321+ /**
 322+ * @return string
 323+ */
223324 function getOptionsAsUrlParameters() {
224325 $u = '';
225326
@@ -231,9 +332,12 @@
232333 }
233334
234335 /**
235 - * Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used to
236 - * load CategoryTreeFunctions.php on demand.
237 - */
 336+ * Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used to
 337+ * load CategoryTreeFunctions.php on demand.
 338+ * @param $category
 339+ * @param $depth int
 340+ * @return AjaxResponse|bool
 341+ */
238342 function ajax( $category, $depth = 1 ) {
239343 global $wgLang, $wgContLang, $wgRenderHashAppend;
240344 $title = self::makeTitle( $category );
@@ -251,7 +355,12 @@
252356 'page_title' => $dbkey,
253357 ), __METHOD__ );
254358
255 - $mckey = wfMemcKey( "categorytree(" . $this->getOptionsAsCacheKey( $depth ) . ")", $dbkey, $wgLang->getCode(), $wgContLang->getExtraHashOptions(), $wgRenderHashAppend );
 359+ $mckey = wfMemcKey(
 360+ "categorytree(" . $this->getOptionsAsCacheKey( $depth ) . ")",
 361+ $dbkey, $wgLang->getCode(),
 362+ $wgContLang->getExtraHashOptions(),
 363+ $wgRenderHashAppend
 364+ );
256365
257366 $response = new AjaxResponse();
258367
@@ -353,9 +462,11 @@
354463 }
355464
356465 /**
357 - * Returns a string with an HTML representation of the children of the given category.
358 - * @param $title Title
359 - */
 466+ * Returns a string with an HTML representation of the children of the given category.
 467+ * @param $title Title
 468+ * @param $depth int
 469+ * @return string
 470+ */
360471 function renderChildren( $title, $depth = 1 ) {
361472 global $wgCategoryTreeMaxChildren, $wgCategoryTreeUseCategoryTable;
362473
@@ -444,9 +555,10 @@
445556 }
446557
447558 /**
448 - * Returns a string with an HTML representation of the parents of the given category.
449 - * @var $title Title
450 - */
 559+ * Returns a string with an HTML representation of the parents of the given category.
 560+ * @param $title Title
 561+ * @return string
 562+ */
451563 function renderParents( $title ) {
452564 global $wgCategoryTreeMaxChildren;
453565
@@ -498,9 +610,12 @@
499611 }
500612
501613 /**
502 - * Returns a string with a HTML represenation of the given page.
503 - * $title must be a Title object
504 - */
 614+ * Returns a string with a HTML represenation of the given page.
 615+ * @param $title Title
 616+ * @param int $children
 617+ * @param bool $loadchildren
 618+ * @return string
 619+ */
505620 function renderNode( $title, $children = 0, $loadchildren = false ) {
506621 global $wgCategoryTreeUseCategoryTable;
507622
@@ -514,9 +629,14 @@
515630 }
516631
517632 /**
518 - * Returns a string with a HTML represenation of the given page.
519 - * $info must be an associative array, containing at least a Title object under the 'title' key.
520 - */
 633+ * Returns a string with a HTML represenation of the given page.
 634+ * $info must be an associative array, containing at least a Title object under the 'title' key.
 635+ * @param $title Title
 636+ * @param $cat Category
 637+ * @param $children int
 638+ * @param $loadchildren bool
 639+ * @return string
 640+ */
521641 function renderNodeInfo( $title, $cat, $children = 0, $loadchildren = false ) {
522642 static $uniq = 0;
523643
@@ -724,8 +844,10 @@
725845 }
726846
727847 /**
728 - * Creates a Title object from a user provided (and thus unsafe) string
729 - */
 848+ * Creates a Title object from a user provided (and thus unsafe) string
 849+ * @param $title string
 850+ * @return null|Title
 851+ */
730852 static function makeTitle( $title ) {
731853 $title = trim( $title );
732854
Property changes on: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
733855 Merged /trunk/extensions/CategoryTree/CategoryTreeFunctions.php:r110933,111011,111218,112925,112993
Property changes on: branches/wmf/1.19wmf1/extensions/CategoryTree
___________________________________________________________________
Modified: svn:mergeinfo
734856 Merged /trunk/extensions/CategoryTree:r110933,111011,112925,112993
Index: branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialCentralAuth.php
@@ -706,7 +706,7 @@
707707 foreach ( array( 'primary', 'new', 'empty', 'password', 'mail', 'admin', 'login' ) as $method ) {
708708 $short = Xml::encodeJsVar( $this->getLanguage()->ucfirst( wfMsgHtml( "centralauth-merge-method-{$method}" ) ) );
709709 $desc = Xml::encodeJsVar( wfMsgWikiHtml( "centralauth-merge-method-{$method}-desc" ) );
710 - $js .= "\t'{$method}' : { 'short' : {$short}, 'desc' : {$desc} },\n";
 710+ $js .= "\t'{$method}' : { 'short' : {$short}, 'desc' : {$desc} }\n";
711711 }
712712 $js .= "}";
713713 $this->getOutput()->addInlineScript( $js );
Index: branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
@@ -131,13 +131,13 @@
132132 } else {
133133 $usage = wfMsgExt( 'centralauth-editset-nouse', 'parse' );
134134 }
 135+ $sortedWikis = $set->getWikisRaw();
 136+ sort( $sortedWikis );
135137 } else {
136138 $usage = '';
 139+ $sortedWikis = array();
137140 }
138141
139 - $sortedWikis = $set->getWikisRaw();
140 - sort( $sortedWikis );
141 -
142142 # Make an array of the opposite list of wikis
143143 # (all databases *excluding* the defined ones)
144144 $restWikis = array();
Property changes on: branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
___________________________________________________________________
Modified: svn:mergeinfo
145145 Merged /trunk/extensions/CentralAuth/specials/SpecialWikiSets.php:r112993
Property changes on: branches/wmf/1.19wmf1/extensions
___________________________________________________________________
Modified: svn:mergeinfo
146146 Merged /trunk/extensions:r110933,111011,112751,112925,112993

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110933Followup r98500, fixes flash of unstyled contentjohnduhart14:07, 8 February 2012
r111011Documentation, stylize, remove some global dependenciesreedy01:23, 9 February 2012
r111218attempt to fix bug33989 - fix the mode parameter in api callbsitu23:41, 10 February 2012
r112751Don't explicitly use Services_JSON, use FormatJsonreedy01:17, 1 March 2012
r112925[SpecialCentralAuth] Fix trailing comma in object literal. This is too much f...krinkle22:37, 2 March 2012
r112993Bug 34979 - [Regression] PHP fatal error in SpecialWikiSets.php...reedy00:08, 5 March 2012

Status & tagging log