MediaWiki REL1_33
CategoryTree.php
Go to the documentation of this file.
1<?php
30 public $mOptions = [];
31
36 public function __construct( array $options ) {
38
39 // ensure default values and order of options.
40 // Order may become important, it may influence the cache key!
41 foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) {
42 if ( isset( $options[$option] ) ) {
43 $this->mOptions[$option] = $options[$option];
44 } else {
45 $this->mOptions[$option] = $default;
46 }
47 }
48
49 $this->mOptions['mode'] = self::decodeMode( $this->mOptions['mode'] );
50
51 if ( $this->mOptions['mode'] == CategoryTreeMode::PARENTS ) {
52 // namespace filter makes no sense with CategoryTreeMode::PARENTS
53 $this->mOptions['namespaces'] = false;
54 }
55
56 $this->mOptions['hideprefix'] = self::decodeHidePrefix( $this->mOptions['hideprefix'] );
57 $this->mOptions['showcount'] = self::decodeBoolean( $this->mOptions['showcount'] );
58 $this->mOptions['namespaces'] = self::decodeNamespaces( $this->mOptions['namespaces'] );
59
60 if ( $this->mOptions['namespaces'] ) {
61 # automatically adjust mode to match namespace filter
62 if ( count( $this->mOptions['namespaces'] ) === 1
63 && $this->mOptions['namespaces'][0] == NS_CATEGORY ) {
64 $this->mOptions['mode'] = CategoryTreeMode::CATEGORIES;
65 } elseif ( !in_array( NS_FILE, $this->mOptions['namespaces'] ) ) {
66 $this->mOptions['mode'] = CategoryTreeMode::PAGES;
67 } else {
68 $this->mOptions['mode'] = CategoryTreeMode::ALL;
69 }
70 }
71 }
72
77 public function getOption( $name ) {
78 return $this->mOptions[$name];
79 }
80
84 private function isInverse() {
85 return $this->getOption( 'mode' ) == CategoryTreeMode::PARENTS;
86 }
87
92 private static function decodeNamespaces( $nn ) {
93 global $wgContLang;
94
95 if ( $nn === false || is_null( $nn ) ) {
96 return false;
97 }
98
99 if ( !is_array( $nn ) ) {
100 $nn = preg_split( '![\s#:|]+!', $nn );
101 }
102
103 $namespaces = [];
104
105 foreach ( $nn as $n ) {
106 if ( is_int( $n ) ) {
107 $ns = $n;
108 } else {
109 $n = trim( $n );
110 if ( $n === '' ) {
111 continue;
112 }
113
114 $lower = strtolower( $n );
115
116 if ( is_numeric( $n ) ) {
117 $ns = (int)$n;
118 } elseif ( $n == '-' || $n == '_' || $n == '*' || $lower == 'main' ) {
119 $ns = NS_MAIN;
120 } else {
121 $ns = $wgContLang->getNsIndex( $n );
122 }
123 }
124
125 if ( is_int( $ns ) ) {
126 $namespaces[] = $ns;
127 }
128 }
129
130 # get elements into canonical order
131 sort( $namespaces );
132 return $namespaces;
133 }
134
139 public static function decodeMode( $mode ) {
141
142 if ( is_null( $mode ) ) {
143 return $wgCategoryTreeDefaultOptions['mode'];
144 }
145 if ( is_int( $mode ) ) {
146 return $mode;
147 }
148
149 $mode = trim( strtolower( $mode ) );
150
151 if ( is_numeric( $mode ) ) {
152 return (int)$mode;
153 }
154
155 if ( $mode == 'all' ) {
156 $mode = CategoryTreeMode::ALL;
157 } elseif ( $mode == 'pages' ) {
159 } elseif ( $mode == 'categories' || $mode == 'sub' ) {
161 } elseif ( $mode == 'parents' || $mode == 'super' || $mode == 'inverse' ) {
163 } elseif ( $mode == 'default' ) {
164 $mode = $wgCategoryTreeDefaultOptions['mode'];
165 }
166
167 return (int)$mode;
168 }
169
176 public static function decodeBoolean( $value ) {
177 if ( is_null( $value ) ) {
178 return null;
179 }
180 if ( is_bool( $value ) ) {
181 return $value;
182 }
183 if ( is_int( $value ) ) {
184 return ( $value > 0 );
185 }
186
188 if ( is_numeric( $value ) ) {
189 return ( (int)$value > 0 );
190 }
191
192 if ( $value == 'yes' || $value == 'y'
193 || $value == 'true' || $value == 't' || $value == 'on'
194 ) {
195 return true;
196 } elseif ( $value == 'no' || $value == 'n'
197 || $value == 'false' || $value == 'f' || $value == 'off'
198 ) {
199 return false;
200 } elseif ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) {
201 return null;
202 } else {
203 return false;
204 }
205 }
206
211 public static function decodeHidePrefix( $value ) {
213
214 if ( is_null( $value ) ) {
215 return $wgCategoryTreeDefaultOptions['hideprefix'];
216 }
217 if ( is_int( $value ) ) {
218 return $value;
219 }
220 if ( $value === true ) {
222 }
223 if ( $value === false ) {
225 }
226
228
229 if ( $value == 'yes' || $value == 'y'
230 || $value == 'true' || $value == 't' || $value == 'on'
231 ) {
233 } elseif ( $value == 'no' || $value == 'n'
234 || $value == 'false' || $value == 'f' || $value == 'off'
235 ) {
237 } elseif ( $value == 'always' ) {
239 } elseif ( $value == 'never' ) {
241 } elseif ( $value == 'auto' ) {
243 } elseif ( $value == 'categories' || $value == 'category' || $value == 'smart' ) {
245 } else {
246 return $wgCategoryTreeDefaultOptions['hideprefix'];
247 }
248 }
249
254 public static function setHeaders( OutputPage $outputPage ) {
255 # Add the modules
256 $outputPage->addModuleStyles( 'ext.categoryTree.styles' );
257 $outputPage->addModules( 'ext.categoryTree' );
258 }
259
266 protected static function encodeOptions( array $options, $enc ) {
267 if ( $enc == 'mode' || $enc == '' ) {
268 $opt = $options['mode'];
269 } elseif ( $enc == 'json' ) {
270 $opt = FormatJson::encode( $options );
271 } else {
272 throw new Exception( 'Unknown encoding for CategoryTree options: ' . $enc );
273 }
274
275 return $opt;
276 }
277
282 public function getOptionsAsCacheKey( $depth = null ) {
283 $key = "";
284
285 foreach ( $this->mOptions as $k => $v ) {
286 if ( is_array( $v ) ) {
287 $v = implode( '|', $v );
288 }
289 $key .= $k . ':' . $v . ';';
290 }
291
292 if ( !is_null( $depth ) ) {
293 $key .= ";depth=" . $depth;
294 }
295 return $key;
296 }
297
302 public function getOptionsAsJsStructure( $depth = null ) {
303 if ( $depth !== null ) {
305 $opt['depth'] = $depth;
306 $s = self::encodeOptions( $opt, 'json' );
307 } else {
308 $s = self::encodeOptions( $this->mOptions, 'json' );
309 }
310
311 return $s;
312 }
313
317 private function getOptionsAsUrlParameters() {
318 return http_build_query( $this->mOptions );
319 }
320
333 public function getTag( Parser $parser = null, $category, $hideroot = false, array $attr = [],
334 $depth = 1, $allowMissing = false
335 ) {
337
338 $category = trim( $category );
339 if ( $category === '' ) {
340 return false;
341 }
342
343 if ( $parser ) {
344 if ( $wgCategoryTreeDisableCache === true ) {
345 $parser->disableCache();
346 } elseif ( is_int( $wgCategoryTreeDisableCache ) ) {
347 $parser->getOutput()->updateCacheExpiry( $wgCategoryTreeDisableCache );
348 }
349 }
350
351 $title = self::makeTitle( $category );
352
353 if ( $title === false || $title === null ) {
354 return false;
355 }
356
357 if ( isset( $attr['class'] ) ) {
358 $attr['class'] .= ' CategoryTreeTag';
359 } else {
360 $attr['class'] = ' CategoryTreeTag';
361 }
362
363 $attr['data-ct-mode'] = $this->mOptions['mode'];
364 $attr['data-ct-options'] = $this->getOptionsAsJsStructure();
365
366 $html = '';
367 $html .= Html::openElement( 'div', $attr );
368
369 if ( !$allowMissing && !$title->getArticleID() ) {
370 $html .= Html::openElement( 'span', [ 'class' => 'CategoryTreeNotice' ] );
371 if ( $parser ) {
372 $html .= $parser->recursiveTagParse(
373 wfMessage( 'categorytree-not-found', $category )->plain() );
374 } else {
375 $html .= wfMessage( 'categorytree-not-found', $category )->parse();
376 }
377 $html .= Html::closeElement( 'span' );
378 } else {
379 if ( !$hideroot ) {
380 $html .= $this->renderNode( $title, $depth );
381 } else {
382 $html .= $this->renderChildren( $title, $depth );
383 }
384 }
385
386 $html .= Xml::closeElement( 'div' );
387
388 return $html;
389 }
390
397 public function renderChildren( Title $title, $depth = 1 ) {
399
400 if ( $title->getNamespace() != NS_CATEGORY ) {
401 // Non-categories can't have children. :)
402 return '';
403 }
404
406
407 $inverse = $this->isInverse();
408 $mode = $this->getOption( 'mode' );
409 $namespaces = $this->getOption( 'namespaces' );
410
411 $tables = [ 'page', 'categorylinks' ];
412 $fields = [ 'page_id', 'page_namespace', 'page_title',
413 'page_is_redirect', 'page_len', 'page_latest', 'cl_to',
414 'cl_from' ];
415 $where = [];
416 $joins = [];
417 $options = [ 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ];
418
419 if ( $inverse ) {
420 $joins['categorylinks'] = [ 'RIGHT JOIN', [
421 'cl_to = page_title', 'page_namespace' => NS_CATEGORY
422 ] ];
423 $where['cl_from'] = $title->getArticleID();
424 } else {
425 $joins['categorylinks'] = [ 'JOIN', 'cl_from = page_id' ];
426 $where['cl_to'] = $title->getDBkey();
427 $options['USE INDEX']['categorylinks'] = 'cl_sortkey';
428
429 # namespace filter.
430 if ( $namespaces ) {
431 // NOTE: we assume that the $namespaces array contains only integers!
432 // decodeNamepsaces makes it so.
433 $where['page_namespace'] = $namespaces;
434 } elseif ( $mode != CategoryTreeMode::ALL ) {
435 if ( $mode == CategoryTreeMode::PAGES ) {
436 $where['cl_type'] = [ 'page', 'subcat' ];
437 } else {
438 $where['cl_type'] = 'subcat';
439 }
440 }
441 }
442
443 # fetch member count if possible
444 $doCount = !$inverse && $wgCategoryTreeUseCategoryTable;
445
446 if ( $doCount ) {
447 $tables = array_merge( $tables, [ 'category' ] );
448 $fields = array_merge( $fields, [
449 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files'
450 ] );
451 $joins['category'] = [ 'LEFT JOIN', [
452 'cat_title = page_title', 'page_namespace' => NS_CATEGORY ]
453 ];
454 }
455
456 $res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins );
457
458 # collect categories separately from other pages
459 $categories = '';
460 $other = '';
461
462 foreach ( $res as $row ) {
463 # NOTE: in inverse mode, the page record may be null, because we use a right join.
464 # happens for categories with no category page (red cat links)
465 if ( $inverse && $row->page_title === null ) {
466 $t = Title::makeTitle( NS_CATEGORY, $row->cl_to );
467 } else {
468 # TODO: translation support; ideally added to Title object
469 $t = Title::newFromRow( $row );
470 }
471
472 $cat = null;
473
474 if ( $doCount && $row->page_namespace == NS_CATEGORY ) {
475 $cat = Category::newFromRow( $row, $t );
476 }
477
478 $s = $this->renderNodeInfo( $t, $cat, $depth - 1 );
479
480 if ( $row->page_namespace == NS_CATEGORY ) {
481 $categories .= $s;
482 } else {
483 $other .= $s;
484 }
485 }
486
487 return $categories . $other;
488 }
489
495 public function renderParents( Title $title ) {
497
499
500 $res = $dbr->select(
501 'categorylinks',
502 [
503 'page_namespace' => NS_CATEGORY,
504 'page_title' => 'cl_to',
505 ],
506 [ 'cl_from' => $title->getArticleID() ],
507 __METHOD__,
508 [
509 'LIMIT' => $wgCategoryTreeMaxChildren,
510 'ORDER BY' => 'cl_to'
511 ]
512 );
513
514 $special = SpecialPage::getTitleFor( 'CategoryTree' );
515
516 $s = '';
517
518 foreach ( $res as $row ) {
519 $t = Title::newFromRow( $row );
520
521 $label = $t->getText();
522
523 $wikiLink = $special->getLocalURL( 'target=' . $t->getPartialURL() .
524 '&' . $this->getOptionsAsUrlParameters() );
525
526 if ( $s !== '' ) {
527 $s .= wfMessage( 'pipe-separator' )->escaped();
528 }
529
530 $s .= Xml::openElement( 'span', [ 'class' => 'CategoryTreeItem' ] );
531 $s .= Xml::element( 'a', [ 'class' => 'CategoryTreeLabel', 'href' => $wikiLink ], $label );
532 $s .= Xml::closeElement( 'span' );
533 }
534
535 return $s;
536 }
537
544 public function renderNode( Title $title, $children = 0 ) {
546
547 if ( $wgCategoryTreeUseCategoryTable && $title->getNamespace() == NS_CATEGORY
548 && !$this->isInverse()
549 ) {
550 $cat = Category::newFromTitle( $title );
551 } else {
552 $cat = null;
553 }
554
555 return $this->renderNodeInfo( $title, $cat, $children );
556 }
557
566 public function renderNodeInfo( Title $title, Category $cat = null, $children = 0 ) {
567 $mode = $this->getOption( 'mode' );
568
569 $ns = $title->getNamespace();
570 $key = $title->getDBkey();
571
572 $hideprefix = $this->getOption( 'hideprefix' );
573
574 if ( $hideprefix == CategoryTreeHidePrefix::ALWAYS ) {
575 $hideprefix = true;
576 } elseif ( $hideprefix == CategoryTreeHidePrefix::AUTO ) {
577 $hideprefix = ( $mode == CategoryTreeMode::CATEGORIES );
578 } elseif ( $hideprefix == CategoryTreeHidePrefix::CATEGORIES ) {
579 $hideprefix = ( $ns == NS_CATEGORY );
580 } else {
581 $hideprefix = true;
582 }
583
584 // when showing only categories, omit namespace in label unless we explicitely defined the
585 // configuration setting
586 // patch contributed by Manuel Schneider <manuel.schneider@wikimedia.ch>, Bug 8011
587 if ( $hideprefix ) {
588 $label = $title->getText();
589 } else {
590 $label = $title->getPrefixedText();
591 }
592
593 $labelClass = 'CategoryTreeLabel ' . ' CategoryTreeLabelNs' . $ns;
594
595 if ( !$title->getArticleID() ) {
596 $labelClass .= ' new';
597 $wikiLink = $title->getLocalURL( 'action=edit&redlink=1' );
598 } else {
599 $wikiLink = $title->getLocalURL();
600 }
601
602 if ( $ns == NS_CATEGORY ) {
603 $labelClass .= ' CategoryTreeLabelCategory';
604 } else {
605 $labelClass .= ' CategoryTreeLabelPage';
606 }
607
608 if ( ( $ns % 2 ) > 0 ) {
609 $labelClass .= ' CategoryTreeLabelTalk';
610 }
611
612 $count = false;
613 $s = '';
614
615 # NOTE: things in CategoryTree.js rely on the exact order of tags!
616 # Specifically, the CategoryTreeChildren div must be the first
617 # sibling with nodeName = DIV of the grandparent of the expland link.
618
619 $s .= Xml::openElement( 'div', [ 'class' => 'CategoryTreeSection' ] );
620 $s .= Xml::openElement( 'div', [ 'class' => 'CategoryTreeItem' ] );
621
622 $attr = [ 'class' => 'CategoryTreeBullet' ];
623
624 if ( $ns == NS_CATEGORY ) {
625 if ( $cat ) {
626 if ( $mode == CategoryTreeMode::CATEGORIES ) {
627 $count = intval( $cat->getSubcatCount() );
628 } elseif ( $mode == CategoryTreeMode::PAGES ) {
629 $count = intval( $cat->getPageCount() ) - intval( $cat->getFileCount() );
630 } else {
631 $count = intval( $cat->getPageCount() );
632 }
633 }
634 if ( $count === 0 ) {
635 $bullet = wfMessage( 'categorytree-empty-bullet' )->escaped() . ' ';
636 $attr['class'] = 'CategoryTreeEmptyBullet';
637 } else {
638 $linkattr = [];
639
640 $linkattr[ 'class' ] = "CategoryTreeToggle";
641 $linkattr['data-ct-title'] = $key;
642
643 if ( $children == 0 ) {
644 // Use ->plain() to ensure identical result as JS,
645 // which does:
646 // $link.text( mw.msg( 'categorytree-expand-bullet' ) );
647 $txt = wfMessage( 'categorytree-expand-bullet' )->plain();
648 $linkattr[ 'data-ct-state' ] = 'collapsed';
649 } else {
650 $txt = wfMessage( 'categorytree-collapse-bullet' )->plain();
651 $linkattr[ 'data-ct-loaded' ] = true;
652 $linkattr[ 'data-ct-state' ] = 'expanded';
653 }
654
655 $bullet = Html::element( 'span', $linkattr, $txt ) . ' ';
656 }
657 } else {
658 $bullet = wfMessage( 'categorytree-page-bullet' )->escaped();
659 }
660 $s .= Xml::tags( 'span', $attr, $bullet ) . ' ';
661
662 $s .= Xml::element(
663 'a',
664 [
665 'class' => $labelClass,
666 'href' => $wikiLink,
667 'title' => $title->getPrefixedText()
668 ],
669 $label
670 );
671
672 if ( $count !== false && $this->getOption( 'showcount' ) ) {
673 $s .= self::createCountString( RequestContext::getMain(), $cat, $count );
674 }
675
676 $s .= Xml::closeElement( 'div' );
677 $s .= Xml::openElement(
678 'div',
679 [
680 'class' => 'CategoryTreeChildren',
681 'style' => $children > 0 ? "display:block" : "display:none"
682 ]
683 );
684
685 if ( $ns == NS_CATEGORY && $children > 0 ) {
686 $children = $this->renderChildren( $title, $children );
687 if ( $children == '' ) {
688 $s .= Xml::openElement( 'i', [ 'class' => 'CategoryTreeNotice' ] );
689 if ( $mode == CategoryTreeMode::CATEGORIES ) {
690 $s .= wfMessage( 'categorytree-no-subcategories' )->escaped();
691 } elseif ( $mode == CategoryTreeMode::PAGES ) {
692 $s .= wfMessage( 'categorytree-no-pages' )->escaped();
693 } elseif ( $mode == CategoryTreeMode::PARENTS ) {
694 $s .= wfMessage( 'categorytree-no-parent-categories' )->escaped();
695 } else {
696 $s .= wfMessage( 'categorytree-nothing-found' )->escaped();
697 }
698 $s .= Xml::closeElement( 'i' );
699 } else {
700 $s .= $children;
701 }
702 }
703
704 $s .= Xml::closeElement( 'div' );
705 $s .= Xml::closeElement( 'div' );
706
707 return $s;
708 }
709
718 public static function createCountString( IContextSource $context, Category $cat = null,
719 $countMode
720 ) {
721 global $wgContLang;
722
723 # Get counts, with conversion to integer so === works
724 # Note: $allCount is the total number of cat members,
725 # not the count of how many members are normal pages.
726 $allCount = $cat ? intval( $cat->getPageCount() ) : 0;
727 $subcatCount = $cat ? intval( $cat->getSubcatCount() ) : 0;
728 $fileCount = $cat ? intval( $cat->getFileCount() ) : 0;
729 $pages = $allCount - $subcatCount - $fileCount;
730
731 $attr = [
732 'title' => $context->msg( 'categorytree-member-counts' )
733 ->numParams( $subcatCount, $pages, $fileCount, $allCount, $countMode )->text(),
734 # numbers and commas get messed up in a mixed dir env
735 'dir' => $context->getLanguage()->getDir()
736 ];
737
738 $s = $wgContLang->getDirMark() . ' ';
739
740 # Create a list of category members with only non-zero member counts
741 $memberNums = [];
742 if ( $subcatCount ) {
743 $memberNums[] = $context->msg( 'categorytree-num-categories' )
744 ->numParams( $subcatCount )->text();
745 }
746 if ( $pages ) {
747 $memberNums[] = $context->msg( 'categorytree-num-pages' )->numParams( $pages )->text();
748 }
749 if ( $fileCount ) {
750 $memberNums[] = $context->msg( 'categorytree-num-files' )
751 ->numParams( $fileCount )->text();
752 }
753 $memberNumsShort = $memberNums
754 ? $context->getLanguage()->commaList( $memberNums )
755 : $context->msg( 'categorytree-num-empty' )->text();
756
757 # Only $5 is actually used in the default message.
758 # Other arguments can be used in a customized message.
759 $s .= Xml::tags(
760 'span',
761 $attr,
762 $context->msg( 'categorytree-member-num' )
763 // Do not use numParams on params 1-4, as they are only used for customisation.
764 ->params( $subcatCount, $pages, $fileCount, $allCount, $memberNumsShort )
765 ->escaped()
766 );
767
768 return $s;
769 }
770
776 public static function makeTitle( $title ) {
777 $title = trim( $title );
778
779 if ( strval( $title ) === '' ) {
780 return null;
781 }
782
783 # The title must be in the category namespace
784 # Ignore a leading Category: if there is one
785 $t = Title::newFromText( $title, NS_CATEGORY );
786 if ( !$t || $t->getNamespace() != NS_CATEGORY || $t->getInterwiki() != '' ) {
787 // If we were given something like "Wikipedia:Foo" or "Template:",
788 // try it again but forced.
789 $title = "Category:$title";
790 $t = Title::newFromText( $title );
791 }
792 return $t;
793 }
794
802 public static function capDepth( $mode, $depth ) {
804
805 if ( is_numeric( $depth ) ) {
806 $depth = intval( $depth );
807 } else {
808 return 1;
809 }
810
811 if ( is_array( $wgCategoryTreeMaxDepth ) ) {
812 $max = isset( $wgCategoryTreeMaxDepth[$mode] ) ? $wgCategoryTreeMaxDepth[$mode] : 1;
813 } elseif ( is_numeric( $wgCategoryTreeMaxDepth ) ) {
815 } else {
816 wfDebug( 'CategoryTree::capDepth: $wgCategoryTreeMaxDepth is invalid.' );
817 $max = 1;
818 }
819
820 return min( $depth, $max );
821 }
822}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
$wgContLang
Definition Setup.php:790
Core functions for the CategoryTree extension, an AJAX based gadget to display the category structure...
renderNodeInfo(Title $title, Category $cat=null, $children=0)
Returns a string with a HTML represenation of the given page.
getTag(Parser $parser=null, $category, $hideroot=false, array $attr=[], $depth=1, $allowMissing=false)
Custom tag implementation.
__construct(array $options)
@suppress PhanTypeInvalidDimOffset
static setHeaders(OutputPage $outputPage)
Add ResourceLoader modules to the OutputPage object.
renderChildren(Title $title, $depth=1)
Returns a string with an HTML representation of the children of the given category.
static decodeBoolean( $value)
Helper function to convert a string to a boolean value.
renderParents(Title $title)
Returns a string with an HTML representation of the parents of the given category.
static decodeHidePrefix( $value)
static decodeMode( $mode)
getOptionsAsCacheKey( $depth=null)
getOption( $name)
static decodeNamespaces( $nn)
renderNode(Title $title, $children=0)
Returns a string with a HTML represenation of the given page.
static createCountString(IContextSource $context, Category $cat=null, $countMode)
Create a string which format the page, subcat and file counts of a category @suppress PhanParamReqAft...
static makeTitle( $title)
Creates a Title object from a user provided (and thus unsafe) string.
static capDepth( $mode, $depth)
Internal function to cap depth @suppress PhanPluginDuplicateConditionalNullCoalescing until PHP7 is r...
static encodeOptions(array $options, $enc)
getOptionsAsJsStructure( $depth=null)
Category objects are immutable, strictly speaking.
Definition Category.php:31
This class should be covered by a general architecture document which does not exist as of January 20...
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition Parser.php:69
Represents a title within MediaWiki.
Definition Title.php:40
$res
Definition database.txt:21
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition hooks.txt:1834
namespace and then decline to actually register it & $namespaces
Definition hooks.txt:925
either a plain
Definition hooks.txt:2054
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition hooks.txt:1999
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2848
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
Definition hooks.txt:996
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition hooks.txt:2011
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:271
const NS_FILE
Definition Defines.php:79
const NS_MAIN
Definition Defines.php:73
const NS_CATEGORY
Definition Defines.php:87
Interface for objects which can provide a MediaWiki context on request.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
const DB_REPLICA
Definition defines.php:25