Go to the documentation of this file.
41 parent::__construct(
'Whatlinkshere' );
45 global $wgQueryPageDefaultLimit;
55 $opts->
add(
'limit', $wgQueryPageDefaultLimit );
67 if ( isset( $par ) ) {
75 if ( !$this->target ) {
81 $this->
getSkin()->setRelevantTitle( $this->target );
83 $this->selfTitle = $this->
getPageTitle( $this->target->getPrefixedDBkey() );
85 $out->setPageTitle( $this->
msg(
'whatlinkshere-title', $this->target->getPrefixedText() ) );
86 $out->addBacklinkSubtitle( $this->target );
104 global $wgMaxRedirectLinksRetrieved;
109 $hidelinks = $this->opts->getValue(
'hidelinks' );
110 $hideredirs = $this->opts->getValue(
'hideredirs' );
111 $hidetrans = $this->opts->getValue(
'hidetrans' );
114 $fetchlinks = ( !$hidelinks || !$hideredirs );
123 $plConds[
'rd_from'] =
null;
124 } elseif ( $hidelinks ) {
125 $plConds[] =
'rd_from is NOT NULL';
139 $namespace = $this->opts->getValue(
'namespace' );
140 if ( is_int( $namespace ) ) {
141 $plConds[
'page_namespace'] = $namespace;
142 $tlConds[
'page_namespace'] = $namespace;
143 $ilConds[
'page_namespace'] = $namespace;
147 $tlConds[] =
"tl_from >= $from";
148 $plConds[] =
"pl_from >= $from";
149 $ilConds[] =
"il_from >= $from";
156 $fields =
array(
'page_id',
'page_namespace',
'page_title',
'rd_from' );
162 'rd_interwiki = ' .
$dbr->addQuotes(
'' ) .
' OR rd_interwiki IS NULL'
167 $plRes =
$dbr->select(
array(
'pagelinks',
'page',
'redirect' ), $fields,
175 $tlRes =
$dbr->select(
array(
'templatelinks',
'page',
'redirect' ), $fields,
181 if ( !$hideimages ) {
183 $ilRes =
$dbr->select(
array(
'imagelinks',
'page',
'redirect' ), $fields,
189 if ( ( !$fetchlinks || !$plRes->numRows() )
190 && ( $hidetrans || !$tlRes->numRows() )
191 && ( $hideimages || !$ilRes->numRows() )
198 if ( $hidelinks || $hidetrans || $hideredirs || $hideimages ) {
201 $errMsg = is_int( $namespace ) ?
'nolinkshere-ns' :
'nolinkshere';
202 $out->addWikiMsg( $errMsg, $this->target->getPrefixedText() );
213 foreach ( $plRes
as $row ) {
214 $row->is_template = 0;
216 $rows[$row->page_id] = $row;
220 foreach ( $tlRes
as $row ) {
221 $row->is_template = 1;
223 $rows[$row->page_id] = $row;
226 if ( !$hideimages ) {
227 foreach ( $ilRes
as $row ) {
228 $row->is_template = 0;
230 $rows[$row->page_id] = $row;
236 $rows = array_values( $rows );
238 $numRows = count( $rows );
241 if ( $numRows >
$limit ) {
244 $nextId = $rows[
$limit]->page_id;
246 $rows = array_slice( $rows, 0,
$limit );
257 $out->addWikiMsg(
'linkshere', $this->target->getPrefixedText() );
259 $prevnext = $this->
getPrevNext( $prevId, $nextId );
260 $out->addHTML( $prevnext );
264 foreach ( $rows
as $row ) {
267 if ( $row->rd_from && $level < 2 ) {
280 $out->addHTML( $prevnext );
289 protected function listItem( $row, $nt, $notClose =
false ) {
292 # local message cache
293 static $msgcache =
null;
294 if ( $msgcache ===
null ) {
295 static $msgs =
array(
'isredirect',
'istemplate',
'semicolon-separator',
296 'whatlinkshere-links',
'isimage' );
298 foreach ( $msgs
as $msg ) {
299 $msgcache[$msg] = $this->
msg( $msg )->escaped();
303 if ( $row->rd_from ) {
319 if ( $row->rd_from ) {
320 $props[] = $msgcache[
'isredirect'];
322 if ( $row->is_template ) {
323 $props[] = $msgcache[
'istemplate'];
325 if ( $row->is_image ) {
326 $props[] = $msgcache[
'isimage'];
329 if ( count( $props ) ) {
330 $propsText = $this->
msg(
'parentheses' )
331 ->rawParams( implode( $msgcache[
'semicolon-separator'], $props ) )->escaped();
334 # Space for utilities links, with a what-links-here link provided
335 $wlhLink = $this->
wlhLink( $nt, $msgcache[
'whatlinkshere-links'] );
337 $this->
msg(
'parentheses' )->rawParams( $wlhLink )->escaped(),
338 'mw-whatlinkshere-tools'
343 Xml::tags(
'li',
null,
"$link $propsText $dirmark $wlh" ) .
"\n";
374 $currentLimit = $this->opts->getValue(
'limit' );
375 $prev = $this->
msg(
'whatlinkshere-prev' )->numParams( $currentLimit )->escaped();
376 $next = $this->
msg(
'whatlinkshere-next' )->numParams( $currentLimit )->escaped();
378 $changed = $this->opts->getChangedValues();
381 if ( 0 != $prevId ) {
382 $overrides =
array(
'from' => $this->opts->getValue(
'back' ) );
385 if ( 0 != $nextId ) {
386 $overrides =
array(
'from' => $nextId,
'back' => $prevId );
390 $limitLinks =
array();
392 foreach ( $this->limits
as $limit ) {
393 $prettyLimit = htmlspecialchars( $lang->formatNum(
$limit ) );
398 $nums = $lang->pipeList( $limitLinks );
400 return $this->
msg(
'viewprevnext' )->rawParams( $prev, $next, $nums )->escaped();
407 $this->opts->consumeValue(
'target' );
409 $this->opts->consumeValues(
array(
'back',
'from' ) );
412 $namespace = $this->opts->consumeValue(
'namespace' );
417 # Values that should not be forgotten
419 foreach ( $this->opts->getUnconsumedValues()
as $name =>
$value ) {
427 'mw-whatlinkshere-target', 40, $target );
434 'selected' => $namespace,
436 'label' => $this->
msg(
'namespace' )->
text()
438 'name' =>
'namespace',
440 'class' =>
'namespaceselector',
461 $show = $this->
msg(
'show' )->escaped();
462 $hide = $this->
msg(
'hide' )->escaped();
464 $changed = $this->opts->getChangedValues();
468 $types =
array(
'hidetrans',
'hidelinks',
'hideredirs' );
469 if ( $this->target->getNamespace() ==
NS_FILE ) {
470 $types[] =
'hideimages';
477 $chosen = $this->opts->getValue(
$type );
478 $msg = $chosen ? $show : $hide;
480 $links[] = $this->
msg(
"whatlinkshere-{$type}" )->rawParams(
485 $this->
msg(
'whatlinkshere-filters' )->
text(),
getPageTitle( $subpage=false)
Get a self-referential title object.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
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
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
getOutput()
Get the OutputPage being used for this instance.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
getPrefixedText()
Get the prefixed title with spaces.
listItem( $row, $nt, $notClose=false)
getSkin()
Shortcut to get the skin being used for this instance.
Shortcut to construct an includable special page.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
getLanguage()
Shortcut to get user's language.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
static openElement( $element, $attribs=null)
This opens an XML element.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
getDBkey()
Get the main part with underscores.
getNamespace()
Get the namespace index, i.e.
getPrevNext( $prevId, $nextId)
showIndirectLinks( $level, $target, $limit, $from=0, $back=0)
Implements Special:Whatlinkshere.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field with a label.
when a variable name is used in a it is silently declared as a new masking the global
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
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
execute( $par)
Default execute method Checks user permissions, calls the function given in mFunction.
getRequest()
Get the WebRequest being used for this instance.
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
makeSelfLink( $text, $query)
Represents a title within MediaWiki.
static closeElement( $element)
Shortcut to close an XML element.
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
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
getFilterPanel()
Create filter panel.
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
wlhLink(Title $target, $text)
static wrapClass( $text, $class, $tag='span', $attribs=array())
Shortcut to make a specific element with a class attribute.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
including( $x=null)
Whether the special page is being evaluated via transclusion.
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.