MediaWiki
master
|
Public Member Functions | |
__construct ($title, IContextSource $context, $from=[], $until=[], $query=[]) | |
addImage (Title $title, $sortkey, $pageLength, $isRedirect=false) | |
Add a page in the image namespace. More... | |
addPage ($title, $sortkey, $pageLength, $isRedirect=false) | |
Add a miscellaneous page. More... | |
addSubcategoryObject (Category $cat, $sortkey, $pageLength) | |
Add a subcategory to the internal lists, using a Category object. More... | |
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. More... | |
generateLink ($type, Title $title, $isRedirect, $html=null) | |
getCategoryBottom () | |
getCategoryTop () | |
getHTML () | |
Format the category data list. More... | |
getImageSection () | |
getPagesSection () | |
getPrettyPageNameHtml () | |
Return pretty name which is display name if given and different from prefix text or the unprefixed page name. More... | |
getSubcategorySection () | |
getSubcategorySortChar ($title, $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... | |
getConfig () | |
Get the Config object. More... | |
getContext () | |
Get the base IContextSource object. More... | |
getLanguage () | |
Get the Language object. More... | |
getOutput () | |
Get the OutputPage object. More... | |
getRequest () | |
Get the WebRequest object. More... | |
getSkin () | |
Get the Skin object. More... | |
getStats () | |
Get the Stats object. More... | |
getTiming () | |
Get the Timing object. More... | |
getTitle () | |
Get the Title object. More... | |
getUser () | |
Get the User object. More... | |
getWikiPage () | |
Get the WikiPage object. More... | |
msg () | |
Get a Message object with context set Parameters are the same as wfMessage() More... | |
setContext (IContextSource $context) | |
Set the IContextSource object. More... | |
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. More... | |
static | shortList ($articles, $articles_start_char) |
Format a list of articles chunked by letter in a bullet list. More... | |
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. More... | |
getCountMessage ($rescnt, $dbcnt, $type) | |
What to do if the category table conflicts with the number of results returned? This function says what. More... | |
getSectionPagingLinks ($type) | |
Get the paging links for a section (subcats/pages/files), to go at the top and bottom of the output. More... | |
pagingLinks ($first, $last, $type= '') | |
Create paging links, as a helper method to getSectionPagingLinks(). More... | |
Private Attributes | |
Category | $cat |
Category object for this page. More... | |
array | $query |
The original query array, to be used in generating paging links. More... | |
Definition at line 23 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 87 of file CategoryViewer.php.
References $from, $query, $title, $until, from, IContextSource\getConfig(), ContextSource\getOutput(), Category\newFromTitle(), query, ContextSource\setContext(), Collation\singleton(), and title.
|
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 667 of file CategoryViewer.php.
References $section, $title, Title\getDBkey(), Title\getNamespace(), and Title\makeTitle().
Referenced by pagingLinks().
Add a page in the image namespace.
Title | $title | |
string | $sortkey | |
int | $pageLength | |
bool | $isRedirect |
Definition at line 240 of file CategoryViewer.php.
References $flip, $wgContLang, generateLink(), and global.
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 264 of file CategoryViewer.php.
References $title, $wgContLang, generateLink(), and global.
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 |
Definition at line 180 of file CategoryViewer.php.
References $title, generateLink(), getSubcategorySortChar(), Title\getText(), Category\getTitle(), and Title\isRedirect().
Referenced by doCategoryQuery().
CategoryViewer::clearCategoryState | ( | ) |
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 561 of file CategoryViewer.php.
References $article, $articles, $articles_start_char, $ret, as, Html\closeElement(), and Html\openElement().
CategoryViewer::doCategoryQuery | ( | ) |
Definition at line 288 of file CategoryViewer.php.
References $cat, $count, $dbr, $res, $title, $type, addImage(), addPage(), addSubcategoryObject(), as, DB_SLAVE, false, from, Title\getCategorySortkey(), Title\getNamespace(), Category\newFromRow(), Title\newFromRow(), NS_CATEGORY, NS_FILE, Hooks\run(), title, and wfGetDB().
Referenced by getHTML().
CategoryViewer::finaliseCategoryState | ( | ) |
Definition at line 273 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 530 of file CategoryViewer.php.
References $articles, $articles_start_char, $attribs, Html\rawElement(), and title.
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, $type, Linker\link(), and Hooks\run().
Referenced by addImage(), addPage(), and addSubcategoryObject().
CategoryViewer::getCategoryBottom | ( | ) |
Definition at line 516 of file CategoryViewer.php.
Referenced by getCategoryTop(), and getHTML().
CategoryViewer::getCategoryTop | ( | ) |
Definition at line 379 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 697 of file CategoryViewer.php.
References $cat, $type, DeferredUpdates\addCallableUpdate(), from, ContextSource\msg(), and use.
Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().
CategoryViewer::getHTML | ( | ) |
Format the category data list.
Definition at line 109 of file CategoryViewer.php.
References $attribs, $lang, clearCategoryState(), doCategoryQuery(), finaliseCategoryState(), getCategoryBottom(), getCategoryTop(), ContextSource\getConfig(), getImageSection(), ContextSource\getLanguage(), ContextSource\getOutput(), getPagesSection(), getSubcategorySection(), ContextSource\msg(), and Html\openElement().
CategoryViewer::getImageSection | ( | ) |
Definition at line 458 of file CategoryViewer.php.
References $name, formatList(), getCountMessage(), getPrettyPageNameHtml(), getSectionPagingLinks(), and ContextSource\msg().
Referenced by getHTML().
CategoryViewer::getPagesSection | ( | ) |
Definition at line 428 of file CategoryViewer.php.
References $name, formatList(), getCountMessage(), getPrettyPageNameHtml(), getSectionPagingLinks(), and ContextSource\msg().
Referenced by getHTML().
CategoryViewer::getPrettyPageNameHtml | ( | ) |
Return pretty name which is display name if given and different from prefix text or the unprefixed page name.
Definition at line 416 of file CategoryViewer.php.
References ContextSource\getOutput(), and ContextSource\getTitle().
Referenced by getImageSection(), and getPagesSection().
|
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 491 of file CategoryViewer.php.
References $type, from, and pagingLinks().
Referenced by getImageSection(), getPagesSection(), and getSubcategorySection().
CategoryViewer::getSubcategorySection | ( | ) |
Definition at line 389 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 219 of file CategoryViewer.php.
References $title, $wgContLang, Title\getDBkey(), Title\getPrefixedText(), and global.
Referenced by 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 626 of file CategoryViewer.php.
References $last, $query, $type, addFragmentToTitle(), Linker\linkKnown(), ContextSource\msg(), and title.
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 602 of file CategoryViewer.php.
References $articles, and $articles_start_char.
string [] CategoryViewer::$articles |
Definition at line 34 of file CategoryViewer.php.
Referenced by columnList(), formatList(), and shortList().
array CategoryViewer::$articles_start_char |
Definition at line 37 of file CategoryViewer.php.
Referenced by columnList(), formatList(), and shortList().
|
private |
Category object for this page.
Definition at line 73 of file CategoryViewer.php.
Referenced by doCategoryQuery(), and getCountMessage().
array CategoryViewer::$children |
Definition at line 40 of file CategoryViewer.php.
array CategoryViewer::$children_start_char |
Definition at line 43 of file CategoryViewer.php.
Collation CategoryViewer::$collation |
Definition at line 67 of file CategoryViewer.php.
array CategoryViewer::$flip |
Definition at line 61 of file CategoryViewer.php.
Referenced by addImage().
array CategoryViewer::$from |
Definition at line 28 of file CategoryViewer.php.
Referenced by __construct().
ImageGallery CategoryViewer::$gallery |
Definition at line 70 of file CategoryViewer.php.
array CategoryViewer::$imgsNoGallery |
Definition at line 52 of file CategoryViewer.php.
array CategoryViewer::$imgsNoGallery_start_char |
Definition at line 49 of file CategoryViewer.php.
int CategoryViewer::$limit |
Definition at line 25 of file CategoryViewer.php.
array CategoryViewer::$nextPage |
Definition at line 55 of file CategoryViewer.php.
|
protected |
Definition at line 58 of file CategoryViewer.php.
|
private |
The original query array, to be used in generating paging links.
Definition at line 76 of file CategoryViewer.php.
Referenced by __construct(), and pagingLinks().
bool CategoryViewer::$showGallery |
Definition at line 46 of file CategoryViewer.php.
Title CategoryViewer::$title |
Definition at line 64 of file CategoryViewer.php.
Referenced by __construct(), addFragmentToTitle(), addPage(), addSubcategoryObject(), doCategoryQuery(), and getSubcategorySortChar().
array CategoryViewer::$until |
Definition at line 31 of file CategoryViewer.php.
Referenced by __construct().