id
int64
0
1.29M
original_id
stringlengths
32
32
swhid
stringlengths
100
170
sha1
stringlengths
40
40
repo_name
stringlengths
2
45
repo_group
stringclasses
12 values
filepath
stringlengths
5
153
name
stringlengths
1
14.9k
type
stringclasses
3 values
code
stringlengths
7
2.12M
17,400
d87f355a28e1fc17973714e7cbef3e49
swh:1:cnt:1a4e0583b7a541679558726306a0e58e2ef724d3;origin=https://gitlab.wikimedia.org/repos/data-engineering/metrics-platform.git;lines=8-13/
20a6f94d4c841cf5d7b1bf37c29169c9658ca098
metrics-platform
analytics
tests/consistency/php/StreamConfigFactory.php
StreamConfigFactory::__construct( $filename )
function
public function __construct( $filename ) { $rawContents = file_get_contents( $filename ); $contents = json_decode( $rawContents, true ); parent::__construct( $contents["streams"] ); }
17,401
a02acb7c2c4a02da7ede73ff77956058
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=9-139/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert
type
class CharInsert { /** @var array XML-style attributes passed to the tag */ private $params; /** @var Parser */ private $parser; /** * Main entry point, called by the parser. * @param string|null $data The textual content of the <charinsert> tag * @param array $params XML-style attributes of the <charinsert...
17,402
b88847919f61f729e63bcdb6cc1308b3
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=15-28/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::charInsertHook( $data, array $params, Parser $parser )
function
/** * Main entry point, called by the parser. * @param string|null $data The textual content of the <charinsert> tag * @param array $params XML-style attributes of the <charinsert> tag * @param Parser $parser * @return string */ public static function charInsertHook( $data, array $params, Parser $parser ):...
17,403
7648ec4729208139679f8ebded84d186
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=65-84/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::armor( string $data )
function
/** * Escape literal whitespace characters in <nowiki> tags. Whitespace * within <nowiki> tags is not considered to be an insert boundary. * @param string $data Textual content of the line to escape whitespace in * @return string The textual content with whitespace escaped and <nowiki> * tags removed */ p...
17,404
bf1120dfd55067781d0c62784d1ae9a1
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=40-52/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::expand( $data )
function
/** * Parse the content of a whole <charinsert> tag. * @param string $data The textual content of the <charinsert> tag * @return string HTML to be inserted in the parser output */ private function expand( $data ): string { $data = $this->parser->getStripState()->unstripBoth( $data ); $this->parser->getOutp...
17,405
b3b7542d108887f740a9e67a30d90e4b
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=54-63/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::processLine( string $data )
function
/** * Parse a single line in the <charinsert> tag. * @param string $data Textual content of the line * @return string HTML to be inserted in the parser output */ private function processLine( string $data ): string { return implode( "\n", array_map( [ $this, 'processItem' ], preg_split( '/\s+/', $this...
17,406
11cfb4a7e43b7ca71de619228fc46cf0
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=30-38/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::__construct( array $params, Parser $parser )
function
/** * Constructor. * @param array $params XML-style attributes of the <charinsert> tag * @param Parser $parser */ private function __construct( array $params, Parser $parser ) { $this->params = $params; $this->parser = $parser; }
17,407
ee5e49c7f09cf3ca16a5132c80657520
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=86-101/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::processItem( string $data )
function
/** * Parse a single insert, i.e. largest portion of the input that * (after going through armor()) doesn’t contain ASCII whitespace. * @param string $data The single insert. * @return string HTML to be inserted in the parser output */ private function processItem( string $data ): string { $chars = explode...
17,408
3e7c81b343286f1fdb84b08fd30e1e48
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=103-125/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::insertChar( string $start, string $end = '' )
function
/** * Create the HTML for a single insert. * @param string $start The start part of the insert, inserted before * the text selected by the user (if there is any). * @param string $end The end part of the insert, inserted after * the text selected by the user (if there is any). * @return string HTML to be ...
17,409
c85c7b70042e7c4df002f40aa4c18cfc
swh:1:cnt:810da1ab0933258ac09dab8b487989434b5539d9;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=127-138/
54f7e1b74f06e3d7e9363568325cbc13d501c489
CharInsert
deployed
includes/CharInsert.php
CharInsert::getInsertAttribute( string $text )
function
/** * Double-escape non-breaking spaces. This allows the user to * differentiate the user normal and non-breaking spaces. * @param string $text The text to double-escape NBSPs in * @return string */ private function getInsertAttribute( string $text ): string { static $invisibles = [ '&nbsp;', '&#160;' ]; ...
17,410
116a5cb3a76e6680def08a337873ffd2
swh:1:cnt:9a2d919354a558c564d893d6d6746dbb0fdda39c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=8-26/
5ef5b04e0ccf54216b0ae767158ab51279ccd3db
CharInsert
deployed
includes/Hooks.php
Hooks
type
class Hooks implements BeforePageDisplayHook, ParserFirstCallInitHook { /** @inheritDoc */ public function onBeforePageDisplay( $out, $skin ): void { if ( $out->getTitle()->isSpecial( 'Upload' ) || in_array( $out->getActionName(), [ 'edit', 'submit' ] ) ) { $out->addModules( 'ext.charinsert' ); $out->a...
17,411
cc10f9d187abc41781593bdcacc26c88
swh:1:cnt:9a2d919354a558c564d893d6d6746dbb0fdda39c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=12-20/
5ef5b04e0ccf54216b0ae767158ab51279ccd3db
CharInsert
deployed
includes/Hooks.php
Hooks::onBeforePageDisplay( $out, $skin )
function
/** @inheritDoc */ public function onBeforePageDisplay( $out, $skin ): void { if ( $out->getTitle()->isSpecial( 'Upload' ) || in_array( $out->getActionName(), [ 'edit', 'submit' ] ) ) { $out->addModules( 'ext.charinsert' ); $out->addModuleStyles( 'ext.charinsert.styles' ); } }
17,412
54ff00d0735cc9e8aeced0691a067eff
swh:1:cnt:9a2d919354a558c564d893d6d6746dbb0fdda39c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=22-25/
5ef5b04e0ccf54216b0ae767158ab51279ccd3db
CharInsert
deployed
includes/Hooks.php
Hooks::onParserFirstCallInit( $parser )
function
/** @inheritDoc */ public function onParserFirstCallInit( $parser ) { $parser->setHook( 'charinsert', [ CharInsert::class, 'charInsertHook' ] ); }
17,413
ab04461a704277bafd5a023ca571e54b
swh:1:cnt:c55a5ec079727fd183138aec39619c56bb19bb3f;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CharInsert.git;lines=3-24/
16f5ce16d48930182dd780f9f6b90b2099ec8988
CharInsert
deployed
modules/ext.charinsert.js
addClickHandlers
function
function addClickHandlers( $content ) { $content.find( 'a.mw-charinsert-item' ).each( function () { const $item = $( this ); if ( $item.data( 'mw-charinsert-done' ) ) { return; } $item.on( 'click', ( e ) => { e.preventDefault(); if ( $currentFocused.length ) { $currentFocused.textSelectio...
17,414
fffcc3dacd96c0aa34386b77205e712e
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=32-168/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree
type
class ApiCategoryTree extends ApiBase { public function __construct( ApiMain $main, string $action, private readonly CategoryTreeFactory $categoryTreeFactory, private readonly IConnectionProvider $dbProvider, private readonly LanguageConverterFactory $languageConverterFactory, private readonly WANObjectCac...
17,415
13b62c822a852c02f1508880865ba536
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=33-42/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::__construct( ApiMain $main, string $action, private readonly CategoryTreeFactory $categoryTreeFactory, private readonly IConnectionProvider $dbProvider, private readonly LanguageConverterFactory $languageConverterFactory, private readonly WANObjectCache $wanCache, )
function
public function __construct( ApiMain $main, string $action, private readonly CategoryTreeFactory $categoryTreeFactory, private readonly IConnectionProvider $dbProvider, private readonly LanguageConverterFactory $languageConverterFactory, private readonly WANObjectCache $wanCache, ) { parent::__construct(...
17,416
c0dbfbc340f7df7bac0b9f48b5f43199
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=97-113/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::getConditionalRequestData( $condition )
function
/** @inheritDoc */ public function getConditionalRequestData( $condition ) { if ( $condition === 'last-modified' ) { $params = $this->extractRequestParams(); $title = CategoryTree::makeTitle( $params['category'] ); return $this->dbProvider->getReplicaDatabase()->newSelectQueryBuilder() ->select( 'page_t...
17,417
eb584e121420c9dfaadd8286c43ab6bb
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=115-145/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::getHTML( CategoryTree $ct, Title $title, int $depth )
function
/** * Get category tree HTML for the given tree, title and depth * * @param CategoryTree $ct * @param Title $title * @param int $depth * @return string HTML */ private function getHTML( CategoryTree $ct, Title $title, int $depth ): string { $langConv = $this->languageConverterFactory->getLanguageConver...
17,418
6e33cd252995913d93043764c0857469
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=68-95/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::extractOptions( array $params )
function
/** * @param array $params * @return string[] */ private function extractOptions( array $params ): array { if ( !isset( $params['options'] ) ) { return []; } $options = FormatJson::decode( $params['options'] ); if ( !is_object( $options ) ) { $this->dieWithError( 'apierror-categorytree-invalidjson...
17,419
0c7e801f7adedcb591fd511c05f297c5
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=44-66/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::execute()
function
/** * @inheritDoc */ public function execute(): void { $params = $this->extractRequestParams(); $options = $this->extractOptions( $params ); $title = CategoryTree::makeTitle( $params['category'] ); if ( !$title || $title->isExternal() ) { $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiTex...
17,420
7848171a7734bbdf9d68b41e57f53213
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=147-160/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::getAllowedParams()
function
/** * @inheritDoc */ public function getAllowedParams(): array { return [ 'category' => [ ParamValidator::PARAM_TYPE => 'string', ParamValidator::PARAM_REQUIRED => true, ], 'options' => [ ParamValidator::PARAM_TYPE => 'string', ], ]; }
17,421
2d23269e95e6c6e56809fb84be2efdd3
swh:1:cnt:389cb0a13e23196a3f6fed19a9646d0fc2f988fc;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=162-167/
f03f3901e94a2175532bd9ef24a76bd404280129
CategoryTree
deployed
includes/ApiCategoryTree.php
ApiCategoryTree::isInternal()
function
/** * @inheritDoc */ public function isInternal(): bool { return true; }
17,422
9954c5921c0716a18a7bb3228112c544
swh:1:cnt:12e6bb6803ca4357ea8af5a89fe5ca3ab37c4c52;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=28-98/
b0b0d60fd5681020119d6cb38d3beec5bab3b3f4
CategoryTree
deployed
includes/CategoryCache.php
CategoryCache
type
/** * Caches Category::class objects */ class CategoryCache { /** @var array<string,?Category> Keys are category database names, values are either a Category object or null */ private array $cache = []; public function __construct( private readonly IConnectionProvider $dbProvider, ) { } /** * Get a preloa...
17,423
45af4be9c3f54c079e27eb0a70cbc9ae
swh:1:cnt:12e6bb6803ca4357ea8af5a89fe5ca3ab37c4c52;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=35-38/
b0b0d60fd5681020119d6cb38d3beec5bab3b3f4
CategoryTree
deployed
includes/CategoryCache.php
CategoryCache::__construct( private readonly IConnectionProvider $dbProvider, )
function
public function __construct( private readonly IConnectionProvider $dbProvider, ) { }
17,424
05734efaf198c8d68b96cad83d6b6c6a
swh:1:cnt:12e6bb6803ca4357ea8af5a89fe5ca3ab37c4c52;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=57-87/
b0b0d60fd5681020119d6cb38d3beec5bab3b3f4
CategoryTree
deployed
includes/CategoryCache.php
CategoryCache::doQuery( array $linkTargets )
function
/** * Preloads category counts in this cache * @param LinkTarget[] $linkTargets */ public function doQuery( array $linkTargets ): void { $categoryDbKeys = []; foreach ( $linkTargets as $linkTarget ) { if ( $linkTarget->getNamespace() !== NS_CATEGORY ) { continue; } $categoryDbKey = $linkTarget->...
17,425
276147cd43370a3d1f7ccb0bae6a8da7
swh:1:cnt:12e6bb6803ca4357ea8af5a89fe5ca3ab37c4c52;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=40-55/
b0b0d60fd5681020119d6cb38d3beec5bab3b3f4
CategoryTree
deployed
includes/CategoryCache.php
CategoryCache::getCategory( LinkTarget $categoryTarget )
function
/** * Get a preloaded Category object or null when the Category does not exists. Loaded the Category on demand, * if not in cache, use self::doQuery when requesting a high number of category */ public function getCategory( LinkTarget $categoryTarget ): ?Category { if ( $categoryTarget->getNamespace() !== NS_CA...
17,426
fb258ba76c5c4f877dc4f80624f42d07
swh:1:cnt:12e6bb6803ca4357ea8af5a89fe5ca3ab37c4c52;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=89-96/
b0b0d60fd5681020119d6cb38d3beec5bab3b3f4
CategoryTree
deployed
includes/CategoryCache.php
CategoryCache::fillFromQuery( IResultWrapper $rows )
function
public function fillFromQuery( IResultWrapper $rows ): void { foreach ( $rows as $row ) { $category = Category::newFromRow( $row ); if ( $category ) { $this->cache[$row->cat_title] = $category; } } }
17,427
4c84af47855c86c88fd22abcd931041e
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=43-502/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree
type
/** * Core functions for the CategoryTree extension, which displays the category structure of a wiki */ class CategoryTree { public readonly OptionManager $optionManager; public function __construct( array $options, private readonly Config $config, private readonly Language $contLang, private readonly ICon...
17,428
9c4145df47a2a46a43d7a4bdcf5769db
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=49-58/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::__construct( array $options, private readonly Config $config, private readonly Language $contLang, private readonly IConnectionProvider $dbProvider, private readonly LinkBatchFactory $linkBatchFactory, private readonly LinkRenderer $linkRenderer, )
function
public function __construct( array $options, private readonly Config $config, private readonly Language $contLang, private readonly IConnectionProvider $dbProvider, private readonly LinkBatchFactory $linkBatchFactory, private readonly LinkRenderer $linkRenderer, ) { $this->optionManager = new OptionManag...
17,429
92112cf7e7911ccd998005f90f9cee7b
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=69-109/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::getTag( string $category, bool $hideroot = false, array $attr = [], int $depth = 1 )
function
/** * Custom tag implementation. This is called by Hooks::parserHook, which is used to * load CategoryTree on demand. * @param string $category * @param bool $hideroot * @param array $attr * @param int $depth * @return string */ public function getTag( string $category, bool $hideroot = false, array $a...
17,430
bc4049360696dbbf9f4435363f859f6b
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=60-67/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::setHeaders( OutputPage $outputPage )
function
/** * Add ResourceLoader modules to the OutputPage object */ public static function setHeaders( OutputPage $outputPage ): void { # Add the modules $outputPage->addModuleStyles( 'ext.categoryTree.styles' ); $outputPage->addModules( 'ext.categoryTree' ); }
17,431
10335dc446f7ba88ae060cc1cb653214
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=262-297/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::renderParents( Title $title )
function
/** * Returns a string with an HTML representation of the parents of the given category. */ public function renderParents( Title $title ): string { $dbr = $this->dbProvider->getReplicaDatabase( CategoryLinksTable::VIRTUAL_DOMAIN ); $res = $dbr->newSelectQueryBuilder() ->select( [ 'lt_title' ] ) ->from( ...
17,432
e57db1c141c281034f9c790807b7a410
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=111-260/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::renderChildren( Title $title, int $depth = 1 )
function
/** * Returns a string with an HTML representation of the children of the given category. * @suppress PhanUndeclaredClassMethod,PhanUndeclaredClassInstanceof */ public function renderChildren( Title $title, int $depth = 1 ): string { if ( !$title->inNamespace( NS_CATEGORY ) ) { // Non-categories can't have ...
17,433
6054155dd19b04ac3c494ce9601dc61a
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=299-316/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::renderNode( Title $title, int $children = 0 )
function
/** * Returns a string with a HTML represenation of the given page. * @param Title $title * @param int $children * @return string */ public function renderNode( Title $title, int $children = 0 ): string { if ( $this->config->get( 'CategoryTreeUseCategoryTable' ) && $title->inNamespace( NS_CATEGORY ) ...
17,434
0c8b79e175bf842ad2859aec0019a962
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=318-432/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::renderNodeInfo( Title $title, ?Category $cat = null, int $children = 0 )
function
/** * 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. */ public function renderNodeInfo( Title $title, ?Category $cat = null, int $children = 0 ): string { $mode = $this->optionManager->getOption( 'mod...
17,435
76e38c0bb27e708595c16b158dbcfd85
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=434-479/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::createCountString( IContextSource $context, ?Category $cat, int $countMode )
function
/** * Create a string which format the page, subcat and file counts of a category */ public static function createCountString( IContextSource $context, ?Category $cat, int $countMode ): string { $allCount = $cat ? $cat->getMemberCount() : 0; $subcatCount = $cat ? $cat->getSubcatCount() : 0; $fileCount = $...
17,436
ec217346afcc1789412d8bad95f245f4
swh:1:cnt:e0a96bc2defcb5078f5acf479c60bd55507eda84;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=481-501/
0df7b62f27209f323617cb8849010e1376804323
CategoryTree
deployed
includes/CategoryTree.php
CategoryTree::makeTitle( string $title )
function
/** * Creates a Title object from a user provided (and thus unsafe) string */ public static function makeTitle( string $title ): ?Title { $title = trim( $title ); if ( $title === '' ) { return null; } # The title must be in the category namespace # Ignore a leading Category: if there is one $t = T...
17,437
a295bd4be5b9cf130d2b608a288ffd47
swh:1:cnt:5755ec95ba26fb25f0bac99fb31fce2e56deb434;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=14-36/
16ff13ca6adb741cbb611d4fb90c959323d66dbe
CategoryTree
deployed
includes/CategoryTreeFactory.php
CategoryTreeFactory
type
class CategoryTreeFactory { public function __construct( private readonly Config $config, private readonly Language $contLang, private readonly IConnectionProvider $dbProvider, private readonly LinkBatchFactory $linkBatchFactory, private readonly LinkRenderer $linkRenderer, ) { } public function newCateg...
17,438
9b09ab5eb09149c50bac53b3277bde72
swh:1:cnt:5755ec95ba26fb25f0bac99fb31fce2e56deb434;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=15-22/
16ff13ca6adb741cbb611d4fb90c959323d66dbe
CategoryTree
deployed
includes/CategoryTreeFactory.php
CategoryTreeFactory::__construct( private readonly Config $config, private readonly Language $contLang, private readonly IConnectionProvider $dbProvider, private readonly LinkBatchFactory $linkBatchFactory, private readonly LinkRenderer $linkRenderer, )
function
public function __construct( private readonly Config $config, private readonly Language $contLang, private readonly IConnectionProvider $dbProvider, private readonly LinkBatchFactory $linkBatchFactory, private readonly LinkRenderer $linkRenderer, ) { }
17,439
cf1362f93d6982bb27528a775815ff29
swh:1:cnt:5755ec95ba26fb25f0bac99fb31fce2e56deb434;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=24-35/
16ff13ca6adb741cbb611d4fb90c959323d66dbe
CategoryTree
deployed
includes/CategoryTreeFactory.php
CategoryTreeFactory::newCategoryTree( array $options )
function
public function newCategoryTree( array $options ): CategoryTree { return new CategoryTree( $options, $this->config, $this->contLang, $this->dbProvider, $this->linkBatchFactory, $this->linkRenderer ); }
17,440
5247f2fb2770a12444d86335b2c3fcad
swh:1:cnt:4848f45c9c6ba4dc8f4d219e77ee45fc5102eb8c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=27-41/
73824e8264ccfd5dd97d9c63f2826300d6f9d001
CategoryTree
deployed
includes/CategoryTreeHidePrefix.php
CategoryTreeHidePrefix
type
/** * Constants for use with the hideprefix option, * defining when the namespace prefix should be hidden. */ class CategoryTreeHidePrefix { public const NEVER = 0; public const ALWAYS = 10; public const CATEGORIES = 20; public const AUTO = 30; }
17,441
6ce7ffc31b49fb0236fb7e993199ecfa
swh:1:cnt:1a2e38d322b6cc2636c3488529008a3467eece1b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=27-40/
5734501555017702387ec9cd15b4499b368359cb
CategoryTree
deployed
includes/CategoryTreeMode.php
CategoryTreeMode
type
/** * Constants for use with the mode, defining what should be shown in the tree. */ class CategoryTreeMode { public const CATEGORIES = 0; public const PAGES = 10; public const ALL = 20; public const PARENTS = 100; }
17,442
eadcb40d76297b7b84c14447bb5eca1d
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=33-232/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage
type
/** * Special page for the CategoryTree extension, an AJAX based gadget * to display the category structure of a wiki */ class CategoryTreePage extends SpecialPage { public string $target = ''; public ?CategoryTree $tree = null; public function __construct( private readonly CategoryTreeFactory $categoryTreeFac...
17,443
0468312b51db0cc2031449e11f967544
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=41-46/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::__construct( private readonly CategoryTreeFactory $categoryTreeFactory, private readonly SearchEngineFactory $searchEngineFactory, )
function
public function __construct( private readonly CategoryTreeFactory $categoryTreeFactory, private readonly SearchEngineFactory $searchEngineFactory, ) { parent::__construct( 'CategoryTree' ); }
17,444
da51531070d0aa915033ae66471c01d6
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=105-158/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::executeInputForm()
function
/** * Input form for entering a category */ private function executeInputForm() { $namespaces = $this->getRequest()->getRawVal( 'namespaces' ) ?? ''; // mode may be overriden by namespaces option $mode = ( $namespaces === '' ? $this->getOption( 'mode' ) : CategoryTreeMode::ALL ); if ( $mode === CategoryTre...
17,445
bc01d5136f727506e9625afdfdf8d169
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=160-195/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::executeCategoryTree()
function
/** * Show the category tree */ private function executeCategoryTree() { $output = $this->getOutput(); CategoryTree::setHeaders( $output ); $title = CategoryTree::makeTitle( $this->target ); if ( !$title || !$title->getArticleID() ) { $output->addHTML( Html::rawElement( 'div', [ 'class' => 'CategoryTre...
17,446
7dd96561cecd0f3e523ba30d20b95533
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=60-103/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::execute( $par )
function
/** * Main execution function * @param string|null $par Parameters passed to the page */ public function execute( $par ) { $this->setHeaders(); $this->addHelpLink( 'Extension:CategoryTree' ); $request = $this->getRequest(); if ( $par ) { $this->target = trim( $par ); } else { $this->target = trim...
17,447
c9564ae21a20a0a62ba7880846554a77
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=48-58/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::getOption( string $name )
function
/** * @param string $name * @return mixed */ private function getOption( string $name ) { if ( $this->tree ) { return $this->tree->optionManager->getOption( $name ); } else { return $this->getConfig()->get( 'CategoryTreeDefaultOptions' )[$name]; } }
17,448
e9a9fd55930177d4c248a0b866337dda
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=197-223/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::prefixSearchSubpages( $search, $limit, $offset )
function
/** * Return an array of subpages beginning with $search that this special page will accept. * * @param string $search Prefix to search for * @param int $limit Maximum number of results to return (usually 10) * @param int $offset Number of results to skip (usually 0) * @return string[] Matching subpages *...
17,449
a45eec3e477cfd6c5f8df805bd71913a
swh:1:cnt:65dc11396a7bc73616c8fec76099b27966110f15;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=225-230/
5fb4e277acf729e8baca5d837694ecb60afc17ee
CategoryTree
deployed
includes/CategoryTreePage.php
CategoryTreePage::getGroupName()
function
/** * @inheritDoc */ protected function getGroupName() { return 'pages'; }
17,450
4c1fadecb96d48acefe922bb2ca0416d
swh:1:cnt:0c3c98a5393445f1fa2a047ae51574795b5ad7e8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=30-62/
5249f2e54aa032156ff5d1dcf40d7229fbbf80bb
CategoryTree
deployed
includes/ConfigHookHandler.php
ConfigHookHandler
type
/** * Hook handler for manipulating configuration. * * @note This hook runs before the service container is fully initialized, so it cannot have * services injected. For this reason, it needs to be separate from the handlers for other * hooks. */ class ConfigHookHandler implements MediaWikiServicesHook { /** ...
17,451
a714092ff67c41b88b418d0c17599d93
swh:1:cnt:0c3c98a5393445f1fa2a047ae51574795b5ad7e8;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=39-60/
5249f2e54aa032156ff5d1dcf40d7229fbbf80bb
CategoryTree
deployed
includes/ConfigHookHandler.php
ConfigHookHandler::onMediaWikiServices( $services )
function
/** * Adjusts config once MediaWiki is fully initialised * TODO: Don't do this, lazy initialize the config * @param MediaWikiServices $services */ public function onMediaWikiServices( $services ) { global $wgCategoryTreeDefaultOptions, $wgCategoryTreeDefaultMode; global $wgCategoryTreeCategoryPageOptions, ...
17,452
52a9947f14967b0f80f3450b8f666720
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=48-330/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks
type
/** * Hooks for the CategoryTree extension, an AJAX based gadget * to display the category structure of a wiki */ class Hooks implements SpecialTrackingCategories__preprocessHook, SpecialTrackingCategories__generateCatLinkHook, SkinBuildSidebarHook, ParserFirstCallInitHook, OutputPageRenderCategoryLinkHook, Ca...
17,453
374641ca0586f6c875bfce6790941711
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=61-67/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::__construct( private readonly CategoryCache $categoryCache, private readonly CategoryTreeFactory $categoryTreeFactory, private readonly Config $config, private readonly TitleFormatter $titleFormatter, )
function
public function __construct( private readonly CategoryCache $categoryCache, private readonly CategoryTreeFactory $categoryTreeFactory, private readonly Config $config, private readonly TitleFormatter $titleFormatter, ) { }
17,454
6d10006d603960c0b35ba9af70153c2e
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=80-110/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::parserFunction( Parser $parser, string $cat, string ...$params )
function
/** * Entry point for the {{#categorytree}} tag parser function. * This is a wrapper around Hooks::parserHook * @param Parser $parser * @param string $cat * @param string ...$params * @return array|string */ public function parserFunction( Parser $parser, string $cat, string ...$params ) { // The first...
17,455
1f8266ec70919868e7dca7de0a088d38
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=69-78/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onParserFirstCallInit( $parser )
function
/** * @param Parser $parser */ public function onParserFirstCallInit( $parser ) { if ( !$this->config->get( 'CategoryTreeAllowTag' ) ) { return; } $parser->setHook( 'categorytree', $this->parserHook( ... ) ); $parser->setFunctionHook( 'categorytree', $this->parserFunction( ... ) ); }
17,456
39fc851a5fb6a26090f6308d19ac7d90
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=112-124/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::getCategorySidebarBox()
function
/** * Obtain a category sidebar link based on config * @return string|null of link */ private function getCategorySidebarBox(): ?string { if ( !$this->config->get( 'CategoryTreeSidebarRoot' ) ) { return null; } return $this->parserHook( $this->config->get( 'CategoryTreeSidebarRoot' ), $this->confi...
17,457
4c3682539c8ef97b65032f6e55d8955f
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=126-138/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onSkinBuildSidebar( $skin, &$sidebar )
function
/** * Hook implementation for injecting a category tree into the sidebar. * Only does anything if $wgCategoryTreeSidebarRoot is set to a category name. * @param Skin $skin * @param array &$sidebar */ public function onSkinBuildSidebar( $skin, &$sidebar ) { $html = $this->getCategorySidebarBox(); if ( $ht...
17,458
ff475a525dafb75c7e4d7b76db848b13
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=140-154/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onSkinAfterPortlet( $skin, $portlet, &$html )
function
/** * Hook implementation for injecting a category tree link into the sidebar. * Only does anything if $wgCategoryTreeSidebarRoot is set to a category name. * @param Skin $skin * @param string $portlet * @param string &$html */ public function onSkinAfterPortlet( $skin, $portlet, &$html ) { if ( $portlet...
17,459
afb845d6c0b52b52db59dafa9c650536
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=156-206/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::parserHook( ?string $cat, array $argv, ?Parser $parser = null )
function
/** * Entry point for the <categorytree> tag parser hook. * This loads CategoryTree and calls CategoryTree::getTag() * @param string|null $cat * @param array $argv * @param Parser|null $parser * @return string */ public function parserHook( ?string $cat, array $argv, ?Parser $parser = null ): stri...
17,460
1b179a0f6ce97516248822839217d1de
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=208-237/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onOutputPageRenderCategoryLink( OutputPage $outputPage, ProperPageIdentity $categoryTitle, string $text, ?string &$link )
function
/** * OutputPageRenderCategoryLink hook * @param OutputPage $outputPage * @param ProperPageIdentity $categoryTitle * @param string $text * @param ?string &$link */ public function onOutputPageRenderCategoryLink( OutputPage $outputPage, ProperPageIdentity $categoryTitle, string $text, ?string &$link...
17,461
a2e8c54879a65d72da1b86ea68b9990a
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=239-254/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::getDataForJs( RL\Context $context, Config $config )
function
/** * Get exported data for the "ext.categoryTree" ResourceLoader module. * * @internal For use in extension.json only. * @param RL\Context $context * @param Config $config * @return array Data to be serialised as data.json */ public static function getDataForJs( RL\Context $context, Config $config ): ar...
17,462
b5131b6c6a3e2db5fa62c25d391141aa
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=256-273/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onSpecialTrackingCategories__preprocess( $specialPage, $trackingCategories )
function
/** * Hook handler for the SpecialTrackingCategories::preprocess hook * @param SpecialPage $specialPage SpecialTrackingCategories object * @param array $trackingCategories [ 'msg' => LinkTarget, 'cats' => LinkTarget[] ] * @phan-param array<string,array{msg:LinkTarget,cats:LinkTarget[]}> $trackingCategories */...
17,463
e55b1c124b83b2bd852ecdafeb64c16f
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=275-287/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onSpecialTrackingCategories__generateCatLink( $specialPage, $catTitle, &$html )
function
/** * Hook handler for the SpecialTrackingCategories::generateCatLink hook * @param SpecialPage $specialPage SpecialTrackingCategories object * @param LinkTarget $catTitle LinkTarget object of the linked category * @param string &$html Result html */ public function onSpecialTrackingCategories__generateCatLi...
17,464
845ed74d6ec65c1d34dd9f6cf48a62ee
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=289-297/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onCategoryViewer__doCategoryQuery( $type, $res )
function
/** * @param string $type * @param IResultWrapper $res */ public function onCategoryViewer__doCategoryQuery( $type, $res ) { if ( $type === 'subcat' ) { $this->categoryCache->fillFromQuery( $res ); } }
17,465
678ea2a38c2c96ce0d9ff03acc03080f
swh:1:cnt:1a1a0b1f7be5564c84f5de738c4005c1c71748d4;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=299-329/
081cfbd2495cc1b42ff9fb22d6f2d5fa633ccdd3
CategoryTree
deployed
includes/Hooks.php
Hooks::onCategoryViewer__generateLink( $type, $title, $html, &$link )
function
/** * @param string $type * @param Title $title * @param string $html * @param string &$link * @return bool */ public function onCategoryViewer__generateLink( $type, $title, $html, &$link ) { if ( $type !== 'subcat' || $link !== null ) { return true; } $request = RequestContext::getMain()->getReq...
17,466
c50a0d8002d530053f52025b38651cf1
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=32-301/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager
type
/** * Core functions to handle the options */ class OptionManager { private array $mOptions = []; public function __construct( array $options, private readonly Config $config, ) { // ensure default values and order of options. // Order may become important, it may influence the cache key! foreach ( $con...
17,467
4aaf0b167d53c6003c2076fab640648c
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=38-70/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::__construct( array $options, private readonly Config $config, )
function
public function __construct( array $options, private readonly Config $config, ) { // ensure default values and order of options. // Order may become important, it may influence the cache key! foreach ( $config->get( 'CategoryTreeDefaultOptions' ) as $option => $default ) { $this->mOptions[$option] = $opti...
17,468
511ccf65769519b0316d26ef2d899fbb
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=72-74/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::getOptions()
function
public function getOptions(): array { return $this->mOptions; }
17,469
25a885034ed3f76f421c92943794d9ef
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=84-86/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::isInverse()
function
public function isInverse(): bool { return $this->getOption( 'mode' ) === CategoryTreeMode::PARENTS; }
17,470
09418767d74e728744f936e16d55aba8
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=88-131/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::decodeNamespaces( $nn )
function
/** * @param mixed $nn * @return array|bool */ private static function decodeNamespaces( $nn ) { if ( $nn === false || $nn === null ) { return false; } if ( !is_array( $nn ) ) { $nn = preg_split( '![\s#:|]+!', $nn ); } $namespaces = []; $contLang = MediaWikiServices::getInstance()->getContent...
17,471
edba770efb8cd3efc4a024af711adbe7
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=76-82/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::getOption( string $name )
function
/** * @param string $name * @return mixed */ public function getOption( string $name ) { return $this->mOptions[$name]; }
17,472
14f0eade767cbf0bdb6e468741270ebc
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=133-166/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::decodeMode( $mode )
function
/** * @param mixed $mode * @return int|string */ private function decodeMode( $mode ) { $defaultOptions = $this->config->get( 'CategoryTreeDefaultOptions' ); if ( $mode === null ) { return $defaultOptions['mode']; } if ( is_int( $mode ) ) { return $mode; } $mode = trim( strtolower( $mode ) );...
17,473
9e63319eba4dda6642016763536ee26d
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=168-192/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::decodeBoolean( $value )
function
/** * Helper function to convert a string to a boolean value. * Perhaps make this a global function in MediaWiki proper * @param mixed $value * @return bool */ public static function decodeBoolean( $value ): bool { if ( $value === null || is_bool( $value ) ) { return (bool)$value; } if ( is_int( $va...
17,474
ddc91e8cf9f745fd0fe4295b063535f7
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=194-235/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::decodeHidePrefix( $value )
function
/** * @param mixed $value * @return int|string */ private function decodeHidePrefix( $value ) { $defaultOptions = $this->config->get( 'CategoryTreeDefaultOptions' ); if ( $value === null ) { return $defaultOptions['hideprefix']; } if ( is_int( $value ) ) { return $value; } if ( $value === true...
17,475
64ac0ec79d465a89fc8e8352f1dbaa13
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=237-252/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::encodeOptions( array $options, string $enc )
function
/** * @param array $options * @param string $enc * @return mixed */ private static function encodeOptions( array $options, string $enc ) { if ( $enc === 'mode' || $enc === '' ) { $opt = $options['mode']; } elseif ( $enc === 'json' ) { $opt = FormatJson::encode( $options ); } else { throw new Inv...
17,476
9db8d84c51d578df90604e06a26687ec
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=254-272/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::getOptionsAsCacheKey( ?int $depth = null )
function
/** * @param int|null $depth * @return string */ public function getOptionsAsCacheKey( ?int $depth = null ): string { $key = ''; foreach ( $this->mOptions as $k => $v ) { if ( is_array( $v ) ) { $v = implode( '|', $v ); } $key .= $k . ':' . $v . ';'; } if ( $depth !== null ) { $key .= '...
17,477
2af2cf2aa74a64997ee3f745bbf9848d
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=274-279/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::getOptionsAsJsStructure()
function
/** * @return mixed */ public function getOptionsAsJsStructure() { return self::encodeOptions( $this->mOptions, 'json' ); }
17,478
9527adfe277b8069ce291011388b370b
swh:1:cnt:460f9cbb7a686e386ed0680b5d4deb73db75430b;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=281-300/
69253d506a6738d58737ed5004080d9f85bffd06
CategoryTree
deployed
includes/OptionManager.php
OptionManager::capDepth( int $depth )
function
/** * Internal function to cap depth * @param int $depth * @return int */ public function capDepth( int $depth ): int { $mode = $this->getOption( 'mode' ); $maxDepth = $this->config->get( 'CategoryTreeMaxDepth' ); if ( is_array( $maxDepth ) ) { $max = $maxDepth[$mode] ?? 1; } elseif ( is_numeric( $...
17,479
6aecb873e8897073f5be24e3b8efefde
swh:1:cnt:93e08053752f14dc4e50a151009750ec99cccd40;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=27-46/
a47542e21a9f15eb8eb93069a01eb3b301aaa10d
CategoryTree
deployed
modules/ext.categoryTree/ext.categoryTree.js
expandNode
function
/** * Expands a given node (loading it's children if not loaded) * * @param {jQuery} $link */ function expandNode( $link ) { // Show the children node const $children = $link.parents( '.CategoryTreeItem' ) .siblings( '.CategoryTreeChildren' ) .css( 'display', '' ); $link.attr( { title: mw.msg( 'categorytr...
17,480
1b9cd8699e96e123fb9468b71757f562
swh:1:cnt:93e08053752f14dc4e50a151009750ec99cccd40;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=81-99/
a47542e21a9f15eb8eb93069a01eb3b301aaa10d
CategoryTree
deployed
modules/ext.categoryTree/ext.categoryTree.js
attachHandler
function
/** * Attach click handler to buttons * * @param {jQuery} $content */ function attachHandler( $content ) { $content.find( '.CategoryTreeToggle' ) .on( 'click', handleNode ) .attr( { role: 'button', title: function () { return mw.msg( $( this ).attr( 'aria-expanded' ) === 'false' ? 'categor...
17,481
8a381919eb17395313052c089449287e
swh:1:cnt:93e08053752f14dc4e50a151009750ec99cccd40;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=101-180/
a47542e21a9f15eb8eb93069a01eb3b301aaa10d
CategoryTree
deployed
modules/ext.categoryTree/ext.categoryTree.js
loadChildren
function
/** * Loads children for a node via an HTTP call * * @param {jQuery} $link * @param {jQuery} $children */ function loadChildren( $link, $children ) { /** * Error callback */ function error() { const $retryLink = $( '<a>' ) .text( mw.msg( 'categorytree-retry' ) ) .attr( { role: 'button', tabin...
17,482
fcfc1c3715e1698fa0d14a8ffd0a42ae
swh:1:cnt:93e08053752f14dc4e50a151009750ec99cccd40;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=65-79/
a47542e21a9f15eb8eb93069a01eb3b301aaa10d
CategoryTree
deployed
modules/ext.categoryTree/ext.categoryTree.js
handleNode
function
/** * Handles clicks on the expand buttons, and calls the appropriate function * * @param {jQuery.Event} e */ function handleNode( e ) { e.preventDefault(); const $link = $( this ); if ( $link.attr( 'aria-expanded' ) === 'false' ) { expandNode( $link ); } else { collapseNode( $link ); } }
17,483
892ed928a20b8cc0fcb91a239a66750e
swh:1:cnt:93e08053752f14dc4e50a151009750ec99cccd40;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=48-63/
a47542e21a9f15eb8eb93069a01eb3b301aaa10d
CategoryTree
deployed
modules/ext.categoryTree/ext.categoryTree.js
collapseNode
function
/** * Collapses a node * * @param {jQuery} $link */ function collapseNode( $link ) { // Hide the children node $link.parents( '.CategoryTreeItem' ) .siblings( '.CategoryTreeChildren' ) .css( 'display', 'none' ); $link.attr( { title: mw.msg( 'categorytree-expand' ), 'aria-expanded': 'false' } ); }
17,484
2d73f9ccf1148c595a10e886ba5e0034
swh:1:cnt:93e08053752f14dc4e50a151009750ec99cccd40;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=108-130/
a47542e21a9f15eb8eb93069a01eb3b301aaa10d
CategoryTree
deployed
modules/ext.categoryTree/ext.categoryTree.js
loadChildren::error
function
/** * Error callback */ function error() { const $retryLink = $( '<a>' ) .text( mw.msg( 'categorytree-retry' ) ) .attr( { role: 'button', tabindex: 0 } ) .on( 'click keypress', ( e ) => { if ( e.type === 'click' || e.type === 'keypress' && e.which === 13 ) { loadChildre...
17,485
2e77a9aed304b74a619fe5338cefc240
swh:1:cnt:392aaae5fbf42603840a4de289434161a2eed215;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=5-11/
03f71258fa976a3f2cb58505b21d75c4bc41939f
CategoryTree
deployed
tests/phpunit/BundleSizeTest.php
BundleSizeTest
type
class BundleSizeTest extends \MediaWiki\Tests\Structure\BundleSizeTestBase { /** @inheritDoc */ public static function getBundleSizeConfigData(): string { return dirname( __DIR__, 2 ) . '/bundlesize.config.json'; } }
17,486
35150e49cd442797258778c6082bae55
swh:1:cnt:392aaae5fbf42603840a4de289434161a2eed215;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=7-10/
03f71258fa976a3f2cb58505b21d75c4bc41939f
CategoryTree
deployed
tests/phpunit/BundleSizeTest.php
BundleSizeTest::getBundleSizeConfigData()
function
/** @inheritDoc */ public static function getBundleSizeConfigData(): string { return dirname( __DIR__, 2 ) . '/bundlesize.config.json'; }
17,487
82d54bf11c9f44894b17749daed49700
swh:1:cnt:896b1b5b03ce3e89ef6ea41237f0ed78a2ca3fe6;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=30-88/
61afbe59a50cc7f5b1c0ea0ad9c22461992eb22e
CategoryTree
deployed
tests/phpunit/CategoryCacheTest.php
CategoryCacheTest
type
/** * @group Database * @covers \MediaWiki\Extension\CategoryTree\CategoryCache */ class CategoryCacheTest extends MediaWikiIntegrationTestCase { public function testConstruct() { new CategoryCache( $this->createMock( IConnectionProvider::class ) ); $this->addToAssertionCount( 1 ); } public function te...
17,488
5d423a9aac7a8fe1f4feb73e00c5c46c
swh:1:cnt:896b1b5b03ce3e89ef6ea41237f0ed78a2ca3fe6;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=36-41/
61afbe59a50cc7f5b1c0ea0ad9c22461992eb22e
CategoryTree
deployed
tests/phpunit/CategoryCacheTest.php
CategoryCacheTest::testConstruct()
function
public function testConstruct() { new CategoryCache( $this->createMock( IConnectionProvider::class ) ); $this->addToAssertionCount( 1 ); }
17,489
df043ae5a1882a6bba1a3a1429bd8efa
swh:1:cnt:896b1b5b03ce3e89ef6ea41237f0ed78a2ca3fe6;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=67-87/
61afbe59a50cc7f5b1c0ea0ad9c22461992eb22e
CategoryTree
deployed
tests/phpunit/CategoryCacheTest.php
CategoryCacheTest::testGetCategory()
function
public function testGetCategory() { // Create a row in the category table $this->editPage( new TitleValue( NS_MAIN, 'CategoryTreeCategoryCacheTest' ), '[[Category:Exists]]' ); $this->runJobs(); $categoryCache = TestingAccessWrapper::newFromObject( $this->getServiceContainer()->get( 'CategoryTree.Cat...
17,490
4cd6cbfbee61b0bab2acfce4729b09c0
swh:1:cnt:896b1b5b03ce3e89ef6ea41237f0ed78a2ca3fe6;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=43-65/
61afbe59a50cc7f5b1c0ea0ad9c22461992eb22e
CategoryTree
deployed
tests/phpunit/CategoryCacheTest.php
CategoryCacheTest::testDoQuery()
function
public function testDoQuery() { // Create a row in the category table $this->editPage( new TitleValue( NS_MAIN, 'CategoryTreeCategoryCacheTest' ), '[[Category:Exists]]' ); $this->runJobs(); $categoryCache = TestingAccessWrapper::newFromObject( $this->getServiceContainer()->get( 'CategoryTree.Categor...
17,491
509ae99ea9dd4732d74274795fe248b6
swh:1:cnt:cad128cc3d65ef070d1ded231b9a08751725faa0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=12-30/
b8f9f5a09d83dee69cb451c67cd9b9fc7d2aa389
CategoryTree
deployed
tests/phpunit/ServiceWiringTest.php
ServiceWiringTest
type
/** * @coversNothing */ class ServiceWiringTest extends MediaWikiIntegrationTestCase { /** * @dataProvider provideService */ public function testService( string $name ) { $this->getServiceContainer()->get( $name ); $this->addToAssertionCount( 1 ); } public static function provideService() { $wiring = r...
17,492
f70b728d840cabc00754a8b075e5b202
swh:1:cnt:cad128cc3d65ef070d1ded231b9a08751725faa0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=16-22/
b8f9f5a09d83dee69cb451c67cd9b9fc7d2aa389
CategoryTree
deployed
tests/phpunit/ServiceWiringTest.php
ServiceWiringTest::testService( string $name )
function
/** * @dataProvider provideService */ public function testService( string $name ) { $this->getServiceContainer()->get( $name ); $this->addToAssertionCount( 1 ); }
17,493
ae3e2168736ab1b2a55f0b03b3888f7d
swh:1:cnt:cad128cc3d65ef070d1ded231b9a08751725faa0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree.git;lines=24-29/
b8f9f5a09d83dee69cb451c67cd9b9fc7d2aa389
CategoryTree
deployed
tests/phpunit/ServiceWiringTest.php
ServiceWiringTest::provideService()
function
public static function provideService() { $wiring = require __DIR__ . '/../../includes/ServiceWiring.php'; foreach ( $wiring as $name => $_ ) { yield $name => [ $name ]; } }
17,494
10da65e1a03354e9f1a561403637e919
swh:1:cnt:7a7dd14c849e9286dfba93b0b94b5d98034ae067;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=1-59/
18d85514d9ccf2ecaaf31b431c14512b06abcb25
ArticleGuidance
deployed
resources/ext.articleguidance.newarticle/api/MediaWiki.js
checkPagesExist
function
/** * MediaWiki API utilities for local wiki operations */ /** * Check if multiple pages exist on the local wiki in a single API call. * * @param {string[]} titles - Page titles to check * @return {Promise<Object>} Map of input title → boolean existence * @throws {Error} If the API call fails */ async function...
17,495
ac29424967484464d1f02df4df48fa5c
swh:1:cnt:7a7dd14c849e9286dfba93b0b94b5d98034ae067;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=61-83/
18d85514d9ccf2ecaaf31b431c14512b06abcb25
ArticleGuidance
deployed
resources/ext.articleguidance.newarticle/api/MediaWiki.js
fetchLocalArticleData
function
/** * Fetch the description and thumbnail for a local wiki page. * * @param {string} title Page title * @return {Promise<{title: string, description: string, thumbnail: string|null}>} */ async function fetchLocalArticleData( title ) { const api = new mw.Api(); const response = await api.get( { action: 'query',...
17,496
b2dadde7efbb6746e91e634af6b53711
swh:1:cnt:4329a6ad8b4b744ea30502f66c034f64b128607a;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=1-15/
68d2e4ea4220e8e4b0168df2fb0ebd608ff0506d
ArticleGuidance
deployed
resources/ext.articleguidance.newarticle/api/Outlines.js
fetchOutlines
function
/** * API utility for fetching article guidance outlines */ /** * Fetch outlines from the ArticleGuidance REST API * * @return {Promise<Array>} Promise resolving to array of outline objects * @throws {Error} If the API request fails */ async function fetchOutlines() { const api = new mw.Rest(); const response...
17,497
e65389c21654cb2ede5c36abda1dbe81
swh:1:cnt:62db99fda6be8e4588a886a14c4b9ed3e969dc9c;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=1-24/
f00bfa91826cc5403ab296354ba58e0c408fa6fd
ArticleGuidance
deployed
resources/ext.articleguidance.newarticle/api/Sources.js
validateSource
function
/** * API utility for validating article sources */ /** * Validate a source URL against the ArticleGuidance REST API * * @param {string} url - The URL to validate * @param {string} [subjectQId] - Wikidata Q-ID of the article subject * @param {string} [outlineQId] - Q-ID of the selected outline/article type * @...
17,498
29dd710e8b42a50ef994448c0b6cbfb5
swh:1:cnt:89dbec5870847621ead82ac7236e585b01e544d0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=17-37/
98e708dbb4701b6a2d71365024c5c5ea6cdf31cf
ArticleGuidance
deployed
resources/ext.articleguidance.newarticle/api/Sparql.js
executeSparql
function
/** * Execute a SPARQL query against the Wikidata Query Service. * * @param {string} query SPARQL query string * @return {Promise<Object>} Parsed JSON response */ async function executeSparql( query ) { const url = 'https://query.wikidata.org/sparql?' + new URLSearchParams( { query: query, format: 'json' } )...
17,499
c2b4a090785c8a9c688bd2b22eb85542
swh:1:cnt:89dbec5870847621ead82ac7236e585b01e544d0;origin=https://gerrit.wikimedia.org/r/mediawiki/extensions/ArticleGuidance.git;lines=49-186/
98e708dbb4701b6a2d71365024c5c5ea6cdf31cf
ArticleGuidance
deployed
resources/ext.articleguidance.newarticle/api/Sparql.js
checkItemHierarchyMatches
function
/** * Check which outline types each item reaches via hierarchy traversal. * * Accepts item QIDs directly (from wbsearchentities results), avoiding the need * to wait for wbgetentities P31 values before querying. Runs one query per group * in parallel, skipping items already present in the page-scoped cache. * *...