MediaWiki  1.23.12
SpecialTrackingCategories.php
Go to the documentation of this file.
1 <?php
35  function __construct() {
36  parent::__construct( 'TrackingCategories' );
37  }
38 
39  function execute( $par ) {
40  // Global array containing names of tracking categories
41  global $wgTrackingCategories;
42 
43  $this->setHeaders();
44  $this->outputHeader();
45  $this->getOutput()->allowClickjacking();
46  $this->getOutput()->addHTML(
47  Html::openElement( 'table', array( 'class' => 'mw-datatable TablePager',
48  'id' => 'mw-trackingcategories-table' ) ) . "\n" .
49  "<thead><tr>
50  <th>" .
51  $this->msg( 'trackingcategories-msg' )->escaped() . "
52  </th>
53  <th>" .
54  $this->msg( 'trackingcategories-name' )->escaped() .
55  "</th>
56  <th>" .
57  $this->msg( 'trackingcategories-desc' )->escaped() . "
58  </th>
59  </tr></thead>"
60  );
61 
62  foreach( $wgTrackingCategories as $catMsg ) {
63  /*
64  * Check if the tracking category varies by namespace
65  * Otherwise only pages in the current namespace will be displayed
66  * If it does vary, show pages considering all namespaces
67  */
68  $msgObj = $this->msg( $catMsg )->inContentLanguage();
69  $allMsgs = array();
70  $catDesc = $catMsg . '-desc';
71  $catMsgTitle = Title::makeTitleSafe( NS_MEDIAWIKI, $catMsg );
72  $catMsgTitleText = Linker::link(
73  $catMsgTitle,
74  htmlspecialchars( $catMsg )
75  );
76 
77  if ( strpos( $msgObj->plain(), '{{NAMESPACE}}' ) !== false ) {
79  foreach ( $ns as $namesp ) {
80  $tempTitle = Title::makeTitleSafe( $namesp, $catMsg );
81  $catName = $msgObj->title( $tempTitle )->text();
82  if ( !$msgObj->isDisabled() ) {
83  $catTitle = Title::makeTitleSafe( NS_CATEGORY, $catName );
84  $catTitleText = Linker::link(
85  $catTitle,
86  htmlspecialchars( $catName )
87  );
88  $allMsgs[] = $catTitleText;
89  }
90  }
91  } else {
92  $catName = $msgObj->text();
93  if ( !$msgObj->isDisabled() ) {
94  $catTitle = Title::makeTitleSafe( NS_CATEGORY, $catName );
95  $catTitleText = Linker::link(
96  $catTitle,
97  htmlspecialchars( $catName )
98  );
99  $classes = array();
100  } else {
101  $catTitleText = $this->msg( 'trackingcategories-disabled' )->parse();
102  }
103  $allMsgs[] = $catTitleText;
104  }
105 
106  /*
107  * Show category description if it exists as a system message
108  * as category-name-desc
109  */
110  $descMsg = $this->msg( $catDesc );
111  if ( $descMsg->isBlank() ) {
112  $descMsg = $this->msg( 'trackingcategories-nodesc' );
113  }
114 
115  $this->getOutput()->addHTML(
116  Html::openElement( 'tr' ) .
117  Html::openElement( 'td', array( 'class' => 'mw-trackingcategories-name' ) ) .
118  $this->getLanguage()->commaList( array_unique( $allMsgs ) ) .
119  Html::closeElement( 'td' ) .
120  Html::openElement( 'td', array( 'class' => 'mw-trackingcategories-msg' ) ) .
121  $catMsgTitleText .
122  Html::closeElement( 'td' ) .
123  Html::openElement( 'td', array( 'class' => 'mw-trackingcategories-desc' ) ) .
124  $descMsg->parse() .
125  Html::closeElement( 'td' ) .
126  Html::closeElement( 'tr' )
127  );
128  }
129  $this->getOutput()->addHTML( Html::closeElement( 'table' ) );
130  }
131 
132  protected function getGroupName() {
133  return 'pages';
134  }
135 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
MWNamespace\getValidNamespaces
static getValidNamespaces()
Returns an array of the namespaces (by integer id) that exist on the wiki.
Definition: Namespace.php:273
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:535
SpecialTrackingCategories\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialTrackingCategories.php:132
SpecialTrackingCategories\__construct
__construct()
Definition: SpecialTrackingCategories.php:35
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:578
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
Html\closeElement
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
Definition: Html.php:235
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:166
SpecialTrackingCategories
A special page that displays list of tracking categories Tracking categories allow pages with certain...
Definition: SpecialTrackingCategories.php:34
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:352
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
SpecialPage\msg
msg()
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:609
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:33
SpecialTrackingCategories\execute
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
Definition: SpecialTrackingCategories.php:39
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:87
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:443