https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113037
Revision: 113037
Author: reedy
Date: 2012-03-05 14:59:51 +0000 (Mon, 05 Mar 2012)
Log Message:
-----------
MFT r110703, r110933, r111011, r111218, r112520, r112524, r112660, r112687,
r112751, r112770, r112771, r112775, r112849, r112851, r112856, r112859,
r112903, r112925, r112993
Modified Paths:
--------------
branches/REL1_19/extensions/CategoryTree/CategoryPageSubclass.php
branches/REL1_19/extensions/CategoryTree/CategoryTree.php
branches/REL1_19/extensions/CategoryTree/CategoryTreeFunctions.php
branches/REL1_19/extensions/CategoryTree/CategoryTreePage.php
branches/REL1_19/extensions/CategoryTree/modules/ext.categoryTree.js
branches/REL1_19/extensions/CentralAuth/CentralAuth.php
branches/REL1_19/extensions/CentralAuth/specials/SpecialCentralAuth.php
branches/REL1_19/extensions/CentralAuth/specials/SpecialWikiSets.php
branches/REL1_19/extensions/Collection/Collection.body.php
branches/REL1_19/extensions/GlobalUsage/GlobalUsage_body.php
branches/REL1_19/extensions/LiquidThreads/lqt.css
branches/REL1_19/extensions/MoodBar/ApiFeedbackDashboardResponse.php
branches/REL1_19/extensions/ProofreadPage/proofread.js
Property Changed:
----------------
branches/REL1_19/extensions/
branches/REL1_19/extensions/CategoryTree/CategoryTreeFunctions.php
branches/REL1_19/extensions/CentralAuth/specials/SpecialWikiSets.php
branches/REL1_19/extensions/LiquidThreads/
Property changes on: branches/REL1_19/extensions
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk/extensions:111199,111218,111484,111575,111685,111713,111715,112074,112153,112160,112295,112517,112562
+
/trunk/extensions:111011,111199,111218,111484,111575,111685,111713,111715,112074,112153,112160,112295,112517,112520,112524,112562,112660,112687,112751,112770-112771,112775,112849,112851,112856,112859,112903,112925,112993
Modified: branches/REL1_19/extensions/CategoryTree/CategoryPageSubclass.php
===================================================================
--- branches/REL1_19/extensions/CategoryTree/CategoryPageSubclass.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CategoryTree/CategoryPageSubclass.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -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/REL1_19/extensions/CategoryTree/CategoryTree.php
===================================================================
--- branches/REL1_19/extensions/CategoryTree/CategoryTree.php 2012-03-05
14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CategoryTree/CategoryTree.php 2012-03-05
14:59:51 UTC (rev 113037)
@@ -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/REL1_19/extensions/CategoryTree/CategoryTreeFunctions.php
===================================================================
--- branches/REL1_19/extensions/CategoryTree/CategoryTreeFunctions.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CategoryTree/CategoryTreeFunctions.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -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'];
+ }
}
/**
@@ -167,24 +239,16 @@
}
/**
- * @return Services_JSON
+ * @param $options
+ * @param $enc
+ * @return mixed
+ * @throws MWException
*/
- static function getJsonCodec() {
- static $json = null;
-
- if ( !$json ) {
- $json = new Services_JSON(); # recycle API's JSON codec
implementation
- }
-
- return $json;
- }
-
static function encodeOptions( $options, $enc ) {
if ( $enc == 'mode' || $enc == '' ) {
$opt = $options['mode'];
} elseif ( $enc == 'json' ) {
- $json = self::getJsonCodec(); // XXX: this may be a bit
heavy...
- $opt = $json->encode( $options );
+ $opt = FormatJson::encode( $options );
} else {
throw new MWException( 'Unknown encoding for
CategoryTree options: ' . $enc );
}
@@ -192,12 +256,17 @@
return $opt;
}
+ /**
+ * @param $options
+ * @param $enc
+ * @return array|mixed
+ * @throws MWException
+ */
static function decodeOptions( $options, $enc ) {
if ( $enc == 'mode' || $enc == '' ) {
$opt = array( "mode" => $options );
} elseif ( $enc == 'json' ) {
- $json = self::getJsonCodec(); // XXX: this may be a bit
heavy...
- $opt = $json->decode( $options );
+ $opt = FormatJson::decode( $options );
$opt = get_object_vars( $opt );
} else {
throw new MWException( 'Unknown encoding for
CategoryTree options: ' . $enc );
@@ -206,6 +275,10 @@
return $opt;
}
+ /**
+ * @param $depth null
+ * @return string
+ */
function getOptionsAsCacheKey( $depth = null ) {
$key = "";
@@ -214,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;
@@ -230,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 = '';
@@ -246,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 );
@@ -266,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();
@@ -330,19 +424,19 @@
}
$attr['data-ct-mode'] = $this->mOptions['mode'];
- $attr['data-ct-options'] = Xml::escapeTagsOnly(
$this->getOptionsAsJsStructure() );
+ $attr['data-ct-options'] = $this->getOptionsAsJsStructure();
$html = '';
- $html .= Xml::openElement( 'div', $attr );
+ $html .= Html::openElement( 'div', $attr );
if ( !$allowMissing && !$title->getArticleID() ) {
- $html .= Xml::openElement( 'span', array( 'class' =>
'CategoryTreeNotice' ) );
+ $html .= Html::openElement( 'span', array( 'class' =>
'CategoryTreeNotice' ) );
if ( $parser ) {
$html .= $parser->recursiveTagParse(
wfMsgNoTrans( 'categorytree-not-found', $category ) );
} else {
$html .= wfMsgExt( 'categorytree-not-found',
'parseinline', htmlspecialchars( $category ) );
}
- $html .= Xml::closeElement( 'span' );
+ $html .= Html::closeElement( 'span' );
}
else {
if ( !$hideroot ) {
@@ -368,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;
@@ -459,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;
@@ -513,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;
@@ -529,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;
@@ -739,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/REL1_19/extensions/CategoryTree/CategoryTreeFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
-
/branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php:67183
+
/branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php:67183
/trunk/extensions/CategoryTree/CategoryTreeFunctions.php:111011,111218,112520,112524,112660,112687,112751,112770-112771,112775,112849,112851,112856,112859,112903,112925,112993
Modified: branches/REL1_19/extensions/CategoryTree/CategoryTreePage.php
===================================================================
--- branches/REL1_19/extensions/CategoryTree/CategoryTreePage.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CategoryTree/CategoryTreePage.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -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/REL1_19/extensions/CategoryTree/modules/ext.categoryTree.js
===================================================================
--- branches/REL1_19/extensions/CategoryTree/modules/ext.categoryTree.js
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CategoryTree/modules/ext.categoryTree.js
2012-03-05 14:59:51 UTC (rev 113037)
@@ -27,7 +27,7 @@
*/
handleNode: function( e ) {
var $link = $( this );
- if ( $link.data( 'ctState' ) === 'collapsed' ) {
+ if ( $link.data( 'ct-state' ) === 'collapsed' ) {
categoryTree.expandNode( $link );
} else {
categoryTree.collapseNode( $link );
@@ -48,9 +48,9 @@
$link
.html( mw.msg( 'categorytree-collapse-bullet' ) )
.attr( 'title', mw.msg( 'categorytree-collapse' ) )
- .data( 'ctState', 'expanded' );
+ .data( 'ct-state', 'expanded' );
- if ( !$link.data( 'ctLoaded' ) ) {
+ if ( !$link.data( 'ct-loaded' ) ) {
categoryTree.loadChildren( $link, $children );
}
},
@@ -68,7 +68,7 @@
$link
.html( mw.msg( 'categorytree-expand-bullet' ) )
.attr( 'title', mw.msg( 'categorytree-expand' ) )
- .data( 'ctState', 'collapsed' );
+ .data( 'ct-state', 'collapsed' );
},
/**
@@ -78,26 +78,55 @@
* @param {jQuery} $children
*/
loadChildren: function( $link, $children ) {
- $link.data( 'ctLoaded', true );
+ var $linkParentCTTag, ctTitle, ctMode, ctOptions;
+
+ /**
+ * Error callback
+ */
+ function error() {
+ var $retryLink;
+
+ $retryLink = $( '<a>' )
+ .text( mw.msg( 'categorytree-retry' ) )
+ .attr( 'href', '#' )
+ .click( function ( e ) {
+ e.preventDefault();
+ categoryTree.loadChildren( $link,
$children );
+ } );
+
+ $children
+ .text( mw.msg( 'categorytree-error' ) + ' ' )
+ .append( $retryLink );
+ }
+
+ $link.data( 'ct-loaded', true );
+
$children.html(
$( '<i class="CategoryTreeNotice"></i>' )
.text( mw.msg( 'categorytree-loading' ) )
);
- var $parentTag = $link.parents( '.CategoryTreeTag' );
+ $linkParentCTTag = $link.parents( '.CategoryTreeTag' );
- if ( $parentTag.length === 0 ) {
- // Probably a CategoryPage
- $parentTag = $( '<div />' )
- .hide()
- .data( 'ctOptions', mw.config.get(
'wgCategoryTreePageCategoryOptions' ) );
+ // Element may not have a .CategoryTreeTag parent, fallback to
defauls
+ // Probably a CategoryPage (@todo: based on what?)
+ ctTitle = $link.data( 'ct-title' );
+ ctMode = $linkParentCTTag.data( 'ct-mode' );
+ ctMode = typeof ctMode === 'number' ? ctMode : undefined;
+ ctOptions = $linkParentCTTag.data( 'ct-options' ) ||
mw.config.get( 'wgCategoryTreePageCategoryOptions' );
+
+ // Mode and options have defaults or fallbacks, title does not.
+ // Don't make a request if there is no title.
+ if ( typeof ctTitle !== 'string' ) {
+ error();
+ return;
}
$.get(
mw.util.wikiScript(), {
action: 'ajax',
rs: 'efCategoryTreeAjaxWrapper',
- rsargs: [$link.data( 'ctTitle' ),
$parentTag.data( 'ctOptions' ), 'json'] // becomes
&rsargs[]=arg1&rsargs[]=arg2...
+ rsargs: [ctTitle, ctOptions, 'json'] // becomes
&rsargs[]=arg1&rsargs[]=arg2...
}
)
.success( function ( data ) {
@@ -105,16 +134,20 @@
data = data.replace(/##LOAD##/g, mw.msg(
'categorytree-expand' ) );
if ( data === '' ) {
- switch ( $parentTag.data( 'ctMode' ) ) {
+ switch ( ctMode ) {
+ // CT_MODE_CATEGORIES = 0
case 0:
data = mw.msg(
'categorytree-no-subcategories' );
break;
+ // CT_MODE_PAGES = 10
case 10:
data = mw.msg(
'categorytree-no-pages' );
break;
+ // CT_MODE_PARENTS = 100
case 100:
data = mw.msg(
'categorytree-no-parent-categories' );
break;
+ // CT_MODE_ALL = 20
default:
data = mw.msg(
'categorytree-nothing-found' );
}
@@ -126,17 +159,10 @@
.html( data )
.find( '.CategoryTreeToggle' )
.click( categoryTree.handleNode
);
+
categoryTree.showToggles();
} )
- .error( function() {
- var $retryLink = $( '<a />' )
- .text( mw.msg( 'categorytree-retry' ) )
- .attr( 'href', '#' )
- .click( function() {
categoryTree.loadChildren( $link, $children ); } );
- $children
- .text( mw.msg( 'categorytree-error' ) )
- .append( $retryLink );
- } );
+ .error( error );
}
};
Modified: branches/REL1_19/extensions/CentralAuth/CentralAuth.php
===================================================================
--- branches/REL1_19/extensions/CentralAuth/CentralAuth.php 2012-03-05
14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CentralAuth/CentralAuth.php 2012-03-05
14:59:51 UTC (rev 113037)
@@ -281,7 +281,6 @@
$wgAutoloadClasses['CentralAuthAntiSpoofHooks'] =
"$caBase/AntiSpoof/CentralAuthAntiSpoofHooks.php";
$wgHooks['AbortNewAccount'][] =
'CentralAuthAntiSpoofHooks::asAbortNewAccountHook';
- $wgHooks['UserCreateForm'][] =
'CentralAuthAntiSpoofHooks::asUserCreateFormHook';
$wgHooks['AddNewAccount'][] =
'CentralAuthAntiSpoofHooks::asAddNewAccountHook';
$wgHooks['RenameUserComplete'][] =
'CentralAuthAntiSpoofHooks::asAddRenameUserHook';
}
Modified:
branches/REL1_19/extensions/CentralAuth/specials/SpecialCentralAuth.php
===================================================================
--- branches/REL1_19/extensions/CentralAuth/specials/SpecialCentralAuth.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CentralAuth/specials/SpecialCentralAuth.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -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/REL1_19/extensions/CentralAuth/specials/SpecialWikiSets.php
===================================================================
--- branches/REL1_19/extensions/CentralAuth/specials/SpecialWikiSets.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/CentralAuth/specials/SpecialWikiSets.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -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/REL1_19/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
Modified: branches/REL1_19/extensions/Collection/Collection.body.php
===================================================================
--- branches/REL1_19/extensions/Collection/Collection.body.php 2012-03-05
14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/Collection/Collection.body.php 2012-03-05
14:59:51 UTC (rev 113037)
@@ -810,7 +810,7 @@
* @return bool
*/
function saveCollection( $title, $forceOverwrite = false ) {
- global $wgUser;
+ global $wgRequest, $wgUser;
$article = new Article( $title );
if ( $article->exists() && !$forceOverwrite ) {
@@ -857,12 +857,14 @@
}
}
- $req = new FauxRequest( array(
- 'action' => 'edit',
- 'title' => $title->getPrefixedText(),
- 'text' => $articleText,
- 'token' => $wgUser->editToken(),
- ), true, $_SESSION );
+ $req = new DerivativeRequest(
+ $wgRequest,
+ array(
+ 'action' => 'edit',
+ 'title' => $title->getPrefixedText(),
+ 'text' => $articleText,
+ 'token' => $wgUser->editToken(),
+ ), true);
$api = new ApiMain( $req, true );
$api->execute();
return true;
Modified: branches/REL1_19/extensions/GlobalUsage/GlobalUsage_body.php
===================================================================
--- branches/REL1_19/extensions/GlobalUsage/GlobalUsage_body.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/GlobalUsage/GlobalUsage_body.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -2,6 +2,10 @@
class GlobalUsage {
private $interwiki;
+
+ /**
+ * @var DatabaseBase
+ */
private $db;
/**
@@ -127,7 +131,7 @@
array(
'gil_page_namespace_id' =>
$title->getNamespace(),
'gil_page_namespace' =>
$title->getNsText(),
- 'gil_page_title' => $title->getText()
+ 'gil_page_title' => $title->getDBkey()
),
array(
'gil_wiki' => $this->interwiki,
Property changes on: branches/REL1_19/extensions/LiquidThreads
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/extensions/LiquidThreads:57390
+
/trunk/extensions/LiquidThreads:57390,112660,112687,112751,112770-112771,112775,112849,112851,112856,112859,112903,112925,112993
Modified: branches/REL1_19/extensions/LiquidThreads/lqt.css
===================================================================
--- branches/REL1_19/extensions/LiquidThreads/lqt.css 2012-03-05 14:43:13 UTC
(rev 113036)
+++ branches/REL1_19/extensions/LiquidThreads/lqt.css 2012-03-05 14:59:51 UTC
(rev 113037)
@@ -222,7 +222,6 @@
.lqt-command-icon {
height: 1.25em;
- line-height: 1.25em;
background-position: center left;
background-repeat: no-repeat;
display: inline;
Modified: branches/REL1_19/extensions/MoodBar/ApiFeedbackDashboardResponse.php
===================================================================
--- branches/REL1_19/extensions/MoodBar/ApiFeedbackDashboardResponse.php
2012-03-05 14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/MoodBar/ApiFeedbackDashboardResponse.php
2012-03-05 14:59:51 UTC (rev 113037)
@@ -47,18 +47,21 @@
$this->disableUserTalkEmailNotification();
$id = intval( $item->getProperty( 'id' ) );
- $api = new ApiMain( new FauxRequest( array(
- 'action' => 'edit',
- 'title' => $talkPage->getFullText(),
- 'appendtext' => ( $talkPage->exists() ? "\n\n"
: '' ) .
- $feedback_link . "\n" .
- '<span
id="feedback-dashboard-response-' . $id . '"></span>' . "\n\n" .
- $response . "\n\n~~~~\n\n" .
- '<span
class="markashelpful-mbresponse-' . $id . '"> </span>',
- 'token' => $params['token'],
- 'summary' => $summary,
- 'notminor' => true,
- ), true, array( 'wsEditToken' =>
$wgRequest->getSessionData( 'wsEditToken' ) ) ), true );
+ $api = new ApiMain( new DerivativeRequest(
+ $wgRequest,
+ array(
+ 'action' => 'edit',
+ 'title' => $talkPage->getFullText(),
+ 'appendtext' => ( $talkPage->exists() ?
"\n\n" : '' ) .
+ $feedback_link . "\n" .
+ '<span
id="feedback-dashboard-response-' . $id . '"></span>' . "\n\n" .
+ $response .
"\n\n~~~~\n\n" .
+ '<span
class="markashelpful-mbresponse-' . $id . '"> </span>',
+ 'token' => $params['token'],
+ 'summary' => $summary,
+ 'notminor' => true,
+ ), true),
+ true );
$api->execute();
Modified: branches/REL1_19/extensions/ProofreadPage/proofread.js
===================================================================
--- branches/REL1_19/extensions/ProofreadPage/proofread.js 2012-03-05
14:43:13 UTC (rev 113036)
+++ branches/REL1_19/extensions/ProofreadPage/proofread.js 2012-03-05
14:59:51 UTC (rev 113037)
@@ -749,18 +749,18 @@
return;
}
var f = text.parentNode;
- var new_text = f.removeChild( text );
if( proofreadPageIsEdit ) {
- pr_make_edit_area( self.text_container, new_text.value );
- var copywarn = document.getElementById( 'editpage-copywarn' );
- f.insertBefore( table, copywarn );
+ pr_make_edit_area( self.text_container, text.value );
+ f.insertBefore( table, text.nextSibling ); // Inserts table
after text
+ f.removeChild( text );
if ( !self.proofreadpage_show_headers ) {
hookEvent( 'load', pr_toggle_visibility );
} else {
hookEvent( 'load', pr_reset_size );
}
} else {
+ var new_text = f.removeChild( text );
self.text_container.appendChild( new_text );
f.appendChild( self.table );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs