mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Add phpcs and make pass
Change-Id: I52845fc95b53eca5149a947dfc6a1b39100da97b
This commit is contained in:
parent
713021e015
commit
8e4bff8976
|
@ -38,8 +38,9 @@ class ApiCategoryTree extends ApiBase {
|
||||||
} else {
|
} else {
|
||||||
$this->getMain()->setCacheMaxAge( $config->get( 'SquidMaxage' ) );
|
$this->getMain()->setCacheMaxAge( $config->get( 'SquidMaxage' ) );
|
||||||
}
|
}
|
||||||
$this->getRequest()->response()->header( 'Vary: Accept-Encoding, Cookie' ); # cache for anons only
|
// cache for anons only
|
||||||
# TODO: purge the squid cache when a category page is invalidated
|
$this->getRequest()->response()->header( 'Vary: Accept-Encoding, Cookie' );
|
||||||
|
// TODO: purge the squid cache when a category page is invalidated
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getResult()->addContentValue( $this->getModuleName(), 'html', $html );
|
$this->getResult()->addContentValue( $this->getModuleName(), 'html', $html );
|
||||||
|
|
|
@ -17,9 +17,10 @@ class CategoryTreeHooks {
|
||||||
*/
|
*/
|
||||||
public static function initialize() {
|
public static function initialize() {
|
||||||
global $wgUseAjax, $wgHooks, $wgRequest;
|
global $wgUseAjax, $wgHooks, $wgRequest;
|
||||||
global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode, $wgCategoryTreeOmitNamespace;
|
global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode, $wgCategoryTreeAllowTag;
|
||||||
global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode, $wgCategoryTreeAllowTag;
|
global $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeCategoryPageMode;
|
||||||
global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders, $wgCategoryTreeHijackPageCategories;
|
global $wgCategoryTreeSidebarRoot, $wgCategoryTreeForceHeaders;
|
||||||
|
global $wgCategoryTreeHijackPageCategories, $wgCategoryTreeOmitNamespace;
|
||||||
|
|
||||||
# Abort if AJAX is not enabled
|
# Abort if AJAX is not enabled
|
||||||
if ( !$wgUseAjax ) {
|
if ( !$wgUseAjax ) {
|
||||||
|
@ -29,7 +30,8 @@ class CategoryTreeHooks {
|
||||||
|
|
||||||
if ( $wgCategoryTreeSidebarRoot ) {
|
if ( $wgCategoryTreeSidebarRoot ) {
|
||||||
$wgCategoryTreeForceHeaders = true; # needed on every page anyway
|
$wgCategoryTreeForceHeaders = true; # needed on every page anyway
|
||||||
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'CategoryTreeHooks::skinTemplateOutputPageBeforeExec';
|
$wgHooks['SkinTemplateOutputPageBeforeExec'][] =
|
||||||
|
'CategoryTreeHooks::skinTemplateOutputPageBeforeExec';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $wgCategoryTreeHijackPageCategories ) {
|
if ( $wgCategoryTreeHijackPageCategories ) {
|
||||||
|
@ -42,16 +44,23 @@ class CategoryTreeHooks {
|
||||||
$wgHooks['ParserFirstCallInit'][] = 'CategoryTreeHooks::setHooks';
|
$wgHooks['ParserFirstCallInit'][] = 'CategoryTreeHooks::setHooks';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( $wgCategoryTreeDefaultOptions['mode'] ) || is_null( $wgCategoryTreeDefaultOptions['mode'] ) ) {
|
if ( !isset( $wgCategoryTreeDefaultOptions['mode'] )
|
||||||
|
|| is_null( $wgCategoryTreeDefaultOptions['mode'] )
|
||||||
|
) {
|
||||||
$wgCategoryTreeDefaultOptions['mode'] = $wgCategoryTreeDefaultMode;
|
$wgCategoryTreeDefaultOptions['mode'] = $wgCategoryTreeDefaultMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( $wgCategoryTreeDefaultOptions['hideprefix'] ) || is_null( $wgCategoryTreeDefaultOptions['hideprefix'] ) ) {
|
if ( !isset( $wgCategoryTreeDefaultOptions['hideprefix'] )
|
||||||
|
|| is_null( $wgCategoryTreeDefaultOptions['hideprefix'] )
|
||||||
|
) {
|
||||||
$wgCategoryTreeDefaultOptions['hideprefix'] = $wgCategoryTreeOmitNamespace;
|
$wgCategoryTreeDefaultOptions['hideprefix'] = $wgCategoryTreeOmitNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] ) || is_null( $wgCategoryTreeCategoryPageOptions['mode'] ) ) {
|
if ( !isset( $wgCategoryTreeCategoryPageOptions['mode'] )
|
||||||
$wgCategoryTreeCategoryPageOptions['mode'] = ( $mode = $wgRequest->getVal( 'mode' ) ) ? CategoryTree::decodeMode( $mode ) : $wgCategoryTreeCategoryPageMode;
|
|| is_null( $wgCategoryTreeCategoryPageOptions['mode'] )
|
||||||
|
) {
|
||||||
|
$wgCategoryTreeCategoryPageOptions['mode'] = ( $mode = $wgRequest->getVal( 'mode' ) )
|
||||||
|
? CategoryTree::decodeMode( $mode ) : $wgCategoryTreeCategoryPageMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $wgCategoryTreeForceHeaders ) {
|
if ( $wgCategoryTreeForceHeaders ) {
|
||||||
|
@ -68,8 +77,8 @@ class CategoryTreeHooks {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function setHooks( $parser ) {
|
public static function setHooks( $parser ) {
|
||||||
$parser->setHook( 'categorytree' , 'CategoryTreeHooks::parserHook' );
|
$parser->setHook( 'categorytree', 'CategoryTreeHooks::parserHook' );
|
||||||
$parser->setFunctionHook( 'categorytree' , 'CategoryTreeHooks::parserFunction' );
|
$parser->setFunctionHook( 'categorytree', 'CategoryTreeHooks::parserFunction' );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,9 +157,11 @@ class CategoryTreeHooks {
|
||||||
|
|
||||||
$attr = Sanitizer::validateTagAttributes( $argv, 'div' );
|
$attr = Sanitizer::validateTagAttributes( $argv, 'div' );
|
||||||
|
|
||||||
$hideroot = isset( $argv[ 'hideroot' ] ) ? CategoryTree::decodeBoolean( $argv[ 'hideroot' ] ) : null;
|
$hideroot = isset( $argv['hideroot'] )
|
||||||
$onlyroot = isset( $argv[ 'onlyroot' ] ) ? CategoryTree::decodeBoolean( $argv[ 'onlyroot' ] ) : null;
|
? CategoryTree::decodeBoolean( $argv['hideroot'] ) : null;
|
||||||
$depthArg = isset( $argv[ 'depth' ] ) ? (int)$argv[ 'depth' ] : null;
|
$onlyroot = isset( $argv['onlyroot'] )
|
||||||
|
? CategoryTree::decodeBoolean( $argv['onlyroot'] ) : null;
|
||||||
|
$depthArg = isset( $argv['depth'] ) ? (int)$argv['depth'] : null;
|
||||||
|
|
||||||
$depth = CategoryTree::capDepth( $ct->getOption( 'mode' ), $depthArg );
|
$depth = CategoryTree::capDepth( $ct->getOption( 'mode' ), $depthArg );
|
||||||
if ( $onlyroot ) {
|
if ( $onlyroot ) {
|
||||||
|
@ -230,7 +241,7 @@ class CategoryTreeHooks {
|
||||||
$pop = '</div>';
|
$pop = '</div>';
|
||||||
$sep = ' ';
|
$sep = ' ';
|
||||||
|
|
||||||
$result = $embed . implode ( "{$pop} {$sep} {$embed}" , $links ) . $pop;
|
$result = $embed . implode( "{$pop} {$sep} {$embed}", $links ) . $pop;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,8 @@ $magicWords['kw'] = [
|
||||||
|
|
||||||
/** Ladino (Ladino) */
|
/** Ladino (Ladino) */
|
||||||
$magicWords['lad'] = [
|
$magicWords['lad'] = [
|
||||||
'categorytree' => [ 0, 'árvoledekateggorías', 'árboldecategorías', 'arboldecategorias', 'categorytree' ],
|
'categorytree' => [ 0, 'árvoledekateggorías', 'árboldecategorías', 'arboldecategorias',
|
||||||
|
'categorytree' ],
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Malagasy (Malagasy) */
|
/** Malagasy (Malagasy) */
|
||||||
|
|
|
@ -15,7 +15,7 @@ if ( !function_exists( 'wfJsonI18nShimed9738563f370e2c' ) ) {
|
||||||
function wfJsonI18nShimed9738563f370e2c( $cache, $code, &$cachedData ) {
|
function wfJsonI18nShimed9738563f370e2c( $cache, $code, &$cachedData ) {
|
||||||
$codeSequence = array_merge( [ $code ], $cachedData['fallbackSequence'] );
|
$codeSequence = array_merge( [ $code ], $cachedData['fallbackSequence'] );
|
||||||
foreach ( $codeSequence as $csCode ) {
|
foreach ( $codeSequence as $csCode ) {
|
||||||
$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
|
$fileName = __DIR__ . "/i18n/$csCode.json";
|
||||||
if ( is_readable( $fileName ) ) {
|
if ( is_readable( $fileName ) ) {
|
||||||
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
||||||
foreach ( array_keys( $data ) as $key ) {
|
foreach ( array_keys( $data ) as $key ) {
|
||||||
|
|
|
@ -16,7 +16,8 @@ if ( function_exists( 'wfLoadExtension' ) ) {
|
||||||
// Keep i18n globals so mergeMessageFileList.php doesn't break
|
// Keep i18n globals so mergeMessageFileList.php doesn't break
|
||||||
$wgMessagesDirs['CategoryTree'] = __DIR__ . '/i18n';
|
$wgMessagesDirs['CategoryTree'] = __DIR__ . '/i18n';
|
||||||
/* wfWarn(
|
/* wfWarn(
|
||||||
'Deprecated PHP entry point used for CategoryTree extension. Please use wfLoadExtension instead, ' .
|
'Deprecated PHP entry point used for CategoryTree extension. ' .
|
||||||
|
'Please use wfLoadExtension instead, ' .
|
||||||
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
|
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
|
||||||
); */
|
); */
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,7 +19,8 @@ class CategoryTree {
|
||||||
function __construct( $options ) {
|
function __construct( $options ) {
|
||||||
global $wgCategoryTreeDefaultOptions;
|
global $wgCategoryTreeDefaultOptions;
|
||||||
|
|
||||||
# ensure default values and order of options. Order may become important, it may influence the cache key!
|
// ensure default values and order of options.
|
||||||
|
// Order may become important, it may influence the cache key!
|
||||||
foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
|
foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
|
||||||
if ( isset( $options[$option] ) && !is_null( $options[$option] ) ) {
|
if ( isset( $options[$option] ) && !is_null( $options[$option] ) ) {
|
||||||
$this->mOptions[$option] = $options[$option];
|
$this->mOptions[$option] = $options[$option];
|
||||||
|
@ -31,7 +32,8 @@ class CategoryTree {
|
||||||
$this->mOptions['mode'] = self::decodeMode( $this->mOptions['mode'] );
|
$this->mOptions['mode'] = self::decodeMode( $this->mOptions['mode'] );
|
||||||
|
|
||||||
if ( $this->mOptions['mode'] == CategoryTreeMode::PARENTS ) {
|
if ( $this->mOptions['mode'] == CategoryTreeMode::PARENTS ) {
|
||||||
$this->mOptions['namespaces'] = false; # namespace filter makes no sense with CategoryTreeMode::PARENTS
|
// namespace filter makes no sense with CategoryTreeMode::PARENTS
|
||||||
|
$this->mOptions['namespaces'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mOptions['hideprefix'] = self::decodeHidePrefix( $this->mOptions['hideprefix'] );
|
$this->mOptions['hideprefix'] = self::decodeHidePrefix( $this->mOptions['hideprefix'] );
|
||||||
|
@ -62,7 +64,7 @@ class CategoryTree {
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function isInverse( ) {
|
function isInverse() {
|
||||||
return $this->getOption( 'mode' ) == CategoryTreeMode::PARENTS;
|
return $this->getOption( 'mode' ) == CategoryTreeMode::PARENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,9 +171,13 @@ class CategoryTree {
|
||||||
return ( (int)$value > 0 );
|
return ( (int)$value > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) {
|
if ( $value == 'yes' || $value == 'y'
|
||||||
|
|| $value == 'true' || $value == 't' || $value == 'on'
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
} elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) {
|
} elseif ( $value == 'no' || $value == 'n'
|
||||||
|
|| $value == 'false' || $value == 'f' || $value == 'off'
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) {
|
} elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -202,9 +208,13 @@ class CategoryTree {
|
||||||
|
|
||||||
$value = trim( strtolower( $value ) );
|
$value = trim( strtolower( $value ) );
|
||||||
|
|
||||||
if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) {
|
if ( $value == 'yes' || $value == 'y'
|
||||||
|
|| $value == 'true' || $value == 't' || $value == 'on'
|
||||||
|
) {
|
||||||
return CategoryTreeHidePrefix::ALWAYS;
|
return CategoryTreeHidePrefix::ALWAYS;
|
||||||
} elseif ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) {
|
} elseif ( $value == 'no' || $value == 'n'
|
||||||
|
|| $value == 'false' || $value == 'f' || $value == 'off'
|
||||||
|
) {
|
||||||
return CategoryTreeHidePrefix::NEVER;
|
return CategoryTreeHidePrefix::NEVER;
|
||||||
} elseif ( $value == 'always' ) {
|
} elseif ( $value == 'always' ) {
|
||||||
return CategoryTreeHidePrefix::ALWAYS;
|
return CategoryTreeHidePrefix::ALWAYS;
|
||||||
|
@ -255,7 +265,9 @@ class CategoryTree {
|
||||||
$key = "";
|
$key = "";
|
||||||
|
|
||||||
foreach ( $this->mOptions as $k => $v ) {
|
foreach ( $this->mOptions as $k => $v ) {
|
||||||
if ( is_array( $v ) ) $v = implode( '|', $v );
|
if ( is_array( $v ) ) {
|
||||||
|
$v = implode( '|', $v );
|
||||||
|
}
|
||||||
$key .= $k . ':' . $v . ';';
|
$key .= $k . ':' . $v . ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +311,9 @@ class CategoryTree {
|
||||||
* @param $allowMissing bool
|
* @param $allowMissing bool
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
function getTag( $parser, $category, $hideroot = false, $attr, $depth = 1, $allowMissing = false ) {
|
function getTag( $parser, $category, $hideroot = false, $attr, $depth = 1,
|
||||||
|
$allowMissing = false
|
||||||
|
) {
|
||||||
global $wgCategoryTreeDisableCache;
|
global $wgCategoryTreeDisableCache;
|
||||||
|
|
||||||
$category = trim( $category );
|
$category = trim( $category );
|
||||||
|
@ -336,13 +350,13 @@ class CategoryTree {
|
||||||
if ( !$allowMissing && !$title->getArticleID() ) {
|
if ( !$allowMissing && !$title->getArticleID() ) {
|
||||||
$html .= Html::openElement( 'span', [ 'class' => 'CategoryTreeNotice' ] );
|
$html .= Html::openElement( 'span', [ 'class' => 'CategoryTreeNotice' ] );
|
||||||
if ( $parser ) {
|
if ( $parser ) {
|
||||||
$html .= $parser->recursiveTagParse( wfMessage( 'categorytree-not-found', $category )->plain() );
|
$html .= $parser->recursiveTagParse(
|
||||||
|
wfMessage( 'categorytree-not-found', $category )->plain() );
|
||||||
} else {
|
} else {
|
||||||
$html .= wfMessage( 'categorytree-not-found', $category )->parse();
|
$html .= wfMessage( 'categorytree-not-found', $category )->parse();
|
||||||
}
|
}
|
||||||
$html .= Html::closeElement( 'span' );
|
$html .= Html::closeElement( 'span' );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ( !$hideroot ) {
|
if ( !$hideroot ) {
|
||||||
$html .= $this->renderNode( $title, $depth, false );
|
$html .= $this->renderNode( $title, $depth, false );
|
||||||
} else {
|
} else {
|
||||||
|
@ -385,7 +399,9 @@ class CategoryTree {
|
||||||
$options = [ 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ];
|
$options = [ 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ];
|
||||||
|
|
||||||
if ( $inverse ) {
|
if ( $inverse ) {
|
||||||
$joins['categorylinks'] = [ 'RIGHT JOIN', [ 'cl_to = page_title', 'page_namespace' => NS_CATEGORY ] ];
|
$joins['categorylinks'] = [ 'RIGHT JOIN', [
|
||||||
|
'cl_to = page_title', 'page_namespace' => NS_CATEGORY
|
||||||
|
] ];
|
||||||
$where['cl_from'] = $title->getArticleID();
|
$where['cl_from'] = $title->getArticleID();
|
||||||
} else {
|
} else {
|
||||||
$joins['categorylinks'] = [ 'JOIN', 'cl_from = page_id' ];
|
$joins['categorylinks'] = [ 'JOIN', 'cl_from = page_id' ];
|
||||||
|
@ -394,7 +410,8 @@ class CategoryTree {
|
||||||
|
|
||||||
# namespace filter.
|
# namespace filter.
|
||||||
if ( $namespaces ) {
|
if ( $namespaces ) {
|
||||||
# NOTE: we assume that the $namespaces array contains only integers! decodeNamepsaces makes it so.
|
// NOTE: we assume that the $namespaces array contains only integers!
|
||||||
|
// decodeNamepsaces makes it so.
|
||||||
$where['page_namespace'] = $namespaces;
|
$where['page_namespace'] = $namespaces;
|
||||||
} elseif ( $mode != CategoryTreeMode::ALL ) {
|
} elseif ( $mode != CategoryTreeMode::ALL ) {
|
||||||
if ( $mode == CategoryTreeMode::PAGES ) {
|
if ( $mode == CategoryTreeMode::PAGES ) {
|
||||||
|
@ -410,8 +427,12 @@ class CategoryTree {
|
||||||
|
|
||||||
if ( $doCount ) {
|
if ( $doCount ) {
|
||||||
$tables = array_merge( $tables, [ 'category' ] );
|
$tables = array_merge( $tables, [ 'category' ] );
|
||||||
$fields = array_merge( $fields, [ 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ] );
|
$fields = array_merge( $fields, [
|
||||||
$joins['category'] = [ 'LEFT JOIN', [ 'cat_title = page_title', 'page_namespace' => NS_CATEGORY ] ];
|
'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files'
|
||||||
|
] );
|
||||||
|
$joins['category'] = [ 'LEFT JOIN', [
|
||||||
|
'cat_title = page_title', 'page_namespace' => NS_CATEGORY ]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins );
|
$res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins );
|
||||||
|
@ -509,7 +530,9 @@ class CategoryTree {
|
||||||
function renderNode( $title, $children = 0 ) {
|
function renderNode( $title, $children = 0 ) {
|
||||||
global $wgCategoryTreeUseCategoryTable;
|
global $wgCategoryTreeUseCategoryTable;
|
||||||
|
|
||||||
if ( $wgCategoryTreeUseCategoryTable && $title->getNamespace() == NS_CATEGORY && !$this->isInverse() ) {
|
if ( $wgCategoryTreeUseCategoryTable && $title->getNamespace() == NS_CATEGORY
|
||||||
|
&& !$this->isInverse()
|
||||||
|
) {
|
||||||
$cat = Category::newFromTitle( $title );
|
$cat = Category::newFromTitle( $title );
|
||||||
} else {
|
} else {
|
||||||
$cat = null;
|
$cat = null;
|
||||||
|
@ -544,8 +567,9 @@ class CategoryTree {
|
||||||
$hideprefix = true;
|
$hideprefix = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
# when showing only categories, omit namespace in label unless we explicitely defined the configuration setting
|
// when showing only categories, omit namespace in label unless we explicitely defined the
|
||||||
# patch contributed by Manuel Schneider <manuel.schneider@wikimedia.ch>, Bug 8011
|
// configuration setting
|
||||||
|
// patch contributed by Manuel Schneider <manuel.schneider@wikimedia.ch>, Bug 8011
|
||||||
if ( $hideprefix ) {
|
if ( $hideprefix ) {
|
||||||
$label = htmlspecialchars( $title->getText() );
|
$label = htmlspecialchars( $title->getText() );
|
||||||
} else {
|
} else {
|
||||||
|
@ -686,7 +710,7 @@ class CategoryTree {
|
||||||
|
|
||||||
$attr = [
|
$attr = [
|
||||||
'title' => $context->msg( 'categorytree-member-counts' )
|
'title' => $context->msg( 'categorytree-member-counts' )
|
||||||
->numParams( $subcatCount, $pages , $fileCount, $allCount, $countMode )->text(),
|
->numParams( $subcatCount, $pages, $fileCount, $allCount, $countMode )->text(),
|
||||||
'dir' => $context->getLanguage()->getDir() # numbers and commas get messed up in a mixed dir env
|
'dir' => $context->getLanguage()->getDir() # numbers and commas get messed up in a mixed dir env
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@ class CategoryTreePage extends SpecialPage {
|
||||||
* @param $par array Parameters passed to the page
|
* @param $par array Parameters passed to the page
|
||||||
*/
|
*/
|
||||||
function execute( $par ) {
|
function execute( $par ) {
|
||||||
global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions, $wgCategoryTreeForceHeaders;
|
global $wgCategoryTreeDefaultOptions, $wgCategoryTreeSpecialPageOptions,
|
||||||
|
$wgCategoryTreeForceHeaders;
|
||||||
|
|
||||||
$this->setHeaders();
|
$this->setHeaders();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
@ -114,11 +115,11 @@ class CategoryTreePage extends SpecialPage {
|
||||||
*/
|
*/
|
||||||
function executeInputForm() {
|
function executeInputForm() {
|
||||||
$namespaces = $this->getRequest()->getVal( 'namespaces', '' );
|
$namespaces = $this->getRequest()->getVal( 'namespaces', '' );
|
||||||
//mode may be overriden by namespaces option
|
// mode may be overriden by namespaces option
|
||||||
$mode = ( $namespaces == '' ? $this->getOption( 'mode' ) : CategoryTreeMode::ALL );
|
$mode = ( $namespaces == '' ? $this->getOption( 'mode' ) : CategoryTreeMode::ALL );
|
||||||
if ( $mode == CategoryTreeMode::CATEGORIES ) {
|
if ( $mode == CategoryTreeMode::CATEGORIES ) {
|
||||||
$modeDefault = 'categories';
|
$modeDefault = 'categories';
|
||||||
} elseif( $mode == CategoryTreeMode::PAGES ) {
|
} elseif ( $mode == CategoryTreeMode::PAGES ) {
|
||||||
$modeDefault = 'pages';
|
$modeDefault = 'pages';
|
||||||
} else {
|
} else {
|
||||||
$modeDefault = 'all';
|
$modeDefault = 'all';
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{
|
{
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"jakub-onderka/php-parallel-lint": "0.9.2",
|
"jakub-onderka/php-parallel-lint": "0.9.2",
|
||||||
"jakub-onderka/php-console-highlighter": "0.3.2"
|
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||||
|
"mediawiki/mediawiki-codesniffer": "0.7.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"fix": "phpcbf",
|
||||||
"test": [
|
"test": [
|
||||||
"parallel-lint . --exclude vendor"
|
"parallel-lint . --exclude vendor",
|
||||||
|
"phpcs -p -s"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
9
phpcs.xml
Normal file
9
phpcs.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset>
|
||||||
|
<rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
|
||||||
|
<file>.</file>
|
||||||
|
<arg name="extensions" value="php,php5,inc"/>
|
||||||
|
<arg name="encoding" value="UTF-8"/>
|
||||||
|
<exclude-pattern>vendor</exclude-pattern>
|
||||||
|
<exclude-pattern>node_modules</exclude-pattern>
|
||||||
|
</ruleset>
|
Loading…
Reference in a new issue