https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113035
Revision: 113035
Author: reedy
Date: 2012-03-05 14:31:53 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
MFT r110933, r111011, r111218, r112751, r112925, r112993
Modified Paths:
--------------
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryPageSubclass.php
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreePage.php
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialCentralAuth.php
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
Property Changed:
----------------
branches/wmf/1.19wmf1/extensions/
branches/wmf/1.19wmf1/extensions/CategoryTree/
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
Property changes on: branches/wmf/1.19wmf1/extensions
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting/extensions:100352-107913
/branches/REL1_15/phase3/extensions:51646
/branches/REL1_17/phase3/extensions:81445,81448
/branches/new-installer/phase3/extensions:43664-66004
/branches/sqlite/extensions:58211-58321
/branches/wmf/1.18wmf1/extensions:97508
/trunk/extensions:111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112360,112517,112571,112613,112628,112758,112770-112772,112775,112849,112851,112856,112859,112903
/trunk/phase3/extensions:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251
+ /branches/JSTesting/extensions:100352-107913
/branches/REL1_15/phase3/extensions:51646
/branches/REL1_17/phase3/extensions:81445,81448
/branches/new-installer/phase3/extensions:43664-66004
/branches/sqlite/extensions:58211-58321
/branches/wmf/1.18wmf1/extensions:97508
/trunk/extensions:110933,111011,111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112360,112517,112571,112613,112628,112751,112758,112770-112772,112775,112849,112851,112856,112859,112903,112925,112993
/trunk/phase3/extensions:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251
Property changes on: branches/wmf/1.19wmf1/extensions/CategoryTree
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting/extensions/CategoryTree:100352-107913
/branches/REL1_15/phase3/extensions/CategoryTree:51646
/branches/REL1_17/phase3/extensions/CategoryTree:81445,81448
/branches/new-installer/phase3/extensions/CategoryTree:43664-66004
/branches/sqlite/extensions/CategoryTree:58211-58321
/branches/wmf/1.18wmf1/extensions/CategoryTree:97508
/trunk/extensions/CategoryTree:111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112360,112517,112571,112613,112628,112751,112849,112851,112856,112859
/trunk/phase3/extensions/CategoryTree:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251
+ /branches/JSTesting/extensions/CategoryTree:100352-107913
/branches/REL1_15/phase3/extensions/CategoryTree:51646
/branches/REL1_17/phase3/extensions/CategoryTree:81445,81448
/branches/new-installer/phase3/extensions/CategoryTree:43664-66004
/branches/sqlite/extensions/CategoryTree:58211-58321
/branches/wmf/1.18wmf1/extensions/CategoryTree:97508
/trunk/extensions/CategoryTree:110933,111011,111043,111199,111218,111484,111575,111604,111659-111661,111668,111670,111688,111690,111698,111713,111715,111780,111796,111814,111947,112074,112153,112160,112166,112260,112282,112360,112517,112571,112613,112628,112751,112849,112851,112856,112859,112925,112993
/trunk/phase3/extensions/CategoryTree:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251
Modified: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryPageSubclass.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryPageSubclass.php
2012-03-05 14:23:36 UTC (rev 113034)
+++ branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryPageSubclass.php
2012-03-05 14:31:53 UTC (rev 113035)
@@ -7,11 +7,21 @@
class CategoryTreeCategoryViewer extends CategoryViewer {
var $child_cats;
+ /**
+ * @var CategoryTree
+ */
+ var $categorytree;
+
+ /**
+ * @return CategoryTree
+ */
function getCategoryTree() {
global $wgOut, $wgCategoryTreeCategoryPageOptions,
$wgCategoryTreeForceHeaders;
- if ( ! isset( $this->categorytree ) ) {
- if ( !$wgCategoryTreeForceHeaders )
CategoryTree::setHeaders( $wgOut );
+ if ( !isset( $this->categorytree ) ) {
+ if ( !$wgCategoryTreeForceHeaders ) {
+ CategoryTree::setHeaders( $wgOut );
+ }
$this->categorytree = new CategoryTree(
$wgCategoryTreeCategoryPageOptions );
}
@@ -21,6 +31,10 @@
/**
* Add a subcategory to the internal lists
+ * @param $cat Category
+ * @param $sortkey
+ * @param $pageLength
+ * @return
*/
function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
global $wgRequest;
@@ -28,7 +42,8 @@
$title = $cat->getTitle();
if ( $wgRequest->getCheck( 'notree' ) ) {
- return parent::addSubcategoryObject( $cat, $sortkey,
$pageLength );
+ parent::addSubcategoryObject( $cat, $sortkey,
$pageLength );
+ return;
}
$tree = $this->getCategoryTree();
Modified: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php
2012-03-05 14:23:36 UTC (rev 113034)
+++ branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTree.php
2012-03-05 14:31:53 UTC (rev 113035)
@@ -217,6 +217,10 @@
$wgHooks['MakeGlobalVariablesScript'][] = 'efCategoryTreeGetConfigVars';
}
+/**
+ * @param $parser Parser
+ * @return bool
+ */
function efCategoryTreeSetHooks( $parser ) {
$parser->setHook( 'categorytree' , 'efCategoryTreeParserHook' );
$parser->setFunctionHook( 'categorytree' ,
'efCategoryTreeParserFunction' );
@@ -229,6 +233,10 @@
* If $enc is not given, '' is asumed, which simulates the old call interface,
* namely, only providing the mode name or number.
* This loads CategoryTreeFunctions.php and calls CategoryTree::ajax()
+ * @param $category
+ * @param $options array
+ * @param $enc string
+ * @return AjaxResponse|bool
*/
function efCategoryTreeAjaxWrapper( $category, $options = array(), $enc = '' )
{
global $wgCategoryTreeHTTPCache, $wgSquidMaxage, $wgUseSquid;
@@ -254,8 +262,10 @@
/**
* Internal function to cap depth
+ * @param $mode
+ * @param $depth
+ * @return int|mixed
*/
-
function efCategoryTreeCapDepth( $mode, $depth ) {
global $wgCategoryTreeMaxDepth;
@@ -280,6 +290,8 @@
/**
* Entry point for the {{#categorytree}} tag parser function.
* This is a wrapper around efCategoryTreeParserHook
+ * @param $parser Parser
+ * @return array|string
*/
function efCategoryTreeParserFunction( $parser ) {
$params = func_get_args();
@@ -297,8 +309,7 @@
if ( preg_match( '/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) {
$k = $m[1];
$v = preg_replace( '/^"\s*(.*?)\s*"$/', '$1', $m[2] );
// strip any quotes enclusing the value
- }
- else {
+ } else {
$k = trim( $p );
$v = true;
}
@@ -314,13 +325,16 @@
/**
* Hook implementation for injecting a category tree into the sidebar.
* Registered automatically if $wgCategoryTreeSidebarRoot is set to a category
name.
+ * @param $skin
+ * @param $tpl SkinTemplate
+ * @return bool
*/
function efCategoryTreeSkinTemplateOutputPageBeforeExec( $skin, $tpl ) {
global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions;
$html = efCategoryTreeParserHook( $wgCategoryTreeSidebarRoot,
$wgCategoryTreeSidebarOptions );
if ( $html ) {
- $tpl->data['sidebar']['categorytree-portlet'] = $html; //
requires MW 1.13, r36917
+ $tpl->data['sidebar']['categorytree-portlet'] = $html;
}
return true;
@@ -329,6 +343,11 @@
/**
* Entry point for the <categorytree> tag parser hook.
* This loads CategoryTreeFunctions.php and calls CategoryTree::getTag()
+ * @param $cat
+ * @param $argv
+ * @param $parser Parser
+ * @param $allowMissing bool
+ * @return bool|string
*/
function efCategoryTreeParserHook( $cat, $argv, $parser = null, $allowMissing
= false ) {
global $wgOut;
@@ -356,9 +375,12 @@
}
/**
-* Hook callback that injects messages and things into the <head> tag
-* Does nothing if $parserOutput->mCategoryTreeTag is not set
-*/
+ * Hook callback that injects messages and things into the <head> tag
+ * Does nothing if $parserOutput->mCategoryTreeTag is not set
+ * @param $outputPage OutputPage
+ * @param $parserOutput ParserOutput
+ * @return bool
+ */
function efCategoryTreeParserOutput( $outputPage, $parserOutput ) {
if ( !empty( $parserOutput->mCategoryTreeTag ) ) {
CategoryTree::setHeaders( $outputPage );
@@ -371,6 +393,7 @@
*
* @param $title Title
* @param $article Article
+ * @return bool
*/
function efCategoryTreeArticleFromTitle( $title, &$article ) {
if ( $title->getNamespace() == NS_CATEGORY ) {
@@ -381,6 +404,10 @@
/**
* OutputPageMakeCategoryLinks hook, override category links
+ * @param $out
+ * @param $categories
+ * @param $links
+ * @return bool
*/
function efCategoryTreeOutputPageMakeCategoryLinks( $out, &$categories,
&$links ) {
global $wgCategoryTreePageCategoryOptions;
@@ -392,6 +419,12 @@
return false;
}
+/**
+ * @param $skin
+ * @param $links
+ * @param $result
+ * @return bool
+ */
function efCategoryTreeSkinJoinCategoryLinks( $skin, &$links, &$result ) {
$embed = '<div class="CategoryTreeCategoryBarItem">';
$pop = '</div>';
@@ -402,6 +435,10 @@
return false;
}
+/**
+ * @param $vars
+ * @return bool
+ */
function efCategoryTreeGetConfigVars( &$vars ) {
global $wgCategoryTreeCategoryPageOptions;
@@ -409,4 +446,4 @@
$ct = new CategoryTree( $wgCategoryTreeCategoryPageOptions );
$vars['wgCategoryTreePageCategoryOptions'] =
$ct->getOptionsAsJsStructure();
return true;
-}
\ No newline at end of file
+}
Modified:
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
2012-03-05 14:23:36 UTC (rev 113034)
+++ branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
2012-03-05 14:31:53 UTC (rev 113035)
@@ -19,6 +19,10 @@
var $mIsAjaxRequest = false;
var $mOptions = array();
+ /**
+ * @param $options array
+ * @param $ajax bool
+ */
function __construct( $options, $ajax = false ) {
global $wgCategoryTreeDefaultOptions;
@@ -56,38 +60,56 @@
}
}
+ /**
+ * @param $name string
+ * @return mixed
+ */
function getOption( $name ) {
return $this->mOptions[$name];
}
+ /**
+ * @return bool
+ */
function isInverse( ) {
return $this->getOption( 'mode' ) == CT_MODE_PARENTS;
}
+ /**
+ * @param $nn
+ * @return array|bool
+ */
static function decodeNamespaces( $nn ) {
global $wgContLang;
- if ( !$nn )
+ if ( !$nn ) {
return false;
+ }
- if ( !is_array( $nn ) )
+ if ( !is_array( $nn ) ) {
$nn = preg_split( '![\s#:|]+!', $nn );
+ }
$namespaces = array();
foreach ( $nn as $n ) {
if ( is_int( $n ) ) {
$ns = $n;
- }
- else {
+ } else {
$n = trim( $n );
- if ( $n === '' ) continue;
+ if ( $n === '' ) {
+ continue;
+ }
$lower = strtolower( $n );
- if ( is_numeric( $n ) ) $ns = (int)$n;
- elseif ( $n == '-' || $n == '_' || $n == '*' ||
$lower == 'main' ) $ns = NS_MAIN;
- else $ns = $wgContLang->getNsIndex( $n );
+ if ( is_numeric( $n ) ) {
+ $ns = (int)$n;
+ } elseif ( $n == '-' || $n == '_' || $n == '*'
|| $lower == 'main' ) {
+ $ns = NS_MAIN;
+ } else {
+ $ns = $wgContLang->getNsIndex( $n );
+ }
}
if ( is_int( $ns ) ) {
@@ -99,61 +121,111 @@
return $namespaces;
}
+ /**
+ * @param $mode
+ * @return int|string
+ */
static function decodeMode( $mode ) {
global $wgCategoryTreeDefaultOptions;
- if ( is_null( $mode ) ) return
$wgCategoryTreeDefaultOptions['mode'];
- if ( is_int( $mode ) ) return $mode;
+ if ( is_null( $mode ) ) {
+ return $wgCategoryTreeDefaultOptions['mode'];
+ }
+ if ( is_int( $mode ) ) {
+ return $mode;
+ }
$mode = trim( strtolower( $mode ) );
- if ( is_numeric( $mode ) ) return (int)$mode;
+ if ( is_numeric( $mode ) ) {
+ return (int)$mode;
+ }
- if ( $mode == 'all' ) $mode = CT_MODE_ALL;
- elseif ( $mode == 'pages' ) $mode = CT_MODE_PAGES;
- elseif ( $mode == 'categories' || $mode == 'sub' ) $mode =
CT_MODE_CATEGORIES;
- elseif ( $mode == 'parents' || $mode == 'super' || $mode ==
'inverse' ) $mode = CT_MODE_PARENTS;
- elseif ( $mode == 'default' ) $mode =
$wgCategoryTreeDefaultOptions['mode'];
+ if ( $mode == 'all' ) {
+ $mode = CT_MODE_ALL;
+ } elseif ( $mode == 'pages' ) {
+ $mode = CT_MODE_PAGES;
+ } elseif ( $mode == 'categories' || $mode == 'sub' ) {
+ $mode = CT_MODE_CATEGORIES;
+ } elseif ( $mode == 'parents' || $mode == 'super' || $mode ==
'inverse' ) {
+ $mode = CT_MODE_PARENTS;
+ } elseif ( $mode == 'default' ) {
+ $mode = $wgCategoryTreeDefaultOptions['mode'];
+ }
return (int)$mode;
}
/**
- * Helper function to convert a string to a boolean value.
- * Perhaps make this a global function in MediaWiki proper
- */
+ * Helper function to convert a string to a boolean value.
+ * Perhaps make this a global function in MediaWiki proper
+ * @param $value
+ * @return bool|null|string
+ */
static function decodeBoolean( $value ) {
- if ( is_null( $value ) ) return null;
- if ( is_bool( $value ) ) return $value;
- if ( is_int( $value ) ) return ( $value > 0 );
+ if ( is_null( $value ) ) {
+ return null;
+ }
+ if ( is_bool( $value ) ) {
+ return $value;
+ }
+ if ( is_int( $value ) ) {
+ return ( $value > 0 );
+ }
$value = trim( strtolower( $value ) );
- if ( is_numeric( $value ) ) return ( (int)$value > 0 );
+ if ( is_numeric( $value ) ) {
+ return ( (int)$value > 0 );
+ }
- if ( $value == 'yes' || $value == 'y' || $value == 'true' ||
$value == 't' || $value == 'on' ) return true;
- elseif ( $value == 'no' || $value == 'n' || $value == 'false'
|| $value == 'f' || $value == 'off' ) return false;
- elseif ( $value == 'null' || $value == 'default' || $value ==
'none' || $value == 'x' ) return null;
- else return false;
+ if ( $value == 'yes' || $value == 'y' || $value == 'true' ||
$value == 't' || $value == 'on' ) {
+ return true;
+ } elseif ( $value == 'no' || $value == 'n' || $value == 'false'
|| $value == 'f' || $value == 'off' ) {
+ return false;
+ } elseif ( $value == 'null' || $value == 'default' || $value ==
'none' || $value == 'x' ) {
+ return null;
+ } else {
+ return false;
+ }
}
+ /**
+ * @param $value
+ * @return int|string
+ */
static function decodeHidePrefix( $value ) {
global $wgCategoryTreeDefaultOptions;
- if ( is_null( $value ) ) return
$wgCategoryTreeDefaultOptions['hideprefix'];
- if ( is_int( $value ) ) return $value;
- if ( $value === true ) return CT_HIDEPREFIX_ALWAYS;
- if ( $value === false ) return CT_HIDEPREFIX_NEVER;
+ if ( is_null( $value ) ) {
+ return $wgCategoryTreeDefaultOptions['hideprefix'];
+ }
+ if ( is_int( $value ) ) {
+ return $value;
+ }
+ if ( $value === true ) {
+ return CT_HIDEPREFIX_ALWAYS;
+ }
+ if ( $value === false ) {
+ return CT_HIDEPREFIX_NEVER;
+ }
$value = trim( strtolower( $value ) );
- if ( $value == 'yes' || $value == 'y' || $value == 'true' ||
$value == 't' || $value == 'on' ) return CT_HIDEPREFIX_ALWAYS;
- elseif ( $value == 'no' || $value == 'n' || $value == 'false'
|| $value == 'f' || $value == 'off' ) return CT_HIDEPREFIX_NEVER;
- // elseif ( $value == 'null' || $value == 'default' || $value
== 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix'];
- elseif ( $value == 'always' ) return CT_HIDEPREFIX_ALWAYS;
- elseif ( $value == 'never' ) return CT_HIDEPREFIX_NEVER;
- elseif ( $value == 'auto' ) return CT_HIDEPREFIX_AUTO;
- elseif ( $value == 'categories' || $value == 'category' ||
$value == 'smart' ) return CT_HIDEPREFIX_CATEGORIES;
- else return $wgCategoryTreeDefaultOptions['hideprefix'];
+ if ( $value == 'yes' || $value == 'y' || $value == 'true' ||
$value == 't' || $value == 'on' ) {
+ return CT_HIDEPREFIX_ALWAYS;
+ } elseif ( $value == 'no' || $value == 'n' || $value == 'false'
|| $value == 'f' || $value == 'off' ) {
+ return CT_HIDEPREFIX_NEVER;
+ } elseif ( $value == 'always' ) {
+ return CT_HIDEPREFIX_ALWAYS;
+ } elseif ( $value == 'never' ) {
+ return CT_HIDEPREFIX_NEVER;
+ } elseif ( $value == 'auto' ) {
+ return CT_HIDEPREFIX_AUTO;
+ } elseif ( $value == 'categories' || $value == 'category' ||
$value == 'smart' ) {
+ return CT_HIDEPREFIX_CATEGORIES;
+ } else {
+ return $wgCategoryTreeDefaultOptions['hideprefix'];
+ }
}
/**
@@ -166,6 +238,12 @@
$outputPage->addModules( 'ext.categoryTree' );
}
+ /**
+ * @param $options
+ * @param $enc
+ * @return mixed
+ * @throws MWException
+ */
static function encodeOptions( $options, $enc ) {
if ( $enc == 'mode' || $enc == '' ) {
$opt = $options['mode'];
@@ -178,6 +256,12 @@
return $opt;
}
+ /**
+ * @param $options
+ * @param $enc
+ * @return array|mixed
+ * @throws MWException
+ */
static function decodeOptions( $options, $enc ) {
if ( $enc == 'mode' || $enc == '' ) {
$opt = array( "mode" => $options );
@@ -191,6 +275,10 @@
return $opt;
}
+ /**
+ * @param $depth null
+ * @return string
+ */
function getOptionsAsCacheKey( $depth = null ) {
$key = "";
@@ -199,10 +287,16 @@
$key .= $k . ':' . $v . ';';
}
- if ( !is_null( $depth ) ) $key .= ";depth=" . $depth;
+ if ( !is_null( $depth ) ) {
+ $key .= ";depth=" . $depth;
+ }
return $key;
}
+ /**
+ * @param $depthnull
+ * @return mixed
+ */
function getOptionsAsJsStructure( $depth = null ) {
if ( !is_null( $depth ) ) {
$opt = $this->mOptions;
@@ -215,10 +309,17 @@
return $s;
}
- function getOptionsAsJsString( $depth = NULL ) {
+ /**
+ * @param $depth null
+ * @return String
+ */
+ function getOptionsAsJsString( $depth = null ) {
return Xml::escapeJsString( $this->getOptionsAsJsStructure(
$depth ) );
}
+ /**
+ * @return string
+ */
function getOptionsAsUrlParameters() {
$u = '';
@@ -231,9 +332,12 @@
}
/**
- * Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used
to
- * load CategoryTreeFunctions.php on demand.
- */
+ * Ajax call. This is called by efCategoryTreeAjaxWrapper, which is
used to
+ * load CategoryTreeFunctions.php on demand.
+ * @param $category
+ * @param $depth int
+ * @return AjaxResponse|bool
+ */
function ajax( $category, $depth = 1 ) {
global $wgLang, $wgContLang, $wgRenderHashAppend;
$title = self::makeTitle( $category );
@@ -251,7 +355,12 @@
'page_title' => $dbkey,
), __METHOD__ );
- $mckey = wfMemcKey( "categorytree(" .
$this->getOptionsAsCacheKey( $depth ) . ")", $dbkey, $wgLang->getCode(),
$wgContLang->getExtraHashOptions(), $wgRenderHashAppend );
+ $mckey = wfMemcKey(
+ "categorytree(" . $this->getOptionsAsCacheKey( $depth )
. ")",
+ $dbkey, $wgLang->getCode(),
+ $wgContLang->getExtraHashOptions(),
+ $wgRenderHashAppend
+ );
$response = new AjaxResponse();
@@ -353,9 +462,11 @@
}
/**
- * Returns a string with an HTML representation of the children of the
given category.
- * @param $title Title
- */
+ * Returns a string with an HTML representation of the children of the
given category.
+ * @param $title Title
+ * @param $depth int
+ * @return string
+ */
function renderChildren( $title, $depth = 1 ) {
global $wgCategoryTreeMaxChildren,
$wgCategoryTreeUseCategoryTable;
@@ -444,9 +555,10 @@
}
/**
- * Returns a string with an HTML representation of the parents of the
given category.
- * @var $title Title
- */
+ * Returns a string with an HTML representation of the parents of the
given category.
+ * @param $title Title
+ * @return string
+ */
function renderParents( $title ) {
global $wgCategoryTreeMaxChildren;
@@ -498,9 +610,12 @@
}
/**
- * Returns a string with a HTML represenation of the given page.
- * $title must be a Title object
- */
+ * Returns a string with a HTML represenation of the given page.
+ * @param $title Title
+ * @param int $children
+ * @param bool $loadchildren
+ * @return string
+ */
function renderNode( $title, $children = 0, $loadchildren = false ) {
global $wgCategoryTreeUseCategoryTable;
@@ -514,9 +629,14 @@
}
/**
- * Returns a string with a HTML represenation of the given page.
- * $info must be an associative array, containing at least a Title
object under the 'title' key.
- */
+ * Returns a string with a HTML represenation of the given page.
+ * $info must be an associative array, containing at least a Title
object under the 'title' key.
+ * @param $title Title
+ * @param $cat Category
+ * @param $children int
+ * @param $loadchildren bool
+ * @return string
+ */
function renderNodeInfo( $title, $cat, $children = 0, $loadchildren =
false ) {
static $uniq = 0;
@@ -724,8 +844,10 @@
}
/**
- * Creates a Title object from a user provided (and thus unsafe) string
- */
+ * Creates a Title object from a user provided (and thus unsafe) string
+ * @param $title string
+ * @return null|Title
+ */
static function makeTitle( $title ) {
$title = trim( $title );
Property changes on:
branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreeFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
-
/branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php:67183
/trunk/extensions/CategoryTree/CategoryTreeFunctions.php:112751,112856,112859
+
/branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php:67183
/trunk/extensions/CategoryTree/CategoryTreeFunctions.php:110933,111011,111218,112751,112856,112859,112925,112993
Modified: branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreePage.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreePage.php
2012-03-05 14:23:36 UTC (rev 113034)
+++ branches/wmf/1.19wmf1/extensions/CategoryTree/CategoryTreePage.php
2012-03-05 14:31:53 UTC (rev 113035)
@@ -19,13 +19,14 @@
var $target = '';
var $tree = null;
- /**
- * Constructor
- */
function __construct() {
parent::__construct( 'CategoryTree', '', true );
}
+ /**
+ * @param $name
+ * @return mixed
+ */
function getOption( $name ) {
global $wgCategoryTreeDefaultOptions;
@@ -38,16 +39,19 @@
/**
* Main execution function
- * @param $par Parameters passed to the page
+ * @param $par array Parameters passed to the page
*/
function execute( $par ) {
- global $wgRequest, $wgOut, $wgCategoryTreeDefaultOptions,
$wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
+ global $wgCategoryTreeDefaultOptions,
$wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
$this->setHeaders();
+ $request = $this->getRequest();
+ if ( $par ) {
+ $this->target = $par;
+ } else {
+ $this->target = $request->getVal( 'target', wfMsg(
'rootcategory' ) );
+ }
- if ( $par ) $this->target = $par;
- else $this->target = $wgRequest->getVal( 'target', wfMsg(
'rootcategory' ) );
-
$this->target = trim( $this->target );
# HACK for undefined root category
@@ -59,47 +63,50 @@
# grab all known options from the request. Normalization is
done by the CategoryTree class
foreach ( $wgCategoryTreeDefaultOptions as $option => $default
) {
- if ( isset( $wgCategoryTreeSpecialPageOptions[$option]
) )
+ if ( isset( $wgCategoryTreeSpecialPageOptions[$option]
) ) {
$default =
$wgCategoryTreeSpecialPageOptions[$option];
+ }
- $options[$option] = $wgRequest->getVal( $option,
$default );
+ $options[$option] = $request->getVal( $option, $default
);
}
$this->tree = new CategoryTree( $options );
- $wgOut->addWikiMsg( 'categorytree-header' );
+ $output = $this->getOutput();
+ $output->addWikiMsg( 'categorytree-header' );
$this->executeInputForm();
if ( $this->target !== '' && $this->target !== null ) {
- if ( !$wgCategoryTreeForceHeaders )
CategoryTree::setHeaders( $wgOut );
+ if ( !$wgCategoryTreeForceHeaders ) {
+ CategoryTree::setHeaders( $output );
+ }
$title = CategoryTree::makeTitle( $this->target );
if ( $title && $title->getArticleID() ) {
- $wgOut->addHTML( Xml::openElement( 'div',
array( 'class' => 'CategoryTreeParents' ) ) );
- $wgOut->addHTML( wfMsgExt(
'categorytree-parents', 'parseinline' ) );
- $wgOut->addHTML( wfMsg( 'colon-separator' ) );
+ $output->addHTML( Xml::openElement( 'div',
array( 'class' => 'CategoryTreeParents' ) ) );
+ $output->addHTML( wfMsgExt(
'categorytree-parents', 'parseinline' ) );
+ $output->addHTML( wfMsg( 'colon-separator' ) );
$parents = $this->tree->renderParents( $title );
if ( $parents == '' ) {
- $wgOut->addHTML( wfMsgExt(
'categorytree-no-parent-categories', 'parseinline' ) );
+ $output->addHTML( wfMsgExt(
'categorytree-no-parent-categories', 'parseinline' ) );
} else {
- $wgOut->addHTML( $parents );
+ $output->addHTML( $parents );
}
- $wgOut->addHTML( Xml::closeElement( 'div' ) );
+ $output->addHTML( Xml::closeElement( 'div' ) );
- $wgOut->addHTML( Xml::openElement( 'div',
array( 'class' => 'CategoryTreeResult' ) ) );
- $wgOut->addHTML( $this->tree->renderNode(
$title, 1 ) );
- $wgOut->addHTML( Xml::closeElement( 'div' ) );
+ $output->addHTML( Xml::openElement( 'div',
array( 'class' => 'CategoryTreeResult' ) ) );
+ $output->addHTML( $this->tree->renderNode(
$title, 1 ) );
+ $output->addHTML( Xml::closeElement( 'div' ) );
+ } else {
+ $output->addHTML( Xml::openElement( 'div',
array( 'class' => 'CategoryTreeNotice' ) ) );
+ $output->addHTML( wfMsgExt(
'categorytree-not-found', 'parseinline' , $this->target ) );
+ $output->addHTML( Xml::closeElement( 'div' ) );
}
- else {
- $wgOut->addHTML( Xml::openElement( 'div',
array( 'class' => 'CategoryTreeNotice' ) ) );
- $wgOut->addHTML( wfMsgExt(
'categorytree-not-found', 'parseinline' , $this->target ) );
- $wgOut->addHTML( Xml::closeElement( 'div' ) );
- }
}
}
@@ -107,22 +114,23 @@
* Input form for entering a category
*/
function executeInputForm() {
- global $wgScript, $wgOut;
+ global $wgScript;
$thisTitle = SpecialPage::getTitleFor( $this->getName() );
$mode = $this->getOption( 'mode' );
- $wgOut->addHTML( Xml::openElement( 'form', array( 'name' =>
'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' =>
'mw-categorytree-form' ) ) );
- $wgOut->addHTML( Xml::openElement( 'fieldset' ) );
- $wgOut->addHTML( Xml::element( 'legend', null, wfMsgNoTrans(
'categorytree-legend' ) ) );
- $wgOut->addHTML( Html::Hidden( 'title',
$thisTitle->getPrefixedDbKey() ) );
- $wgOut->addHTML( Xml::inputLabel( wfMsgNoTrans(
'categorytree-category' ), 'target', 'target', 20, $this->target ) . ' ' );
- $wgOut->addHTML( Xml::openElement( 'select', array( 'name' =>
'mode' ) ) );
- $wgOut->addHTML( Xml::option( wfMsgNoTrans(
'categorytree-mode-categories' ), 'categories', $mode == CT_MODE_CATEGORIES ?
true : false ) );
- $wgOut->addHTML( Xml::option( wfMsgNoTrans(
'categorytree-mode-pages' ), 'pages', $mode == CT_MODE_PAGES ? true : false ) );
- $wgOut->addHTML( Xml::option( wfMsgNoTrans(
'categorytree-mode-all' ), 'all', $mode == CT_MODE_ALL ? true : false ) );
- $wgOut->addHTML( Xml::closeElement( 'select' ) . ' ' );
- $wgOut->addHTML( Xml::submitButton( wfMsgNoTrans(
'categorytree-go' ), array( 'name' => 'dotree' ) ) );
- $wgOut->addHTML( Xml::closeElement( 'fieldset' ) );
- $wgOut->addHTML( Xml::closeElement( 'form' ) );
+ $output = $this->getOutput();
+ $output->addHTML( Xml::openElement( 'form', array( 'name' =>
'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' =>
'mw-categorytree-form' ) ) );
+ $output->addHTML( Xml::openElement( 'fieldset' ) );
+ $output->addHTML( Xml::element( 'legend', null, wfMsgNoTrans(
'categorytree-legend' ) ) );
+ $output->addHTML( Html::Hidden( 'title',
$thisTitle->getPrefixedDbKey() ) );
+ $output->addHTML( Xml::inputLabel( wfMsgNoTrans(
'categorytree-category' ), 'target', 'target', 20, $this->target ) . ' ' );
+ $output->addHTML( Xml::openElement( 'select', array( 'name' =>
'mode' ) ) );
+ $output->addHTML( Xml::option( wfMsgNoTrans(
'categorytree-mode-categories' ), 'categories', $mode == CT_MODE_CATEGORIES ) );
+ $output->addHTML( Xml::option( wfMsgNoTrans(
'categorytree-mode-pages' ), 'pages', $mode == CT_MODE_PAGES ) );
+ $output->addHTML( Xml::option( wfMsgNoTrans(
'categorytree-mode-all' ), 'all', $mode == CT_MODE_ALL ) );
+ $output->addHTML( Xml::closeElement( 'select' ) . ' ' );
+ $output->addHTML( Xml::submitButton( wfMsgNoTrans(
'categorytree-go' ), array( 'name' => 'dotree' ) ) );
+ $output->addHTML( Xml::closeElement( 'fieldset' ) );
+ $output->addHTML( Xml::closeElement( 'form' ) );
}
}
Modified:
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialCentralAuth.php
===================================================================
---
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialCentralAuth.php
2012-03-05 14:23:36 UTC (rev 113034)
+++
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialCentralAuth.php
2012-03-05 14:31:53 UTC (rev 113035)
@@ -706,7 +706,7 @@
foreach ( array( 'primary', 'new', 'empty', 'password', 'mail',
'admin', 'login' ) as $method ) {
$short = Xml::encodeJsVar(
$this->getLanguage()->ucfirst( wfMsgHtml( "centralauth-merge-method-{$method}"
) ) );
$desc = Xml::encodeJsVar( wfMsgWikiHtml(
"centralauth-merge-method-{$method}-desc" ) );
- $js .= "\t'{$method}' : { 'short' : {$short}, 'desc' :
{$desc} },\n";
+ $js .= "\t'{$method}' : { 'short' : {$short}, 'desc' :
{$desc} }\n";
}
$js .= "}";
$this->getOutput()->addInlineScript( $js );
Modified:
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
===================================================================
--- branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
2012-03-05 14:23:36 UTC (rev 113034)
+++ branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
2012-03-05 14:31:53 UTC (rev 113035)
@@ -131,13 +131,13 @@
} else {
$usage = wfMsgExt( 'centralauth-editset-nouse',
'parse' );
}
+ $sortedWikis = $set->getWikisRaw();
+ sort( $sortedWikis );
} else {
$usage = '';
+ $sortedWikis = array();
}
- $sortedWikis = $set->getWikisRaw();
- sort( $sortedWikis );
-
# Make an array of the opposite list of wikis
# (all databases *excluding* the defined ones)
$restWikis = array();
Property changes on:
branches/wmf/1.19wmf1/extensions/CentralAuth/specials/SpecialWikiSets.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/wmf/1.17wmf1/extensions/CentralAuth/SpecialWikiSets.php:81956
+ /branches/wmf/1.17wmf1/extensions/CentralAuth/SpecialWikiSets.php:81956
/trunk/extensions/CentralAuth/specials/SpecialWikiSets.php:112993
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs