47 parent::__construct(
'Tags' );
75 $out->setPageTitle( $this->
msg(
'tags-title' ) );
76 $out->wrapWikiMsg(
"<div class='mw-tags-intro'>\n$1\n</div>",
'tags-intro' );
79 $userCanManage =
$user->isAllowed(
'managechangetags' );
80 $userCanEditInterface =
$user->isAllowed(
'editinterface' );
83 if ( $userCanManage ) {
87 'label' => $this->
msg(
'tags-create-tag-name' )->plain(),
92 'label' => $this->
msg(
'tags-create-reason' )->plain(),
101 $form->setAction( $this->
getPageTitle(
'create' )->getLocalURL() );
102 $form->setWrapperLegendMsg(
'tags-create-heading' );
103 $form->setHeaderText( $this->
msg(
'tags-create-explanation' )->parseAsBlock() );
104 $form->setSubmitCallback( [ $this,
'processCreateTagForm' ] );
105 $form->setSubmitTextMsg(
'tags-create-submit' );
115 if (
$out->getRedirect() !==
'' ) {
124 $this->explicitlyDefinedTags = array_fill_keys(
126 $this->extensionDefinedTags = array_fill_keys(
130 $definedTags = array_keys( array_merge(
131 $this->explicitlyDefinedTags, $this->extensionDefinedTags ) );
134 if ( !$tagStats && !$definedTags ) {
140 Xml::tags(
'th', null, $this->
msg(
'tags-display-header' )->parse() ) .
141 Xml::tags(
'th', null, $this->
msg(
'tags-description-header' )->parse() ) .
142 Xml::tags(
'th', null, $this->
msg(
'tags-source-header' )->parse() ) .
143 Xml::tags(
'th', null, $this->
msg(
'tags-active-header' )->parse() ) .
144 Xml::tags(
'th', null, $this->
msg(
'tags-hitcount-header' )->parse() ) .
146 Xml::tags(
'th', [
'class' =>
'unsortable' ],
147 $this->
msg(
'tags-actions-header' )->parse() ) :
152 $this->extensionActivatedTags = array_fill_keys(
156 foreach ( $tagStats
as $tag => $hitcount ) {
157 $html .= $this->
doTagRow(
$tag, $hitcount, $userCanManage, $userCanEditInterface );
160 foreach ( $definedTags
as $tag ) {
161 if ( !isset( $tagStats[$tag] ) ) {
162 $html .= $this->
doTagRow( $tag, 0, $userCanManage, $userCanEditInterface );
168 [
'class' =>
'mw-datatable sortable mw-tags-table' ],
178 if ( $showEditLinks ) {
181 $this->
msg(
"tag-$tag" )->inContentLanguage()->
getTitle(),
182 $this->
msg(
'tags-edit' )->escaped()
184 $disp .= $this->
msg(
'parentheses' )->rawParams( $editLink )->escaped();
186 $newRow .=
Xml::tags(
'td', null, $disp );
188 $msg = $this->
msg(
"tag-$tag-description" );
189 $desc = !$msg->exists() ?
'' : $msg->parse();
190 if ( $showEditLinks ) {
193 $this->
msg(
"tag-$tag-description" )->inContentLanguage()->
getTitle(),
194 $this->
msg(
'tags-edit' )->escaped()
196 $desc .= $this->
msg(
'parentheses' )->rawParams( $editDescLink )->escaped();
198 $newRow .=
Xml::tags(
'td', null, $desc );
201 $isExtension = isset( $this->extensionDefinedTags[
$tag] );
202 $isExplicit = isset( $this->explicitlyDefinedTags[$tag] );
203 if ( $isExtension ) {
204 $sourceMsgs[] = $this->
msg(
'tags-source-extension' )->escaped();
207 $sourceMsgs[] = $this->
msg(
'tags-source-manual' )->escaped();
209 if ( !$sourceMsgs ) {
210 $sourceMsgs[] = $this->
msg(
'tags-source-none' )->escaped();
214 $isActive = $isExplicit || isset( $this->extensionActivatedTags[$tag] );
215 $activeMsg = ( $isActive ?
'tags-active-yes' :
'tags-active-no' );
216 $newRow .=
Xml::tags(
'td', null, $this->
msg( $activeMsg )->escaped() );
218 $hitcountLabel = $this->
msg(
'tags-hitcount' )->numParams( $hitcount )->escaped();
219 if ( $this->
getConfig()->
get(
'UseTagFilter' ) ) {
224 [
'tagfilter' => $tag ]
229 $newRow .=
Xml::tags(
'td', [
'data-sort-value' => $hitcount ], $hitcountLabel );
232 if ( $showActions ) {
238 $this->
msg(
'tags-delete' )->escaped(),
246 $this->
msg(
'tags-activate' )->escaped(),
254 $this->
msg(
'tags-deactivate' )->escaped(),
262 return Xml::tags(
'tr', null, $newRow ) .
"\n";
269 $tag = trim( strval( $data[
'Tag'] ) );
270 $ignoreWarnings = isset( $data[
'IgnoreWarnings'] ) && $data[
'IgnoreWarnings'] ===
'1';
272 $context->getUser(), $ignoreWarnings );
282 'default' => $data[
'Tag'],
286 'default' => $data[
'Reason'],
288 'IgnoreWarnings' => [
296 $context->getRequest()->unsetVal(
'wpEditToken' );
298 $headerText = $this->
msg(
'tags-create-warnings-above',
$tag,
299 count(
$status->getWarningsArray() ) )->parseAsBlock() .
301 $this->
msg(
'tags-create-warnings-below' )->parseAsBlock();
304 $subform->setAction( $this->
getPageTitle(
'create' )->getLocalURL() );
305 $subform->setWrapperLegendMsg(
'tags-create-heading' );
306 $subform->setHeaderText( $headerText );
307 $subform->setSubmitCallback( [ $this,
'processCreateTagForm' ] );
308 $subform->setSubmitTextMsg(
'htmlform-yes' );
314 $out->addWikiText(
"<div class=\"error\">\n" .
$status->getWikiText() .
322 if ( !
$user->isAllowed(
'managechangetags' ) ) {
327 $out->setPageTitle( $this->
msg(
'tags-delete-title' ) );
332 if ( !$canDeleteResult->isGood() ) {
333 $out->addWikiText(
"<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
335 if ( !$canDeleteResult->isOK() ) {
340 $preText = $this->
msg(
'tags-delete-explanation-initial',
$tag )->parseAsBlock();
342 if ( isset( $tagUsage[
$tag] ) && $tagUsage[$tag] > 0 ) {
343 $preText .= $this->
msg(
'tags-delete-explanation-in-use', $tag,
344 $tagUsage[$tag] )->parseAsBlock();
346 $preText .= $this->
msg(
'tags-delete-explanation-warning', $tag )->parseAsBlock();
349 $this->extensionActivatedTags = array_fill_keys(
351 if ( isset( $this->extensionActivatedTags[$tag] ) ) {
352 $preText .= $this->
msg(
'tags-delete-explanation-active', $tag )->parseAsBlock();
356 $fields[
'Reason'] = [
358 'label' => $this->
msg(
'tags-delete-reason' )->plain(),
361 $fields[
'HiddenTag'] = [
369 $form->setAction( $this->
getPageTitle(
'delete' )->getLocalURL() );
370 $form->tagAction =
'delete';
371 $form->setSubmitCallback( [ $this,
'processTagForm' ] );
372 $form->setSubmitTextMsg(
'tags-delete-submit' );
373 $form->setSubmitDestructive();
374 $form->addPreText( $preText );
379 $actionStr = $activate ?
'activate' :
'deactivate';
382 if ( !
$user->isAllowed(
'managechangetags' ) ) {
388 $out->setPageTitle( $this->
msg(
"tags-$actionStr-title" ) );
392 $func = $activate ?
'canActivateTag' :
'canDeactivateTag';
395 $out->addWikiText(
"<div class=\"error\">\n" .
$result->getWikiText() .
403 $preText = $this->
msg(
"tags-$actionStr-question",
$tag )->parseAsBlock();
407 $fields[
'Reason'] = [
409 'label' => $this->
msg(
"tags-$actionStr-reason" )->plain(),
412 $fields[
'HiddenTag'] = [
420 $form->setAction( $this->
getPageTitle( $actionStr )->getLocalURL() );
421 $form->tagAction = $actionStr;
422 $form->setSubmitCallback( [ $this,
'processTagForm' ] );
424 $form->setSubmitTextMsg(
"tags-$actionStr-submit" );
425 $form->addPreText( $preText );
433 $tag = $data[
'HiddenTag'];
434 $status = call_user_func( [
'ChangeTags',
"{$form->tagAction}TagWithChecks" ],
440 } elseif (
$status->isOK() && $form->tagAction ===
'delete' ) {
442 $out->addWikiText( $this->
msg(
'tags-delete-warnings-after-delete',
$tag,
443 count(
$status->getWarningsArray() ) )->text() .
"\n" .
448 $out->addWikiText(
"<div class=\"error\">\n" .
$status->getWikitext() .
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
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
the array() calling protocol came about after MediaWiki 1.4rc1.
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known', 'noclasses'])
Identical to link(), except $options defaults to 'known'.
getContext()
Gets the context this SpecialPage is executed in.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
processing should stop and the error should be shown to the user * false
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
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 true
Parent class for all special pages.
getContext()
Get the base IContextSource object.
getTitle($subpage=false)
Get a self-referential title object.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
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 $tag
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
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
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
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
error also a ContextSource you ll probably need to make sure the header is varied on $request
getUser()
Shortcut to get the User executing this instance.
getConfig()
Shortcut to get main config object.
Show an error when a user tries to do something they do not have the necessary permissions for...
getLanguage()
Shortcut to get user's language.
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 $status
getRequest()
Get the WebRequest being used for this instance.
getPageTitle($subpage=false)
Get a self-referential title object.