42 parent::__construct(
'Prefixindex' );
56 $out->addModuleStyles(
'mediawiki.special' );
61 $prefix =
$request->getVal(
'prefix',
'' );
62 $ns =
$request->getIntOrNull(
'namespace' );
63 $namespace = (int)$ns;
64 $this->hideRedirects =
$request->getBool(
'hideredirects', $this->hideRedirects );
65 $this->stripPrefix =
$request->getBool(
'stripprefix', $this->stripPrefix );
69 ( $namespace > 0 && array_key_exists( $namespace,
$namespaces ) )
70 ? $this->
msg(
'prefixindex-namespace', str_replace(
'_',
' ',
$namespaces[$namespace] ) )
71 : $this->
msg(
'prefixindex' )
75 if ( $par !== null ) {
77 } elseif ( $prefix !=
'' ) {
79 } elseif (
$from !=
'' && $ns === null ) {
86 if ( $this->
including() || $showme !=
'' || $ns !== null ) {
103 [
'method' =>
'get',
'action' => $this->
getConfig()->
get(
'Script' ) ]
110 <td class='mw-label'>" .
113 <td class='mw-input'>" .
114 Xml::input(
'prefix', 30, str_replace(
'_',
' ',
$from ), [
'id' =>
'nsfrom' ] ) .
118 <td class='mw-label'>" .
121 <td class='mw-input'>" .
123 'selected' => $namespace,
125 'name' =>
'namespace',
127 'class' =>
'namespaceselector',
130 $this->
msg(
'allpages-hide-redirects' )->
text(),
136 $this->
msg(
'prefixindex-strip' )->
text(),
160 if (
$from === null ) {
169 if ( !$prefixList || !$fromList ) {
170 $out = $this->
msg(
'allpagesbadtitle' )->parseAsBlock();
171 } elseif ( !array_key_exists( $namespace,
$namespaces ) ) {
173 $out = $this->
msg(
'allpages-bad-ns', $namespace )->parse();
176 list( $namespace, $prefixKey, $prefix ) = $prefixList;
177 list( , $fromKey, ) = $fromList;
179 # ## @todo FIXME: Should complain if $fromNs != $namespace
184 'page_namespace' => $namespace,
185 'page_title' .
$dbr->buildLike( $prefixKey,
$dbr->anyString() ),
186 'page_title >= ' .
$dbr->addQuotes( $fromKey ),
189 if ( $this->hideRedirects ) {
190 $conds[
'page_is_redirect'] = 0;
194 [
'page_namespace',
'page_title',
'page_is_redirect' ],
198 'ORDER BY' =>
'page_title',
199 'LIMIT' => $this->maxPerPage + 1,
200 'USE INDEX' =>
'name_title',
207 if (
$res->numRows() > 0 ) {
210 $prefixLength = strlen( $prefix );
211 while ( ( $n < $this->maxPerPage ) && (
$s =
$res->fetchObject() ) ) {
214 $displayed =
$t->getText();
216 if ( $this->stripPrefix && $prefixLength !== strlen( $displayed ) ) {
217 $displayed = substr( $displayed, $prefixLength );
219 $link = (
$s->page_is_redirect ?
'<div class="allpagesredirect">' :
'' ) .
222 htmlspecialchars( $displayed ),
223 $s->page_is_redirect ? [
'class' =>
'mw-redirect' ] : []
225 (
$s->page_is_redirect ?
'</div>' :
'' );
227 $link =
'[[' . htmlspecialchars(
$s->page_title ) .
']]';
230 $out .=
"<li>$link</li>\n";
236 if (
$res->numRows() > 2 ) {
257 if (
$res && ( $n == $this->maxPerPage ) && (
$s =
$res->fetchObject() ) ) {
259 'from' =>
$s->page_title,
265 if ( $namespace || $prefix ==
'' ) {
268 $query[
'namespace'] = $namespace;
273 $this->
msg(
'nextpage', str_replace(
'_',
' ',
$s->page_title ) )->escaped(),
280 [
'class' =>
'mw-prefixindex-nav' ],
288 [
'class' =>
'mw-prefixindex-nav' ],
static closeElement($element)
Returns "$element>".
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
$stripPrefix
Whether to remove the searched prefix from the displayed link.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known', 'noclasses'])
Identical to link(), except $options defaults to 'known'.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
prefixSearchSubpages($search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
Implements Special:Allpages.
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
static input($name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
getNamespaceKeyAndText($ns, $text)
msg()
Wrapper around wfMessage that sets the current context.
including($x=null)
Whether the special page is being evaluated via transclusion.
getOutput()
Get the OutputPage being used for this instance.
when a variable name is used in a it is silently declared as a new local masking the global
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
static label($label, $id, $attribs=[])
Convenience function to build an HTML form label.
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
the value to return A Title object or null for latest to be modified or replaced by the hook handler or if authentication is not possible after cache objects are set for highlighting & $link
static closeElement($element)
Shortcut to close an XML element.
execute($par)
Entry point : initialise variables and call subfunctions.
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static openElement($element, $attribs=null)
This opens an XML element.
showPrefixChunk($namespace=NS_MAIN, $prefix, $from=null)
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
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
namespace and then decline to actually register it & $namespaces
Implements Special:Prefixindex.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object & $output
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
error also a ContextSource you ll probably need to make sure the header is varied on $request
getConfig()
Shortcut to get main config object.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
getRequest()
Get the WebRequest being used for this instance.
prefixSearchString($search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static & makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
namespacePrefixForm($namespace=NS_MAIN, $from= '')
HTML for the top form.
getPageTitle($subpage=false)
Get a self-referential title object.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.