MediaWiki REL1_32
|
Public Member Functions | |
__construct ( $title, IContextSource $context, $from=[], $until=[], $query=[]) | |
addImage (Title $title, $sortkey, $pageLength, $isRedirect=false) | |
Add a page in the image namespace. | |
addPage ( $title, $sortkey, $pageLength, $isRedirect=false) | |
Add a miscellaneous page. | |
addSubcategoryObject (Category $cat, $sortkey, $pageLength) | |
Add a subcategory to the internal lists, using a Category object. | |
clearCategoryState () | |
doCategoryQuery () | |
finaliseCategoryState () | |
formatList ( $articles, $articles_start_char, $cutoff=6) | |
Format a list of articles chunked by letter, either as a bullet list or a columnar format, depending on the length. | |
generateLink ( $type, Title $title, $isRedirect, $html=null) | |
getCategoryBottom () | |
getCategoryTop () | |
getHTML () | |
Format the category data list. | |
getImageSection () | |
getPagesSection () | |
getSubcategorySection () | |
getSubcategorySortChar ( $title, $sortkey) | |
Get the character to be used for sorting subcategories. | |
Public Member Functions inherited from 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. | |
getConfig () | |
getContext () | |
Get the base IContextSource object. | |
getLanguage () | |
getOutput () | |
getRequest () | |
getSkin () | |
getStats () | |
getTiming () | |
getTitle () | |
getUser () | |
getWikiPage () | |
Get the WikiPage object. | |
msg ( $key) | |
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) |
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 | |
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 |
Title | $title |
array | $until |
Protected Attributes | |
array | $prevPage |
Private Member Functions | |
addFragmentToTitle ( $title, $section) | |
Takes a title, and adds the fragment identifier that corresponds to the correct segment of the category. | |
getCountMessage ( $rescnt, $dbcnt, $type) | |
What to do if the category table conflicts with the number of results returned? This function says what. | |
getSectionPagingLinks ( $type) | |
Get the paging links for a section (subcats/pages/files), to go at the top and bottom of the output. | |
pagingLinks ( $first, $last, $type='') | |
Create paging links, as a helper method to getSectionPagingLinks(). | |
Private Attributes | |
Category | $cat |
Category object for this page. | |
array | $query |
The original query array, to be used in generating paging links. | |
Definition at line 24 of file CategoryViewer.php.
CategoryViewer::__construct | ( | $title, | |
IContextSource | $context, | ||
$from = [], | |||
$until = [], | |||
$query = [] ) |
Title | $title | |
IContextSource | $context | |
array | $from | An array with keys page, subcat, and file for offset of results of each section (since 1.17) |
array | $until | An array with 3 keys for until of each section (since 1.17) |
array | $query |
Definition at line 88 of file CategoryViewer.php.
References ContextSource\$context, $from, $query, $title, $until, IContextSource\getConfig(), ContextSource\getOutput(), ContextSource\setContext(), and Collation\singleton().
|
private |
Takes a title, and adds the fragment identifier that corresponds to the correct segment of the category.
Title | $title | The title (usually $this->title) |
string | $section | Which section |
MWException |
Definition at line 666 of file CategoryViewer.php.
References $section.
Referenced by pagingLinks().
CategoryViewer::addImage | ( | Title | $title, |
$sortkey, | |||
$pageLength, | |||
$isRedirect = false ) |
Add a page in the image namespace.
Title | $title | |
string | $sortkey | |
int | $pageLength | |
bool | $isRedirect |
Definition at line 242 of file CategoryViewer.php.
References $flip, and generateLink().
Referenced by doCategoryQuery().
CategoryViewer::addPage | ( | $title, | |
$sortkey, | |||
$pageLength, | |||
$isRedirect = false ) |
Add a miscellaneous page.
Title | $title | |
string | $sortkey | |
int | $pageLength | |
bool | $isRedirect |
Definition at line 265 of file CategoryViewer.php.
References generateLink().
Referenced by doCategoryQuery().
CategoryViewer::addSubcategoryObject | ( | Category | $cat, |
$sortkey, | |||
$pageLength ) |
Add a subcategory to the internal lists, using a Category object.
Category | $cat | |
string | $sortkey | |
int | $pageLength |
Reimplemented in CategoryTreeCategoryViewer.
Definition at line 180 of file CategoryViewer.php.
References $cat, generateLink(), getSubcategorySortChar(), Category\getTitle(), and Title\isRedirect().
Referenced by doCategoryQuery().
CategoryViewer::clearCategoryState | ( | ) |
Reimplemented in CategoryTreeCategoryViewer.
Definition at line 152 of file CategoryViewer.php.
References $e, ImageGalleryBase\factory(), ContextSource\getContext(), and ContextSource\getRequest().
Referenced by getHTML().
|
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.
TODO: Take the headers into account when creating columns, so they're more visually equal.
TODO: shortList and columnList are similar, need merging
string[] | $articles | HTML links to each article |
string[] | $articles_start_char | The header characters for each article |
Definition at line 559 of file CategoryViewer.php.
References $article, $articles, $articles_start_char, and $ret.
Referenced by formatList().
CategoryViewer::doCategoryQuery | ( | ) |
Definition at line 287 of file CategoryViewer.php.
References $cat, $dbr, $res, $type, addImage(), addPage(), addSubcategoryObject(), DB_REPLICA, false, NS_CATEGORY, NS_FILE, and wfGetDB().
Referenced by getHTML().
CategoryViewer::finaliseCategoryState | ( | ) |
Reimplemented in CategoryTreeCategoryViewer.
Definition at line 272 of file CategoryViewer.php.
Referenced by getHTML().
CategoryViewer::formatList | ( | $articles, | |
$articles_start_char, | |||
$cutoff = 6 ) |
Format a list of articles chunked by letter, either as a bullet list or a columnar format, depending on the length.
array | $articles | |
array | $articles_start_char | |
int | $cutoff |
Definition at line 528 of file CategoryViewer.php.
References $articles, $articles_start_char, $attribs, columnList(), and shortList().
Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().
CategoryViewer::generateLink | ( | $type, | |
Title | $title, | ||
$isRedirect, | |||
$html = null ) |
Definition at line 195 of file CategoryViewer.php.
References $html, $link, $linkRenderer, and $type.
Referenced by addImage(), addPage(), and addSubcategoryObject().
CategoryViewer::getCategoryBottom | ( | ) |
Definition at line 514 of file CategoryViewer.php.
Referenced by getCategoryTop(), and getHTML().
CategoryViewer::getCategoryTop | ( | ) |
Definition at line 392 of file CategoryViewer.php.
References getCategoryBottom().
Referenced by getHTML().
|
private |
What to do if the category table conflicts with the number of results returned? This function says what.
Each type is considered independently of the other types.
int | $rescnt | The number of items returned by our database query. |
int | $dbcnt | The number of items according to the category table. |
string | $type | 'subcat', 'article', or 'file' |
Definition at line 696 of file CategoryViewer.php.
References $type, and ContextSource\msg().
Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().
CategoryViewer::getHTML | ( | ) |
Format the category data list.
Definition at line 110 of file CategoryViewer.php.
References $attribs, $lang, clearCategoryState(), doCategoryQuery(), finaliseCategoryState(), getCategoryBottom(), getCategoryTop(), ContextSource\getConfig(), getImageSection(), ContextSource\getLanguage(), ContextSource\getOutput(), getPagesSection(), getSubcategorySection(), and ContextSource\msg().
CategoryViewer::getImageSection | ( | ) |
Definition at line 456 of file CategoryViewer.php.
References formatList(), getCountMessage(), ContextSource\getOutput(), getSectionPagingLinks(), and ContextSource\msg().
Referenced by getHTML().
CategoryViewer::getPagesSection | ( | ) |
Definition at line 426 of file CategoryViewer.php.
References formatList(), getCountMessage(), ContextSource\getOutput(), getSectionPagingLinks(), and ContextSource\msg().
Referenced by getHTML().
|
private |
Get the paging links for a section (subcats/pages/files), to go at the top and bottom of the output.
string | $type | 'page', 'subcat', or 'file' |
Definition at line 489 of file CategoryViewer.php.
References $type, and pagingLinks().
Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().
CategoryViewer::getSubcategorySection | ( | ) |
Definition at line 402 of file CategoryViewer.php.
References formatList(), getCountMessage(), getSectionPagingLinks(), and ContextSource\msg().
Referenced by getHTML().
CategoryViewer::getSubcategorySortChar | ( | $title, | |
$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...
Title | $title | |
string | $sortkey | The human-readable sortkey (before transforming to icu or whatever). |
Definition at line 223 of file CategoryViewer.php.
Referenced by CategoryTreeCategoryViewer\addSubcategoryObject(), and addSubcategoryObject().
|
private |
Create paging links, as a helper method to getSectionPagingLinks().
string | $first | The 'until' parameter for the generated URL |
string | $last | The 'from' parameter for the generated URL |
string | $type | A prefix for parameters, 'page' or 'subcat' or 'file' |
Definition at line 624 of file CategoryViewer.php.
References $last, $linkRenderer, $query, $type, addFragmentToTitle(), and ContextSource\msg().
Referenced by getSectionPagingLinks().
|
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).
string[] | $articles | HTML links to each article |
string[] | $articles_start_char | The header characters for each article |
Definition at line 600 of file CategoryViewer.php.
References $articles, and $articles_start_char.
Referenced by formatList().
string [] CategoryViewer::$articles |
Definition at line 35 of file CategoryViewer.php.
Referenced by columnList(), formatList(), and shortList().
array CategoryViewer::$articles_start_char |
Definition at line 38 of file CategoryViewer.php.
Referenced by columnList(), formatList(), and shortList().
|
private |
Category object for this page.
Definition at line 74 of file CategoryViewer.php.
Referenced by CategoryTreeCategoryViewer\addSubcategoryObject(), addSubcategoryObject(), and doCategoryQuery().
array CategoryViewer::$children |
Definition at line 41 of file CategoryViewer.php.
array CategoryViewer::$children_start_char |
Definition at line 44 of file CategoryViewer.php.
Collation CategoryViewer::$collation |
Definition at line 68 of file CategoryViewer.php.
array CategoryViewer::$flip |
Definition at line 62 of file CategoryViewer.php.
Referenced by addImage().
array CategoryViewer::$from |
Definition at line 29 of file CategoryViewer.php.
Referenced by __construct().
ImageGalleryBase CategoryViewer::$gallery |
Definition at line 71 of file CategoryViewer.php.
array CategoryViewer::$imgsNoGallery |
Definition at line 53 of file CategoryViewer.php.
array CategoryViewer::$imgsNoGallery_start_char |
Definition at line 50 of file CategoryViewer.php.
int CategoryViewer::$limit |
Definition at line 26 of file CategoryViewer.php.
array CategoryViewer::$nextPage |
Definition at line 56 of file CategoryViewer.php.
|
protected |
Definition at line 59 of file CategoryViewer.php.
|
private |
The original query array, to be used in generating paging links.
Definition at line 77 of file CategoryViewer.php.
Referenced by __construct(), and pagingLinks().
bool CategoryViewer::$showGallery |
Definition at line 47 of file CategoryViewer.php.
Title CategoryViewer::$title |
Definition at line 65 of file CategoryViewer.php.
Referenced by __construct().
array CategoryViewer::$until |
Definition at line 32 of file CategoryViewer.php.
Referenced by __construct().