MediaWiki master
CategoryViewer.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Category;
24
25use Collation;
28use InvalidArgumentException;
32use MediaWiki\Debug\DeprecationHelper;
33use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
46
48 use ProtectedHookAccessorTrait;
49 use DeprecationHelper;
50
52 public $limit;
53
55 public $from;
56
58 public $until;
59
61 public $articles;
62
65
67 public $children;
68
71
74
77
80
82 public $nextPage;
83
85 protected $prevPage;
86
88 public $flip;
89
91 protected $page;
92
94 public $collation;
95
97 public $gallery;
98
100 private $cat;
101
103 private $query;
104
106 private $languageConverter;
107
108 private int $migrationStage;
109
119 public function __construct( PageIdentity $page, IContextSource $context, array $from = [],
120 array $until = [], array $query = []
121 ) {
122 $this->page = $page;
123
124 $this->deprecatePublicPropertyFallback(
125 'title',
126 '1.37',
127 function (): Title {
128 return Title::newFromPageIdentity( $this->page );
129 },
130 function ( PageIdentity $page ) {
131 $this->page = $page;
132 }
133 );
134
135 $this->setContext( $context );
136 $this->getOutput()->addModuleStyles( [
137 'mediawiki.action.styles',
138 ] );
139 $this->from = $from;
140 $this->until = $until;
141 $this->limit = $context->getConfig()->get( MainConfigNames::CategoryPagingLimit );
142 $this->migrationStage = $context->getConfig()->get( MainConfigNames::CategoryLinksSchemaMigrationStage );
143 $this->cat = Category::newFromTitle( $page );
144 $this->query = $query;
145 $this->collation = MediaWikiServices::getInstance()->getCollationFactory()->getCategoryCollation();
146 $this->languageConverter = MediaWikiServices::getInstance()
147 ->getLanguageConverterFactory()->getLanguageConverter();
148 unset( $this->query['title'] );
149 }
150
156 public function getHTML() {
157 $this->showGallery = $this->getConfig()->get( MainConfigNames::CategoryMagicGallery )
158 && !$this->getOutput()->getOutputFlag( ParserOutputFlags::NO_GALLERY );
159
160 $this->clearCategoryState();
161 $this->doCategoryQuery();
162 $this->finaliseCategoryState();
163
164 $html = $this->getSubcategorySection() .
165 $this->getPagesSection() .
166 $this->getImageSection();
167
168 if ( $html == '' ) {
169 // If there is no category content to display, only
170 // show the top part of the navigation links.
171 // @todo FIXME: Cannot be completely suppressed because it
172 // is unknown if 'until' or 'from' makes this
173 // give 0 results.
174 $html = $this->getCategoryTop();
175 } else {
176 $html = $this->getCategoryTop() .
177 $html .
178 $this->getCategoryBottom();
179 }
180
181 // Give a proper message if category is empty
182 if ( $html == '' ) {
183 $html = $this->msg( 'category-empty' )->parseAsBlock();
184 }
185
186 $lang = $this->getLanguage();
187 $attribs = [
188 'class' => 'mw-category-generated',
189 'lang' => $lang->getHtmlCode(),
190 'dir' => $lang->getDir()
191 ];
192 # put a div around the headings which are in the user language
193 $html = Html::rawElement( 'div', $attribs, $html );
194
195 return $html;
196 }
197
198 protected function clearCategoryState() {
199 $this->articles = [];
200 $this->articles_start_char = [];
201 $this->children = [];
202 $this->children_start_char = [];
203 if ( $this->showGallery ) {
204 // Note that null for mode is taken to mean use default.
205 $mode = $this->getRequest()->getVal( 'gallerymode', null );
206 try {
207 $this->gallery = ImageGalleryBase::factory( $mode, $this->getContext() );
208 } catch ( ImageGalleryClassNotFoundException ) {
209 // User specified something invalid, fallback to default.
210 $this->gallery = ImageGalleryBase::factory( false, $this->getContext() );
211 }
212
213 $this->gallery->setHideBadImages();
214 } else {
215 $this->imgsNoGallery = [];
216 $this->imgsNoGallery_start_char = [];
217 }
218 }
219
226 public function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
227 $page = $cat->getPage();
228 if ( !$page ) {
229 return;
230 }
231
232 // Subcategory; strip the 'Category' namespace from the link text.
233 $pageRecord = MediaWikiServices::getInstance()->getPageStore()
234 ->getPageByReference( $page );
235 if ( !$pageRecord ) {
236 return;
237 }
238
239 $this->children[] = $this->generateLink(
240 'subcat',
241 $pageRecord,
242 $pageRecord->isRedirect(),
243 htmlspecialchars( str_replace( '_', ' ', $pageRecord->getDBkey() ) )
244 );
245
246 $this->children_start_char[] =
247 $this->getSubcategorySortChar( $page, $sortkey );
248 }
249
261 private function generateLink(
262 string $type, PageReference $page, bool $isRedirect, ?string $html = null
263 ): string {
264 $link = null;
265 $legacyTitle = MediaWikiServices::getInstance()->getTitleFactory()
266 ->newFromPageReference( $page );
267 // @phan-suppress-next-line PhanTypeMismatchArgument Type mismatch on pass-by-ref args
268 $this->getHookRunner()->onCategoryViewer__generateLink( $type, $legacyTitle, $html, $link );
269 if ( $link === null ) {
270 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
271 if ( $html !== null ) {
272 $html = new HtmlArmor( $html );
273 }
274 $link = $linkRenderer->makeLink( $page, $html );
275 }
276 if ( $isRedirect ) {
277 $link = Html::rawElement(
278 'span',
279 [ 'class' => 'redirect-in-category' ],
280 $link
281 );
282 }
283
284 return $link;
285 }
286
298 public function getSubcategorySortChar( PageIdentity $page, string $sortkey ): string {
299 $titleText = MediaWikiServices::getInstance()->getTitleFormatter()
300 ->getPrefixedText( $page );
301 if ( $titleText === $sortkey ) {
302 $word = $page->getDBkey();
303 } else {
304 $word = $sortkey;
305 }
306
307 $firstChar = $this->collation->getFirstLetter( $word );
308
309 return $this->languageConverter->convert( $firstChar );
310 }
311
319 public function addImage(
320 PageReference $page, string $sortkey, int $pageLength, bool $isRedirect = false
321 ): void {
322 $title = MediaWikiServices::getInstance()->getTitleFactory()
323 ->newFromPageReference( $page );
324 if ( $this->showGallery ) {
325 $flip = $this->flip['file'];
326 if ( $flip ) {
327 $this->gallery->insert( $title, '', '', '', [], ImageGalleryBase::LOADING_LAZY );
328 } else {
329 $this->gallery->add( $title, '', '', '', [], ImageGalleryBase::LOADING_LAZY );
330 }
331 } else {
332 $this->imgsNoGallery[] = $this->generateLink( 'image', $page, $isRedirect );
333
334 $this->imgsNoGallery_start_char[] =
335 $this->languageConverter->convert( $this->collation->getFirstLetter( $sortkey ) );
336 }
337 }
338
346 public function addPage(
347 PageReference $page,
348 string $sortkey,
349 int $pageLength,
350 bool $isRedirect = false
351 ): void {
352 $this->articles[] = $this->generateLink( 'page', $page, $isRedirect );
353
354 $this->articles_start_char[] =
355 $this->languageConverter->convert( $this->collation->getFirstLetter( $sortkey ) );
356 }
357
358 protected function finaliseCategoryState() {
359 if ( $this->flip['subcat'] ) {
360 $this->children = array_reverse( $this->children );
361 $this->children_start_char = array_reverse( $this->children_start_char );
362 }
363 if ( $this->flip['page'] ) {
364 $this->articles = array_reverse( $this->articles );
365 $this->articles_start_char = array_reverse( $this->articles_start_char );
366 }
367 if ( !$this->showGallery && $this->flip['file'] ) {
368 $this->imgsNoGallery = array_reverse( $this->imgsNoGallery );
369 $this->imgsNoGallery_start_char = array_reverse( $this->imgsNoGallery_start_char );
370 }
371 }
372
373 protected function doCategoryQuery() {
374 $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
375
376 $this->nextPage = [
377 'page' => null,
378 'subcat' => null,
379 'file' => null,
380 ];
381 $this->prevPage = [
382 'page' => null,
383 'subcat' => null,
384 'file' => null,
385 ];
386
387 $this->flip = [ 'page' => false, 'subcat' => false, 'file' => false ];
388
389 foreach ( [ 'page', 'subcat', 'file' ] as $type ) {
390 # Get the sortkeys for start/end, if applicable. Note that if
391 # the collation in the database differs from the one
392 # set in $wgCategoryCollation, pagination might go totally haywire.
393 $extraConds = [ 'cl_type' => $type ];
394 if ( isset( $this->from[$type] ) ) {
395 $extraConds[] = $dbr->expr(
396 'cl_sortkey',
397 '>=',
398 $this->collation->getSortKey( $this->from[$type] )
399 );
400 } elseif ( isset( $this->until[$type] ) ) {
401 $extraConds[] = $dbr->expr(
402 'cl_sortkey',
403 '<',
404 $this->collation->getSortKey( $this->until[$type] )
405 );
406 $this->flip[$type] = true;
407 }
408
409 $queryBuilder = $dbr->newSelectQueryBuilder();
410 $queryBuilder->select( array_merge(
411 LinkCache::getSelectFields(),
412 [
413 'cl_sortkey',
414 'cat_id',
415 'cat_title',
416 'cat_subcats',
417 'cat_pages',
418 'cat_files',
419 'cl_sortkey_prefix',
420 ]
421 ) )
422 ->from( 'page' )
423 ->andWhere( $extraConds );
424
425 if ( $this->flip[$type] ) {
426 $queryBuilder->orderBy( 'cl_sortkey', SelectQueryBuilder::SORT_DESC );
427 } else {
428 $queryBuilder->orderBy( 'cl_sortkey' );
429 }
430
431 $queryBuilder
432 ->join( 'categorylinks', null, [ 'cl_from = page_id' ] )
433 ->leftJoin( 'category', null, [
434 'cat_title = page_title',
435 'page_namespace' => NS_CATEGORY
436 ] )
437 ->limit( $this->limit + 1 );
438 if ( $this->migrationStage & SCHEMA_COMPAT_READ_OLD ) {
439 $queryBuilder->where( [ 'cl_to' => $this->page->getDBkey() ] )
440 ->field( 'cl_collation' )
441 ->useIndex( [ 'categorylinks' => 'cl_sortkey' ] );
442 } else {
443 $queryBuilder->join( 'linktarget', null, 'cl_target_id = lt_id' )
444 ->where( [ 'lt_title' => $this->page->getDBkey(), 'lt_namespace' => NS_CATEGORY ] );
445
446 $queryBuilder->straightJoin( 'collation', null, 'cl_collation_id = collation_id' )
447 ->field( 'collation_name', 'cl_collation' );
448
449 $queryBuilder->useIndex( [ 'categorylinks' => 'cl_sortkey_id' ] );
450 }
451
452 $res = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
453
454 $this->getHookRunner()->onCategoryViewer__doCategoryQuery( $type, $res );
455 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
456
457 $count = 0;
458 foreach ( $res as $row ) {
459 $title = Title::newFromRow( $row );
460 $linkCache->addGoodLinkObjFromRow( $title, $row );
461
462 if ( $row->cl_collation === '' ) {
463 // Hack to make sure that while updating from 1.16 schema
464 // and db is inconsistent, that the sky doesn't fall.
465 // See r83544. Could perhaps be removed in a couple decades...
466 $humanSortkey = $row->cl_sortkey;
467 } else {
468 $humanSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
469 }
470
471 if ( ++$count > $this->limit ) {
472 # We've reached the one extra which shows that there
473 # are additional pages to be had. Stop here...
474 $this->nextPage[$type] = $humanSortkey;
475 break;
476 }
477 if ( $count == $this->limit ) {
478 $this->prevPage[$type] = $humanSortkey;
479 }
480
481 if ( $title->getNamespace() === NS_CATEGORY ) {
482 $cat = Category::newFromRow( $row, $title );
483 $this->addSubcategoryObject( $cat, $humanSortkey, $row->page_len );
484 } elseif ( $title->getNamespace() === NS_FILE ) {
485 $this->addImage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
486 } else {
487 $this->addPage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
488 }
489 }
490 }
491 }
492
496 protected function getCategoryTop() {
497 $html = $this->getCategoryBottom();
498 return $html === ''
499 ? $html
500 : "<br style=\"clear:both;\"/>\n" . $html;
501 }
502
506 protected function getSubcategorySection() {
507 # Don't show subcategories section if there are none.
508 $html = '';
509 $localCount = count( $this->children );
510 $databaseCount = $this->cat->getSubcatCount();
511 // This function should be called even if the result isn't used, it has side-effects
512 $countMessage = $this->getCountMessage( $localCount, $databaseCount, 'subcat' );
513
514 if ( $localCount > 0 ) {
515 $html .= Html::openElement( 'div', [ 'id' => 'mw-subcategories' ] ) . "\n";
516 $html .= Html::rawElement( 'h2', [], $this->msg( 'subcategories' )->parse() ) . "\n";
517 $html .= $countMessage;
518 $html .= $this->getSectionPagingLinks( 'subcat' );
519 $html .= $this->formatList( $this->children, $this->children_start_char );
520 $html .= $this->getSectionPagingLinks( 'subcat' );
521 $html .= "\n" . Html::closeElement( 'div' );
522 }
523 return $html;
524 }
525
529 protected function getPagesSection() {
530 $name = $this->getOutput()->getUnprefixedDisplayTitle();
531 # Don't show articles section if there are none.
532 $html = '';
533
534 # @todo FIXME: Here and in the other two sections: we don't need to bother
535 # with this rigmarole if the entire category contents fit on one page
536 # and have already been retrieved. We can just use $rescnt in that
537 # case and save a query and some logic.
538 $databaseCount = $this->cat->getPageCount( Category::COUNT_CONTENT_PAGES );
539 $localCount = count( $this->articles );
540 // This function should be called even if the result isn't used, it has side-effects
541 $countMessage = $this->getCountMessage( $localCount, $databaseCount, 'article' );
542
543 if ( $localCount > 0 ) {
544 $html .= Html::openElement( 'div', [ 'id' => 'mw-pages' ] ) . "\n";
545 $html .= Html::rawElement(
546 'h2',
547 [],
548 $this->msg( 'category_header' )->rawParams( $name )->parse()
549 ) . "\n";
550 $html .= $countMessage;
551 $html .= $this->getSectionPagingLinks( 'page' );
552 $html .= $this->formatList( $this->articles, $this->articles_start_char );
553 $html .= $this->getSectionPagingLinks( 'page' );
554 $html .= "\n" . Html::closeElement( 'div' );
555 }
556 return $html;
557 }
558
562 protected function getImageSection() {
563 $name = $this->getOutput()->getUnprefixedDisplayTitle();
564 $html = '';
565 $localCount = $this->showGallery ?
566 $this->gallery->count() :
567 count( $this->imgsNoGallery ?? [] );
568 $databaseCount = $this->cat->getFileCount();
569 // This function should be called even if the result isn't used, it has side-effects
570 $countMessage = $this->getCountMessage( $localCount, $databaseCount, 'file' );
571
572 if ( $localCount > 0 ) {
573 $html .= Html::openElement( 'div', [ 'id' => 'mw-category-media' ] ) . "\n";
574 $html .= Html::rawElement(
575 'h2',
576 [],
577 $this->msg( 'category-media-header' )->rawParams( $name )->parse()
578 ) . "\n";
579 $html .= $countMessage;
580 $html .= $this->getSectionPagingLinks( 'file' );
581 if ( $this->showGallery ) {
582 $html .= $this->gallery->toHTML();
583 } else {
584 $html .= $this->formatList( $this->imgsNoGallery, $this->imgsNoGallery_start_char );
585 }
586 $html .= $this->getSectionPagingLinks( 'file' );
587 $html .= "\n" . Html::closeElement( 'div' );
588 }
589 return $html;
590 }
591
599 private function getSectionPagingLinks( $type ) {
600 if ( isset( $this->until[$type] ) ) {
601 // The new value for the until parameter should be pointing to the first
602 // result displayed on the page which is the second last result retrieved
603 // from the database.The next link should have a from parameter pointing
604 // to the until parameter of the current page.
605 if ( $this->nextPage[$type] !== null ) {
606 return $this->pagingLinks(
607 $this->prevPage[$type] ?? '',
608 $this->until[$type],
609 $type
610 );
611 }
612
613 // If the nextPage variable is null, it means that we have reached the first page
614 // and therefore the previous link should be disabled.
615 return $this->pagingLinks(
616 '',
617 $this->until[$type],
618 $type
619 );
620 } elseif ( $this->nextPage[$type] !== null || isset( $this->from[$type] ) ) {
621 return $this->pagingLinks(
622 $this->from[$type] ?? '',
623 $this->nextPage[$type],
624 $type
625 );
626 }
627
628 return '';
629 }
630
634 protected function getCategoryBottom() {
635 return '';
636 }
637
648 private function formatList( $articles, $articles_start_char, $cutoff = 6 ) {
649 $list = '';
650 if ( count( $articles ) > $cutoff ) {
651 $list = self::columnList( $articles, $articles_start_char );
652 } elseif ( count( $articles ) > 0 ) {
653 // for short lists of articles in categories.
654 $list = self::shortList( $articles, $articles_start_char );
655 }
656
657 $pageLang = MediaWikiServices::getInstance()->getTitleFactory()
658 ->newFromPageIdentity( $this->page )
659 ->getPageLanguage();
660 $attribs = [ 'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(),
661 'class' => 'mw-content-' . $pageLang->getDir() ];
662 $list = Html::rawElement( 'div', $attribs, $list );
663
664 return $list;
665 }
666
677 public static function columnList(
678 $articles,
679 $articles_start_char,
680 $cssClasses = 'mw-category mw-category-columns'
681 ) {
682 $columns = array_combine( $articles, $articles_start_char );
683
684 $ret = Html::openElement( 'div', [ 'class' => $cssClasses ] );
685
686 $colContents = [];
687
688 # Kind of like array_flip() here, but we keep duplicates in an
689 # array instead of dropping them.
690 foreach ( $columns as $article => $char ) {
691 $colContents[$char][] = $article;
692 }
693
694 foreach ( $colContents as $char => $articles ) {
695 # Change space to non-breaking space to keep headers aligned
696 $h3char = $char === ' ' ? "\u{00A0}" : htmlspecialchars( $char );
697
698 $ret .= Html::openElement( 'div', [ 'class' => 'mw-category-group' ] );
699 $ret .= Html::rawElement( 'h3', [], $h3char ) . "\n";
700 $ret .= Html::openElement( 'ul' );
701 $ret .= implode(
702 "\n",
703 array_map(
704 static function ( $article ) {
705 return Html::rawElement( 'li', [], $article );
706 },
707 $articles
708 )
709 );
710 $ret .= Html::closeElement( 'ul' ) . Html::closeElement( 'div' );
711
712 }
713
714 $ret .= Html::closeElement( 'div' );
715 return $ret;
716 }
717
726 public static function shortList( $articles, $articles_start_char ) {
727 return self::columnList( $articles, $articles_start_char, 'mw-category' );
728 }
729
739 private function pagingLinks( $first, $last, $type = '' ) {
740 $prevLink = $this->msg( 'prev-page' )->escaped();
741
742 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
743 if ( $first != '' ) {
744 $prevQuery = $this->query;
745 $prevQuery["{$type}until"] = $first;
746 unset( $prevQuery["{$type}from"] );
747 $prevLink = $linkRenderer->makeKnownLink(
748 $this->addFragmentToTitle( $this->page, $type ),
749 new HtmlArmor( $prevLink ),
750 [],
751 $prevQuery
752 );
753 }
754
755 $nextLink = $this->msg( 'next-page' )->escaped();
756
757 if ( $last != '' ) {
758 $lastQuery = $this->query;
759 $lastQuery["{$type}from"] = $last;
760 unset( $lastQuery["{$type}until"] );
761 $nextLink = $linkRenderer->makeKnownLink(
762 $this->addFragmentToTitle( $this->page, $type ),
763 new HtmlArmor( $nextLink ),
764 [],
765 $lastQuery
766 );
767 }
768
769 return $this->msg( 'categoryviewer-pagedlinks' )->rawParams( $prevLink, $nextLink )->escaped();
770 }
771
780 private function addFragmentToTitle( PageReference $page, string $section ): LinkTarget {
781 switch ( $section ) {
782 case 'page':
783 $fragment = 'mw-pages';
784 break;
785 case 'subcat':
786 $fragment = 'mw-subcategories';
787 break;
788 case 'file':
789 $fragment = 'mw-category-media';
790 break;
791 default:
792 throw new InvalidArgumentException( __METHOD__ .
793 " Invalid section $section." );
794 }
795
796 return new TitleValue( $page->getNamespace(),
797 $page->getDBkey(), $fragment );
798 }
799
810 private function getCountMessage( $localCount, $databaseCount, $type ) {
811 // There are three cases:
812 // 1) The category table figure seems good. It might be wrong, but
813 // we can't do anything about it if we don't recalculate it on ev-
814 // ery category view.
815 // 2) The category table figure isn't good, like it's smaller than the
816 // number of actual results, *but* the number of results is less
817 // than $this->limit and there's no offset. In this case we still
818 // know the right figure.
819 // 3) We have no idea.
820
821 // Check if there's a "from" or "until" for anything
822
823 // This is a little ugly, but we seem to use different names
824 // for the paging types then for the messages.
825 if ( $type === 'article' ) {
826 $pagingType = 'page';
827 } else {
828 $pagingType = $type;
829 }
830
831 $fromOrUntil = false;
832 if ( isset( $this->from[$pagingType] ) || isset( $this->until[$pagingType] ) ) {
833 $fromOrUntil = true;
834 }
835
836 if ( $databaseCount == $localCount ||
837 ( ( $localCount == $this->limit || $fromOrUntil ) && $databaseCount > $localCount )
838 ) {
839 // Case 1: seems good.
840 $totalCount = $databaseCount;
841 } elseif ( $localCount < $this->limit && !$fromOrUntil ) {
842 // Case 2: not good, but salvageable. Use the number of results.
843 $totalCount = $localCount;
844 } else {
845 // Case 3: hopeless. Don't give a total count at all.
846 // Messages: category-subcat-count-limited, category-article-count-limited,
847 // category-file-count-limited
848 return $this->msg( "category-$type-count-limited" )->numParams( $localCount )->parseAsBlock();
849 }
850 // Messages: category-subcat-count, category-article-count, category-file-count
851 return $this->msg( "category-$type-count" )->numParams( $localCount, $totalCount )->parseAsBlock();
852 }
853}
const NS_FILE
Definition Defines.php:71
const SCHEMA_COMPAT_READ_OLD
Definition Defines.php:304
const NS_CATEGORY
Definition Defines.php:79
static factory( $mode=false, ?IContextSource $context=null)
Get a new image gallery.
Class for exceptions thrown by ImageGalleryBase::factory().
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition LinkCache.php:52
getHTML()
Format the category data list.
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.
addImage(PageReference $page, string $sortkey, int $pageLength, bool $isRedirect=false)
Add a page in the image namespace.
getSubcategorySortChar(PageIdentity $page, string $sortkey)
Get the character to be used for sorting subcategories.
addSubcategoryObject(Category $cat, $sortkey, $pageLength)
Add a subcategory to the internal lists, using a Category object.
__construct(PageIdentity $page, IContextSource $context, array $from=[], array $until=[], array $query=[])
addPage(PageReference $page, string $sortkey, int $pageLength, bool $isRedirect=false)
Add a miscellaneous page.
Category objects are immutable, strictly speaking.
Definition Category.php:44
static newFromTitle(PageIdentity $page)
Factory function.
Definition Category.php:196
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
setContext(IContextSource $context)
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
getContext()
Get the base IContextSource object.
This class is a collection of static functions that serve two purposes:
Definition Html.php:57
A class containing constants representing the names of configuration variables.
const CategoryLinksSchemaMigrationStage
Name constant for the CategoryLinksSchemaMigrationStage setting, for use with Config::get()
const CategoryPagingLimit
Name constant for the CategoryPagingLimit setting, for use with Config::get()
const CategoryMagicGallery
Name constant for the CategoryMagicGallery setting, for use with Config::get()
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
Represents the target of a wiki link.
Represents a title within MediaWiki.
Definition Title.php:78
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:32
Build SELECT queries with a fluent interface.
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.
The shared interface for all language converters.
Represents the target of a wiki link.
Interface for objects (potentially) representing an editable wiki page.
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
getNamespace()
Returns the page's namespace number.
getDBkey()
Get the page title in DB key form.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...