MediaWiki  master
CategoryViewer Class Reference
Inheritance diagram for CategoryViewer:
Collaboration diagram for CategoryViewer:

Public Member Functions

 __construct (PageIdentity $page, IContextSource $context, array $from=[], array $until=[], array $query=[])
 
 addImage (PageReference $page, string $sortkey, int $pageLength, bool $isRedirect=false)
 Add a page in the image namespace. More...
 
 addPage (PageReference $page, string $sortkey, int $pageLength, bool $isRedirect=false)
 Add a miscellaneous page. More...
 
 addSubcategoryObject (Category $cat, $sortkey, $pageLength)
 Add a subcategory to the internal lists, using a Category object. More...
 
 getHTML ()
 Format the category data list. More...
 
 getSubcategorySortChar (PageIdentity $page, string $sortkey)
 Get the character to be used for sorting subcategories. More...
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getActionName ()
 Get the action name for the current web request. More...
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 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. More...
 
static shortList ( $articles, $articles_start_char)
 Format a list of articles chunked by letter in a bullet list. More...
 

Public Attributes

string[] $articles
 
array $articles_start_char
 
array $children
 
array $children_start_char
 
Collation $collation
 
array $flip
 
array $from
 
ImageGalleryBase $gallery
 
array $imgsNoGallery
 
array $imgsNoGallery_start_char
 
int $limit
 
array $nextPage
 
bool $showGallery
 
array $until
 

Protected Member Functions

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

Protected Attributes

PageIdentity $page
 
array $prevPage
 

Detailed Description

Definition at line 31 of file CategoryViewer.php.

Constructor & Destructor Documentation

◆ __construct()

CategoryViewer::__construct ( PageIdentity  $page,
IContextSource  $context,
array  $from = [],
array  $until = [],
array  $query = [] 
)
Since
1.19 $context is a second, required parameter
Parameters
PageIdentity$page
IContextSource$context
array$fromAn array with keys page, subcat, and file for offset of results of each section (since 1.17)
array$untilAn array with 3 keys for until of each section (since 1.17)
array$query

Definition at line 101 of file CategoryViewer.php.

References $from, $page, $until, Title\castFromPageIdentity(), deprecatePublicPropertyFallback(), IContextSource\getConfig(), ContextSource\getOutput(), Category\newFromTitle(), and ContextSource\setContext().

Member Function Documentation

◆ addImage()

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.

References $title.

◆ addPage()

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()

CategoryViewer::addSubcategoryObject ( Category  $cat,
  $sortkey,
  $pageLength 
)

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

Parameters
Category$cat
string$sortkey
int$pageLength

Definition at line 208 of file CategoryViewer.php.

References $page, Category\getPage(), and getSubcategorySortChar().

◆ clearCategoryState()

CategoryViewer::clearCategoryState ( )
protected

◆ columnList()

static 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 630 of file CategoryViewer.php.

References Html\closeElement(), Html\openElement(), and Html\rawElement().

◆ doCategoryQuery()

CategoryViewer::doCategoryQuery ( )
protected

◆ finaliseCategoryState()

CategoryViewer::finaliseCategoryState ( )
protected

Definition at line 339 of file CategoryViewer.php.

Referenced by getHTML().

◆ getCategoryBottom()

CategoryViewer::getCategoryBottom ( )
protected
Returns
string

Definition at line 587 of file CategoryViewer.php.

Referenced by getHTML().

◆ getCategoryTop()

CategoryViewer::getCategoryTop ( )
protected
Returns
string

Definition at line 462 of file CategoryViewer.php.

Referenced by getHTML().

◆ getHTML()

◆ getImageSection()

CategoryViewer::getImageSection ( )
protected
Returns
string

Definition at line 529 of file CategoryViewer.php.

References Html\closeElement(), Html\openElement(), and Html\rawElement().

Referenced by getHTML().

◆ getPagesSection()

CategoryViewer::getPagesSection ( )
protected
Returns
string

Definition at line 496 of file CategoryViewer.php.

References Html\closeElement(), Category\COUNT_CONTENT_PAGES, Html\openElement(), and Html\rawElement().

Referenced by getHTML().

◆ getSubcategorySection()

CategoryViewer::getSubcategorySection ( )
protected
Returns
string

Definition at line 472 of file CategoryViewer.php.

References Html\closeElement(), Html\openElement(), and Html\rawElement().

Referenced by getHTML().

◆ getSubcategorySortChar()

CategoryViewer::getSubcategorySortChar ( PageIdentity  $page,
string  $sortkey 
)

Get the character to be used for sorting subcategories.

If there's a link from Category:A to Category:B, the sortkey of the resulting entry in the categorylinks table is Category:A, not A, which it SHOULD be. Workaround: If sortkey == "Category:".$title, than use $title for sorting, else use sortkey...

Parameters
PageIdentity$page
string$sortkeyThe human-readable sortkey (before transforming to icu or whatever).
Returns
string

Definition at line 280 of file CategoryViewer.php.

References Page\PageReference\getDBkey().

Referenced by addSubcategoryObject().

◆ shortList()

static 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 682 of file CategoryViewer.php.

Member Data Documentation

◆ $articles

string [] CategoryViewer::$articles

Definition at line 45 of file CategoryViewer.php.

◆ $articles_start_char

array CategoryViewer::$articles_start_char

Definition at line 48 of file CategoryViewer.php.

◆ $children

array CategoryViewer::$children

Definition at line 51 of file CategoryViewer.php.

◆ $children_start_char

array CategoryViewer::$children_start_char

Definition at line 54 of file CategoryViewer.php.

◆ $collation

Collation CategoryViewer::$collation

Definition at line 78 of file CategoryViewer.php.

◆ $flip

array CategoryViewer::$flip

Definition at line 72 of file CategoryViewer.php.

◆ $from

array CategoryViewer::$from

Definition at line 39 of file CategoryViewer.php.

Referenced by __construct().

◆ $gallery

ImageGalleryBase CategoryViewer::$gallery

Definition at line 81 of file CategoryViewer.php.

◆ $imgsNoGallery

array CategoryViewer::$imgsNoGallery

Definition at line 63 of file CategoryViewer.php.

◆ $imgsNoGallery_start_char

array CategoryViewer::$imgsNoGallery_start_char

Definition at line 60 of file CategoryViewer.php.

◆ $limit

int CategoryViewer::$limit

Definition at line 36 of file CategoryViewer.php.

◆ $nextPage

array CategoryViewer::$nextPage

Definition at line 66 of file CategoryViewer.php.

◆ $page

PageIdentity CategoryViewer::$page
protected

Definition at line 75 of file CategoryViewer.php.

Referenced by __construct(), and addSubcategoryObject().

◆ $prevPage

array CategoryViewer::$prevPage
protected

Definition at line 69 of file CategoryViewer.php.

◆ $showGallery

bool CategoryViewer::$showGallery

Definition at line 57 of file CategoryViewer.php.

◆ $until

array CategoryViewer::$until

Definition at line 42 of file CategoryViewer.php.

Referenced by __construct().


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