MediaWiki REL1_28
SpecialEditTags.php
Go to the documentation of this file.
1<?php
31 protected $wasSaved = false;
32
35
37 private $ids;
38
40 private $targetObj;
41
43 private $typeName;
44
46 private $revList;
47
49 private $isAllowed;
50
52 private $reason;
53
54 public function __construct() {
55 parent::__construct( 'EditTags', 'changetags' );
56 }
57
58 public function doesWrites() {
59 return true;
60 }
61
62 public function execute( $par ) {
63 $this->checkPermissions();
64 $this->checkReadOnly();
65
66 $output = $this->getOutput();
67 $user = $this->getUser();
68 $request = $this->getRequest();
69
70 // Check blocks
71 if ( $user->isBlocked() ) {
72 throw new UserBlockedError( $user->getBlock() );
73 }
74
75 $this->setHeaders();
76 $this->outputHeader();
77
78 $this->getOutput()->addModules( [ 'mediawiki.special.edittags',
79 'mediawiki.special.edittags.styles' ] );
80
81 $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' );
82
83 // Handle our many different possible input types
84 $ids = $request->getVal( 'ids' );
85 if ( !is_null( $ids ) ) {
86 // Allow CSV from the form hidden field, or a single ID for show/hide links
87 $this->ids = explode( ',', $ids );
88 } else {
89 // Array input
90 $this->ids = array_keys( $request->getArray( 'ids', [] ) );
91 }
92 $this->ids = array_unique( array_filter( $this->ids ) );
93
94 // No targets?
95 if ( count( $this->ids ) == 0 ) {
96 throw new ErrorPageError( 'tags-edit-nooldid-title', 'tags-edit-nooldid-text' );
97 }
98
99 $this->typeName = $request->getVal( 'type' );
100 $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
101
102 // sanity check of parameter
103 switch ( $this->typeName ) {
104 case 'logentry':
105 case 'logging':
106 $this->typeName = 'logentry';
107 break;
108 default:
109 $this->typeName = 'revision';
110 break;
111 }
112
113 // Allow the list type to adjust the passed target
114 // Yuck! Copied straight out of SpecialRevisiondelete, but it does exactly
115 // what we want
116 $this->targetObj = RevisionDeleter::suggestTarget(
117 $this->typeName === 'revision' ? 'revision' : 'logging',
120 );
121
122 $this->isAllowed = $user->isAllowed( 'changetags' );
123
124 $this->reason = $request->getVal( 'wpReason' );
125 // We need a target page!
126 if ( is_null( $this->targetObj ) ) {
127 $output->addWikiMsg( 'undelete-header' );
128 return;
129 }
130 // Give a link to the logs/hist for this page
131 $this->showConvenienceLinks();
132
133 // Either submit or create our form
134 if ( $this->isAllowed && $this->submitClicked ) {
135 $this->submit();
136 } else {
137 $this->showForm();
138 }
139
140 // Show relevant lines from the tag log
141 $tagLogPage = new LogPage( 'tag' );
142 $output->addHTML( "<h2>" . $tagLogPage->getName()->escaped() . "</h2>\n" );
144 $output,
145 'tag',
146 $this->targetObj,
147 '', /* user */
148 [ 'lim' => 25, 'conds' => [], 'useMaster' => $this->wasSaved ]
149 );
150 }
151
155 protected function showConvenienceLinks() {
156 // Give a link to the logs/hist for this page
157 if ( $this->targetObj ) {
158 // Also set header tabs to be for the target.
159 $this->getSkin()->setRelevantTitle( $this->targetObj );
160
161 $links = [];
162 $links[] = Linker::linkKnown(
164 $this->msg( 'viewpagelogs' )->escaped(),
165 [],
166 [
167 'page' => $this->targetObj->getPrefixedText(),
168 'hide_tag_log' => '0',
169 ]
170 );
171 if ( !$this->targetObj->isSpecialPage() ) {
172 // Give a link to the page history
173 $links[] = Linker::linkKnown(
174 $this->targetObj,
175 $this->msg( 'pagehist' )->escaped(),
176 [],
177 [ 'action' => 'history' ]
178 );
179 }
180 // Link to Special:Tags
181 $links[] = Linker::linkKnown(
182 SpecialPage::getTitleFor( 'Tags' ),
183 $this->msg( 'tags-edit-manage-link' )->escaped()
184 );
185 // Logs themselves don't have histories or archived revisions
186 $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
187 }
188 }
189
194 protected function getList() {
195 if ( is_null( $this->revList ) ) {
196 $this->revList = ChangeTagsList::factory( $this->typeName, $this->getContext(),
197 $this->targetObj, $this->ids );
198 }
199
200 return $this->revList;
201 }
202
207 protected function showForm() {
208 $userAllowed = true;
209
210 $out = $this->getOutput();
211 // Messages: tags-edit-revision-selected, tags-edit-logentry-selected
212 $out->wrapWikiMsg( "<strong>$1</strong>", [
213 "tags-edit-{$this->typeName}-selected",
214 $this->getLanguage()->formatNum( count( $this->ids ) ),
215 $this->targetObj->getPrefixedText()
216 ] );
217
218 $this->addHelpLink( 'Help:Tags' );
219 $out->addHTML( "<ul>" );
220
221 $numRevisions = 0;
222 // Live revisions...
223 $list = $this->getList();
224 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
225 for ( $list->reset(); $list->current(); $list->next() ) {
226 // @codingStandardsIgnoreEnd
227 $item = $list->current();
228 $numRevisions++;
229 $out->addHTML( $item->getHTML() );
230 }
231
232 if ( !$numRevisions ) {
233 throw new ErrorPageError( 'tags-edit-nooldid-title', 'tags-edit-nooldid-text' );
234 }
235
236 $out->addHTML( "</ul>" );
237 // Explanation text
238 $out->wrapWikiMsg( '<p>$1</p>', "tags-edit-{$this->typeName}-explanation" );
239
240 // Show form if the user can submit
241 if ( $this->isAllowed ) {
242 $form = Xml::openElement( 'form', [ 'method' => 'post',
243 'action' => $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ),
244 'id' => 'mw-revdel-form-revisions' ] ) .
245 Xml::fieldset( $this->msg( "tags-edit-{$this->typeName}-legend",
246 count( $this->ids ) )->text() ) .
247 $this->buildCheckBoxes() .
248 Xml::openElement( 'table' ) .
249 "<tr>\n" .
250 '<td class="mw-label">' .
251 Xml::label( $this->msg( 'tags-edit-reason' )->text(), 'wpReason' ) .
252 '</td>' .
253 '<td class="mw-input">' .
255 'wpReason',
256 60,
257 $this->reason,
258 [ 'id' => 'wpReason', 'maxlength' => 100 ]
259 ) .
260 '</td>' .
261 "</tr><tr>\n" .
262 '<td></td>' .
263 '<td class="mw-submit">' .
264 Xml::submitButton( $this->msg( "tags-edit-{$this->typeName}-submit",
265 $numRevisions )->text(), [ 'name' => 'wpSubmit' ] ) .
266 '</td>' .
267 "</tr>\n" .
268 Xml::closeElement( 'table' ) .
269 Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
270 Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
271 Html::hidden( 'type', $this->typeName ) .
272 Html::hidden( 'ids', implode( ',', $this->ids ) ) .
273 Xml::closeElement( 'fieldset' ) . "\n" .
274 Xml::closeElement( 'form' ) . "\n";
275 } else {
276 $form = '';
277 }
278 $out->addHTML( $form );
279 }
280
284 protected function buildCheckBoxes() {
285 // If there is just one item, provide the user with a multi-select field
286 $list = $this->getList();
287 $tags = [];
288 if ( $list->length() == 1 ) {
289 $list->reset();
290 $tags = $list->current()->getTags();
291 if ( $tags ) {
292 $tags = explode( ',', $tags );
293 } else {
294 $tags = [];
295 }
296
297 $html = '<table id="mw-edittags-tags-selector">';
298 $html .= '<tr><td>' . $this->msg( 'tags-edit-existing-tags' )->escaped() .
299 '</td><td>';
300 if ( $tags ) {
301 $html .= $this->getLanguage()->commaList( array_map( 'htmlspecialchars', $tags ) );
302 } else {
303 $html .= $this->msg( 'tags-edit-existing-tags-none' )->parse();
304 }
305 $html .= '</td></tr>';
306 $tagSelect = $this->getTagSelect( $tags, $this->msg( 'tags-edit-new-tags' )->plain() );
307 $html .= '<tr><td>' . $tagSelect[0] . '</td><td>' . $tagSelect[1];
308 } else {
309 // Otherwise, use a multi-select field for adding tags, and a list of
310 // checkboxes for removing them
311
312 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
313 for ( $list->reset(); $list->current(); $list->next() ) {
314 // @codingStandardsIgnoreEnd
315 $currentTags = $list->current()->getTags();
316 if ( $currentTags ) {
317 $tags = array_merge( $tags, explode( ',', $currentTags ) );
318 }
319 }
320 $tags = array_unique( $tags );
321
322 $html = '<table id="mw-edittags-tags-selector-multi"><tr><td>';
323 $tagSelect = $this->getTagSelect( [], $this->msg( 'tags-edit-add' )->plain() );
324 $html .= '<p>' . $tagSelect[0] . '</p>' . $tagSelect[1] . '</td><td>';
325 $html .= Xml::element( 'p', null, $this->msg( 'tags-edit-remove' )->plain() );
326 $html .= Xml::checkLabel( $this->msg( 'tags-edit-remove-all-tags' )->plain(),
327 'wpRemoveAllTags', 'mw-edittags-remove-all' );
328 $i = 0; // used for generating checkbox IDs only
329 foreach ( $tags as $tag ) {
330 $html .= Xml::element( 'br' ) . "\n" . Xml::checkLabel( $tag,
331 'wpTagsToRemove[]', 'mw-edittags-remove-' . $i++, false, [
332 'value' => $tag,
333 'class' => 'mw-edittags-remove-checkbox',
334 ] );
335 }
336 }
337
338 // also output the tags currently applied as a hidden form field, so we
339 // know what to remove from the revision/log entry when the form is submitted
340 $html .= Html::hidden( 'wpExistingTags', implode( ',', $tags ) );
341 $html .= '</td></tr></table>';
342
343 return $html;
344 }
345
358 protected function getTagSelect( $selectedTags, $label ) {
359 $result = [];
360 $result[0] = Xml::label( $label, 'mw-edittags-tag-list' );
361
362 $select = new XmlSelect( 'wpTagList[]', 'mw-edittags-tag-list', $selectedTags );
363 $select->setAttribute( 'multiple', 'multiple' );
364 $select->setAttribute( 'size', '8' );
365
367 $tags = array_unique( array_merge( $tags, $selectedTags ) );
368
369 // Values of $tags are also used as <option> labels
370 $select->addOptions( array_combine( $tags, $tags ) );
371
372 $result[1] = $select->getHTML();
373 return $result;
374 }
375
381 protected function submit() {
382 // Check edit token on submission
383 $request = $this->getRequest();
384 $token = $request->getVal( 'wpEditToken' );
385 if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
386 $this->getOutput()->addWikiMsg( 'sessionfailure' );
387 return false;
388 }
389
390 // Evaluate incoming request data
391 $tagList = $request->getArray( 'wpTagList' );
392 if ( is_null( $tagList ) ) {
393 $tagList = [];
394 }
395 $existingTags = $request->getVal( 'wpExistingTags' );
396 if ( is_null( $existingTags ) || $existingTags === '' ) {
397 $existingTags = [];
398 } else {
399 $existingTags = explode( ',', $existingTags );
400 }
401
402 if ( count( $this->ids ) > 1 ) {
403 // multiple revisions selected
404 $tagsToAdd = $tagList;
405 if ( $request->getBool( 'wpRemoveAllTags' ) ) {
406 $tagsToRemove = $existingTags;
407 } else {
408 $tagsToRemove = $request->getArray( 'wpTagsToRemove' );
409 }
410 } else {
411 // single revision selected
412 // The user tells us which tags they want associated to the revision.
413 // We have to figure out which ones to add, and which to remove.
414 $tagsToAdd = array_diff( $tagList, $existingTags );
415 $tagsToRemove = array_diff( $existingTags, $tagList );
416 }
417
418 if ( !$tagsToAdd && !$tagsToRemove ) {
419 $status = Status::newFatal( 'tags-edit-none-selected' );
420 } else {
421 $status = $this->getList()->updateChangeTagsOnAll( $tagsToAdd,
422 $tagsToRemove, null, $this->reason, $this->getUser() );
423 }
424
425 if ( $status->isGood() ) {
426 $this->success();
427 return true;
428 } else {
429 $this->failure( $status );
430 return false;
431 }
432 }
433
437 protected function success() {
438 $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
439 $this->getOutput()->wrapWikiMsg( "<div class=\"successbox\">\n$1\n</div>",
440 'tags-edit-success' );
441 $this->wasSaved = true;
442 $this->revList->reloadFromMaster();
443 $this->reason = ''; // no need to spew the reason back at the user
444 $this->showForm();
445 }
446
451 protected function failure( $status ) {
452 $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
453 $this->getOutput()->addWikiText( '<div class="errorbox">' .
454 $status->getWikiText( 'tags-edit-failure' ) .
455 '</div>'
456 );
457 $this->showForm();
458 }
459
460 public function getDescription() {
461 return $this->msg( 'tags-edit-title' )->text();
462 }
463
464 protected function getGroupName() {
465 return 'pagetools';
466 }
467}
Generic list for change tagging.
static factory( $typeName, IContextSource $context, Title $title, array $ids)
Creates a ChangeTags*List of the requested type.
static listExplicitlyDefinedTags()
Lists tags explicitly defined in the valid_tag table of the database.
An error page which can definitely be safely rendered using the OutputPage.
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
Definition Linker.php:255
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Class to simplify the use of log pages.
Definition LogPage.php:32
static suggestTarget( $typeName, $target, array $ids)
Suggest a target for the revision deletion.
Special page for adding and removing change tags to individual revisions.
showConvenienceLinks()
Show some useful links in the subtitle.
bool $isAllowed
Whether user is allowed to perform the action.
failure( $status)
Report that the submit operation failed.
string $typeName
Deletion type, may be revision or logentry.
bool $wasSaved
Was the DB modified in this request.
ChangeTagsList $revList
Storing the list of items to be tagged.
submit()
UI entry point for form submission.
doesWrites()
Indicates whether this special page may perform database writes.
success()
Report that the submit operation succeeded.
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
execute( $par)
Default execute method Checks user permissions.
array $ids
Target ID list.
Title $targetObj
Title object for target parameter.
showForm()
Show a list of items that we will operate on, and show a form which allows the user to modify the tag...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getList()
Get the list object for this request.
bool $submitClicked
True if the submit button was clicked, and the form was posted.
getTagSelect( $selectedTags, $label)
Returns a <select multiple> element with a list of change tags that can be applied by users.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
msg()
Wrapper around wfMessage that sets the current context.
Represents a title within MediaWiki.
Definition Title.php:36
Shortcut to construct a special page which is unlisted by default.
Show an error when the user tries to do something whilst blocked.
Class for generating HTML <select> or <datalist> elements.
Definition XmlSelect.php:26
static closeElement( $element)
Shortcut to close an XML element.
Definition Xml.php:118
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition Xml.php:359
static openElement( $element, $attribs=null)
This opens an XML element.
Definition Xml.php:109
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition Xml.php:275
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition Xml.php:460
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition Xml.php:420
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition Xml.php:39
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition Xml.php:578
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
Definition design.txt:18
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
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
Definition hooks.txt:1049
the array() calling protocol came about after MediaWiki 1.4rc1.
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
Definition hooks.txt:1102
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
Definition hooks.txt:249
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':DEPRECATED! Use HtmlPageLinkRendererBegin instead. 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
Definition hooks.txt:1937
either a plain
Definition hooks.txt:1990
error also a ContextSource you ll probably need to make sure the header is varied on $request
Definition hooks.txt:2685
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
Definition hooks.txt:886
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
Definition hooks.txt:1033
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:1957
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
Definition injection.txt:37