MediaWiki master
MediaWiki\Category\CategoryViewer Class Reference

Inherits MediaWiki\Context\ContextSource.

Collaboration diagram for MediaWiki\Category\CategoryViewer:

Public Member Functions

 __construct (protected PageIdentity $page, IContextSource $context, array $from=[], array $until=[], private array $query=[],)
 
 addImage (PageReference $page, string $sortkey, int $pageLength, bool $isRedirect=false)
 Add a page in the image namespace.
 
 addPage (PageReference $page, string $sortkey, int $pageLength, bool $isRedirect=false)
 Add a miscellaneous page.
 
 addSubcategoryObject (Category $cat, string $sortkey, int $pageLength)
 Add a subcategory to the internal lists, using a Category object.
 
 getHTML ()
 Format the category data list.
 
- Public Member Functions inherited from MediaWiki\Context\ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getActionName ()
 Get the action name for the current web request.
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getLanguageCode ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Static Public Member Functions

static columnList ( $articles, $articles_start_char, $cssClasses='mw-category mw-category-columns')
 Format a list of articles chunked by letter in a three-column list, ordered vertically.
 
static shortList ( $articles, $articles_start_char)
 Format a list of articles chunked by letter in a bullet list.
 

Public Attributes

array string[] $articles = []
 
array string[] $articles_start_char = []
 
array string[] $children = []
 
array string[] $children_start_char = []
 
readonly Collation $collation
 
array array< 'page'| 'subcat'| 'file', bool > $flip = []
 Sorting order for each type.
 
readonly array array< 'page'| 'subcat'| 'file',?string > $from
 
ImageGalleryBase $gallery
 
array string[] $imgsNoGallery = []
 
array string[] $imgsNoGallery_start_char = []
 
readonly int $limit
 
array array< 'page'| 'subcat'| 'file',?string > $nextPage = []
 
bool $showGallery
 
readonly bool $sortByTimestamp
 
readonly bool $sortDescending
 
readonly array array< 'page'| 'subcat'| 'file',?string > $until
 

Protected Member Functions

 clearCategoryState ()
 
 doCategoryQuery ()
 
 finaliseCategoryState ()
 
 getImageSection ()
 
 getPagesSection ()
 
 getSubcategorySection ()
 

Protected Attributes

array array< 'page'| 'subcat'| 'file',?string > $prevPage = []
 

Detailed Description

Definition at line 36 of file CategoryViewer.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Category\CategoryViewer::__construct ( protected PageIdentity $page,
IContextSource $context,
array $from = [],
array $until = [],
private array $query = [] )
Since
1.19 $context is a second, required parameter
Parameters
PageIdentity$page
IContextSource$context
array<'page'|'subcat'|'file',?string>$from An array with keys page, subcat, and file for offset of results of each section (since 1.17)
array<'page'|'subcat'|'file',?string>$until An array with 3 keys for until of each section (since 1.17)
array$queryThe original query array, to be used in generating paging links.

Definition at line 86 of file CategoryViewer.php.

References MediaWiki\Category\CategoryViewer\$from, $request, MediaWiki\Category\CategoryViewer\$until, MediaWiki\MainConfigNames\CategoryPagingLimit, MediaWiki\Context\IContextSource\getConfig(), MediaWiki\Page\PageIdentity\getId(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Context\ContextSource\getOutput(), MediaWiki\Context\IContextSource\getRequest(), MediaWiki\Category\Category\newFromTitle(), and MediaWiki\Context\ContextSource\setContext().

Member Function Documentation

◆ addImage()

MediaWiki\Category\CategoryViewer::addImage ( PageReference $page,
string $sortkey,
int $pageLength,
bool $isRedirect = false )

Add a page in the image namespace.

Parameters
PageReference$page
string$sortkey
int$pageLength
bool$isRedirect

Definition at line 301 of file CategoryViewer.php.

◆ addPage()

MediaWiki\Category\CategoryViewer::addPage ( PageReference $page,
string $sortkey,
int $pageLength,
bool $isRedirect = false )

Add a miscellaneous page.

Parameters
PageReference$page
string$sortkey
int$pageLength
bool$isRedirect

Definition at line 330 of file CategoryViewer.php.

◆ addSubcategoryObject()

MediaWiki\Category\CategoryViewer::addSubcategoryObject ( Category $cat,
string $sortkey,
int $pageLength )

Add a subcategory to the internal lists, using a Category object.

Parameters
Category$cat
string$sortkey
int$pageLength

Definition at line 210 of file CategoryViewer.php.

◆ clearCategoryState()

MediaWiki\Category\CategoryViewer::clearCategoryState ( )
protected

Definition at line 182 of file CategoryViewer.php.

References MediaWiki\Gallery\ImageGalleryBase\factory().

◆ columnList()

static MediaWiki\Category\CategoryViewer::columnList ( $articles,
$articles_start_char,
$cssClasses = 'mw-category mw-category-columns' )
static

Format a list of articles chunked by letter in a three-column list, ordered vertically.

This is used for categories with a significant number of pages.

Parameters
string[]$articlesHTML links to each article
string[]$articles_start_charThe header characters for each article
string$cssClassesCSS classes for the wrapper element
Returns
string HTML to output
Access: internal

Definition at line 686 of file CategoryViewer.php.

◆ doCategoryQuery()

MediaWiki\Category\CategoryViewer::doCategoryQuery ( )
protected

Definition at line 356 of file CategoryViewer.php.

References NS_CATEGORY, and NS_FILE.

◆ finaliseCategoryState()

MediaWiki\Category\CategoryViewer::finaliseCategoryState ( )
protected

Definition at line 341 of file CategoryViewer.php.

◆ getHTML()

MediaWiki\Category\CategoryViewer::getHTML ( )

Format the category data list.

Returns
string HTML output

Definition at line 157 of file CategoryViewer.php.

References MediaWiki\MainConfigNames\CategoryMagicGallery.

◆ getImageSection()

MediaWiki\Category\CategoryViewer::getImageSection ( )
protected
Returns
string HTML

Definition at line 574 of file CategoryViewer.php.

◆ getPagesSection()

MediaWiki\Category\CategoryViewer::getPagesSection ( )
protected
Returns
string HTML

Definition at line 539 of file CategoryViewer.php.

◆ getSubcategorySection()

MediaWiki\Category\CategoryViewer::getSubcategorySection ( )
protected
Returns
string HTML

Definition at line 516 of file CategoryViewer.php.

◆ shortList()

static MediaWiki\Category\CategoryViewer::shortList ( $articles,
$articles_start_char )
static

Format a list of articles chunked by letter in a bullet list.

This is used for categories with a small number of pages (when columns aren't needed).

Parameters
string[]$articlesHTML links to each article
string[]$articles_start_charThe header characters for each article
Returns
string HTML to output
Access: internal

Definition at line 733 of file CategoryViewer.php.

Member Data Documentation

◆ $articles

array string [] MediaWiki\Category\CategoryViewer::$articles = []

Definition at line 42 of file CategoryViewer.php.

◆ $articles_start_char

array string [] MediaWiki\Category\CategoryViewer::$articles_start_char = []

Definition at line 44 of file CategoryViewer.php.

◆ $children

array string [] MediaWiki\Category\CategoryViewer::$children = []

Definition at line 46 of file CategoryViewer.php.

◆ $children_start_char

array string [] MediaWiki\Category\CategoryViewer::$children_start_char = []

Definition at line 48 of file CategoryViewer.php.

◆ $collation

readonly Collation MediaWiki\Category\CategoryViewer::$collation

Definition at line 64 of file CategoryViewer.php.

◆ $flip

array array<'page'|'subcat'|'file',bool> MediaWiki\Category\CategoryViewer::$flip = []

Sorting order for each type.

Definition at line 59 of file CategoryViewer.php.

◆ $from

readonly array array<'page'|'subcat'|'file',?string> MediaWiki\Category\CategoryViewer::$from

Definition at line 73 of file CategoryViewer.php.

Referenced by MediaWiki\Category\CategoryViewer\__construct().

◆ $gallery

ImageGalleryBase MediaWiki\Category\CategoryViewer::$gallery

Definition at line 65 of file CategoryViewer.php.

◆ $imgsNoGallery

array string [] MediaWiki\Category\CategoryViewer::$imgsNoGallery = []

Definition at line 53 of file CategoryViewer.php.

◆ $imgsNoGallery_start_char

array string [] MediaWiki\Category\CategoryViewer::$imgsNoGallery_start_char = []

Definition at line 51 of file CategoryViewer.php.

◆ $limit

readonly int MediaWiki\Category\CategoryViewer::$limit

Definition at line 40 of file CategoryViewer.php.

◆ $nextPage

array array<'page'|'subcat'|'file',?string> MediaWiki\Category\CategoryViewer::$nextPage = []

Definition at line 55 of file CategoryViewer.php.

◆ $prevPage

array array<'page'|'subcat'|'file',?string> MediaWiki\Category\CategoryViewer::$prevPage = []
protected

Definition at line 57 of file CategoryViewer.php.

◆ $showGallery

bool MediaWiki\Category\CategoryViewer::$showGallery

Definition at line 49 of file CategoryViewer.php.

◆ $sortByTimestamp

readonly bool MediaWiki\Category\CategoryViewer::$sortByTimestamp

Definition at line 61 of file CategoryViewer.php.

◆ $sortDescending

readonly bool MediaWiki\Category\CategoryViewer::$sortDescending

Definition at line 62 of file CategoryViewer.php.

◆ $until

readonly array array<'page'|'subcat'|'file',?string> MediaWiki\Category\CategoryViewer::$until

Definition at line 75 of file CategoryViewer.php.

Referenced by MediaWiki\Category\CategoryViewer\__construct().


The documentation for this class was generated from the following file: