131 'api' =>
'HTMLApiField',
132 'text' =>
'HTMLTextField',
133 'textwithbutton' =>
'HTMLTextFieldWithButton',
134 'textarea' =>
'HTMLTextAreaField',
135 'select' =>
'HTMLSelectField',
136 'combobox' =>
'HTMLComboboxField',
137 'radio' =>
'HTMLRadioField',
138 'multiselect' =>
'HTMLMultiSelectField',
139 'limitselect' =>
'HTMLSelectLimitField',
140 'check' =>
'HTMLCheckField',
141 'toggle' =>
'HTMLCheckField',
142 'int' =>
'HTMLIntField',
143 'float' =>
'HTMLFloatField',
144 'info' =>
'HTMLInfoField',
145 'selectorother' =>
'HTMLSelectOrOtherField',
146 'selectandother' =>
'HTMLSelectAndOtherField',
147 'namespaceselect' =>
'HTMLSelectNamespace',
148 'namespaceselectwithbutton' =>
'HTMLSelectNamespaceWithButton',
149 'tagfilter' =>
'HTMLTagFilter',
150 'submit' =>
'HTMLSubmitField',
151 'hidden' =>
'HTMLHiddenField',
152 'edittools' =>
'HTMLEditTools',
153 'checkmatrix' =>
'HTMLCheckMatrix',
154 'cloner' =>
'HTMLFormFieldCloner',
155 'autocompleteselect' =>
'HTMLAutoCompleteSelectField',
159 'email' =>
'HTMLTextField',
160 'password' =>
'HTMLTextField',
161 'url' =>
'HTMLTextField',
162 'title' =>
'HTMLTitleTextField',
163 'user' =>
'HTMLUserTextField',
273 $arguments = func_get_args();
274 array_shift( $arguments );
278 $reflector =
new ReflectionClass(
'VFormHTMLForm' );
279 return $reflector->newInstanceArgs( $arguments );
281 $reflector =
new ReflectionClass(
'OOUIHTMLForm' );
282 return $reflector->newInstanceArgs( $arguments );
284 $reflector =
new ReflectionClass(
'HTMLForm' );
285 $form = $reflector->newInstanceArgs( $arguments );
304 $this->mTitle =
false;
305 $this->mMessagePrefix = $messagePrefix;
306 } elseif (
$context === null && $messagePrefix !==
'' ) {
307 $this->mMessagePrefix = $messagePrefix;
308 } elseif ( is_string(
$context ) && $messagePrefix ===
'' ) {
316 !$this->
getConfig()->
get(
'HTMLFormAllowTableFormat' )
317 && $this->displayFormat ===
'table'
319 $this->displayFormat =
'div';
323 $loadedDescriptor = [];
324 $this->mFlatFields = [];
326 foreach ( $descriptor
as $fieldname => $info ) {
327 $section = isset( $info[
'section'] )
331 if ( isset( $info[
'type'] ) && $info[
'type'] ===
'file' ) {
332 $this->mUseMultipart =
true;
335 $field = static::loadInputFromParameters( $fieldname, $info, $this );
337 $setSection =& $loadedDescriptor;
339 $sectionParts = explode(
'/',
$section );
341 while ( count( $sectionParts ) ) {
342 $newName = array_shift( $sectionParts );
344 if ( !isset( $setSection[$newName] ) ) {
345 $setSection[$newName] = [];
348 $setSection =& $setSection[$newName];
352 $setSection[$fieldname] = $field;
353 $this->mFlatFields[$fieldname] = $field;
356 $this->mFieldTree = $loadedDescriptor;
371 in_array( $format, $this->availableSubclassDisplayFormats,
true ) ||
372 in_array( $this->displayFormat, $this->availableSubclassDisplayFormats,
true )
374 throw new MWException(
'Cannot change display format after creation, ' .
375 'use HTMLForm::factory() instead' );
378 if ( !in_array( $format, $this->availableDisplayFormats,
true ) ) {
379 throw new MWException(
'Display format must be one of ' .
380 print_r( $this->availableDisplayFormats,
true ) );
384 if ( !$this->
getConfig()->
get(
'HTMLFormAllowTableFormat' ) && $format ===
'table' ) {
388 $this->displayFormat = $format;
430 if ( isset( $descriptor[
'class'] ) ) {
431 $class = $descriptor[
'class'];
432 } elseif ( isset( $descriptor[
'type'] ) ) {
433 $class = static::$typeMappings[$descriptor[
'type']];
434 $descriptor[
'class'] = $class;
440 throw new MWException(
"Descriptor with no class for $fieldname: "
441 . print_r( $descriptor,
true ) );
460 $class = static::getClassFromDescriptor( $fieldname, $descriptor );
462 $descriptor[
'fieldname'] = $fieldname;
464 $descriptor[
'parent'] = $parent;
467 # @todo This will throw a fatal error whenever someone try to use
468 # 'class' to feed a CSS class instead of 'cssclass'. Would be
469 # great to avoid the fatal error and show a nice error.
470 return new $class( $descriptor );
483 # Check if we have the info we need
484 if ( !$this->mTitle instanceof
Title && $this->mTitle !==
false ) {
485 throw new MWException(
'You must call setTitle() on an HTMLForm' );
488 # Load data from the request.
490 $this->mFormIdentifier === null ||
491 $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier
495 $this->mFieldData = [];
509 if ( $this->mFormIdentifier === null ) {
518 } elseif ( $this->
getRequest()->wasPosted() ) {
519 $editToken = $this->
getRequest()->getVal(
'wpEditToken' );
520 if ( $this->
getUser()->isLoggedIn() || $editToken !== null ) {
524 $tokenOkay = $this->
getUser()->matchEditToken( $editToken, $this->mTokenSalt );
530 if ( $tokenOkay && $identOkay ) {
531 $this->mWasSubmitted =
true;
586 $hoistedErrors[] = isset( $this->mValidationErrorMessage )
587 ? $this->mValidationErrorMessage
588 : [
'htmlform-invalid-input' ];
590 $this->mWasSubmitted =
true;
592 # Check for cancelled submission
593 foreach ( $this->mFlatFields
as $fieldname => $field ) {
594 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
597 if ( $field->cancelSubmit( $this->mFieldData[$fieldname], $this->mFieldData ) ) {
598 $this->mWasSubmitted =
false;
603 # Check for validation
604 foreach ( $this->mFlatFields
as $fieldname => $field ) {
605 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
608 if ( $field->isHidden( $this->mFieldData ) ) {
611 $res = $field->validate( $this->mFieldData[$fieldname], $this->mFieldData );
612 if (
$res !==
true ) {
614 if (
$res !==
false && !$field->canDisplayErrors() ) {
615 $hoistedErrors[] = [
'rawmessage',
$res ];
621 if ( count( $hoistedErrors ) === 1 ) {
622 $hoistedErrors = $hoistedErrors[0];
624 return $hoistedErrors;
628 if ( !is_callable( $callback ) ) {
629 throw new MWException(
'HTMLForm: no submit callback provided. Use ' .
630 'setSubmitCallback() to set one.' );
635 $res = call_user_func( $callback, $data, $this );
636 if (
$res ===
false ) {
637 $this->mWasSubmitted =
false;
669 $this->mSubmitCallback = $cb;
683 $this->mValidationErrorMessage = $msg;
738 $this->mHeader .= $msg;
740 if ( !isset( $this->mSectionHeaders[
$section] ) ) {
741 $this->mSectionHeaders[
$section] =
'';
743 $this->mSectionHeaders[
$section] .= $msg;
760 $this->mHeader = $msg;
762 $this->mSectionHeaders[
$section] = $msg;
779 return isset( $this->mSectionHeaders[
$section] ) ? $this->mSectionHeaders[
$section] :
'';
793 $this->mFooter .= $msg;
795 if ( !isset( $this->mSectionFooters[
$section] ) ) {
796 $this->mSectionFooters[
$section] =
'';
798 $this->mSectionFooters[
$section] .= $msg;
815 $this->mFooter = $msg;
817 $this->mSectionFooters[
$section] = $msg;
834 return isset( $this->mSectionFooters[
$section] ) ? $this->mSectionFooters[
$section] :
'';
846 $this->mPost .= $msg;
892 $this->mHiddenFields[] = [
$value, [
'name' =>
$name ] ];
923 if ( !is_array( $data ) ) {
924 $args = func_get_args();
925 if ( count(
$args ) < 2 || count(
$args ) > 4 ) {
926 throw new InvalidArgumentException(
927 'Incorrect number of arguments for deprecated calling style'
934 'attribs' => isset(
$args[3] ) ?
$args[3] : null,
937 if ( !isset( $data[
'name'] ) ) {
938 throw new InvalidArgumentException(
'A name is required' );
940 if ( !isset( $data[
'value'] ) ) {
941 throw new InvalidArgumentException(
'A value is required' );
944 $this->mButtons[] = $data + [
964 $this->mTokenSalt = $salt;
993 # For good measure (it is the default)
994 $this->
getOutput()->preventClickjacking();
995 $this->
getOutput()->addModules(
'mediawiki.htmlform' );
996 $this->
getOutput()->addModuleStyles(
'mediawiki.htmlform.styles' );
1016 # Use multipart/form-data
1017 $encType = $this->mUseMultipart
1018 ?
'multipart/form-data'
1019 :
'application/x-www-form-urlencoded';
1024 'enctype' => $encType,
1029 if ( $this->mAutocomplete ) {
1032 if ( $this->mName ) {
1046 # Include a <fieldset> wrapper for style, if requested.
1047 if ( $this->mWrapperLegend !==
false ) {
1048 $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend :
false;
1065 if ( $this->mFormIdentifier !== null ) {
1068 $this->mFormIdentifier
1074 $this->
getUser()->getEditToken( $this->mTokenSalt ),
1075 [
'id' =>
'wpEditToken' ]
1080 $articlePath = $this->
getConfig()->get(
'ArticlePath' );
1081 if ( strpos( $articlePath,
'?' ) !==
false && $this->
getMethod() ===
'get' ) {
1085 foreach ( $this->mHiddenFields
as $data ) {
1099 $useMediaWikiUIEverywhere = $this->
getConfig()->get(
'UseMediaWikiUIEverywhere' );
1101 if ( $this->mShowSubmit ) {
1104 if ( isset( $this->mSubmitID ) ) {
1108 if ( isset( $this->mSubmitName ) ) {
1112 if ( isset( $this->mSubmitTooltip ) ) {
1116 $attribs[
'class'] = [
'mw-htmlform-submit' ];
1118 if ( $useMediaWikiUIEverywhere ) {
1119 foreach ( $this->mSubmitFlags
as $flag ) {
1120 $attribs[
'class'][] =
'mw-ui-' . $flag;
1122 $attribs[
'class'][] =
'mw-ui-button';
1128 if ( $this->mShowReset ) {
1133 'value' => $this->
msg(
'htmlform-reset' )->
text(),
1134 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' : null,
1139 if ( $this->mShowCancel ) {
1141 if ( $target instanceof
Title ) {
1142 $target = $target->getLocalURL();
1147 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' : null,
1150 $this->
msg(
'cancel' )->
text()
1155 $isBadIE = preg_match(
'/MSIE [1-7]\./i', $this->
getRequest()->getHeader(
'User-Agent' ) );
1157 foreach ( $this->mButtons
as $button ) {
1160 'name' => $button[
'name'],
1161 'value' => $button[
'value']
1164 if ( isset( $button[
'label-message'] ) ) {
1165 $label = $this->
getMessage( $button[
'label-message'] )->parse();
1166 } elseif ( isset( $button[
'label'] ) ) {
1167 $label = htmlspecialchars( $button[
'label'] );
1168 } elseif ( isset( $button[
'label-raw'] ) ) {
1169 $label = $button[
'label-raw'];
1171 $label = htmlspecialchars( $button[
'value'] );
1174 if ( $button[
'attribs'] ) {
1175 $attrs += $button[
'attribs'];
1178 if ( isset( $button[
'id'] ) ) {
1179 $attrs[
'id'] = $button[
'id'];
1182 if ( $useMediaWikiUIEverywhere ) {
1183 $attrs[
'class'] = isset( $attrs[
'class'] ) ? (
array)$attrs[
'class'] : [];
1184 $attrs[
'class'][] =
'mw-ui-button';
1199 [
'class' =>
'mw-htmlform-submit-buttons' ],
"\n$buttons" ) .
"\n";
1207 return $this->
displaySection( $this->mFieldTree, $this->mTableId );
1218 if ( $errors instanceof
Status ) {
1219 if ( $errors->isOK() ) {
1222 $errorstr = $this->
getOutput()->parse( $errors->getWikiText() );
1224 } elseif ( is_array( $errors ) ) {
1227 $errorstr = $errors;
1245 foreach ( $errors
as $error ) {
1266 $this->mSubmitText =
$t;
1278 $this->mSubmitFlags = [
'destructive',
'primary' ];
1290 $this->mSubmitFlags = [
'progressive',
'primary' ];
1304 if ( !$msg instanceof
Message ) {
1305 $msg = $this->
msg( $msg );
1317 return $this->mSubmitText ?: $this->
msg(
'htmlform-submit' )->text();
1326 $this->mSubmitName =
$name;
1337 $this->mSubmitTooltip =
$name;
1351 $this->mSubmitID =
$t;
1372 $this->mFormIdentifier = $ident;
1388 $this->mShowSubmit = !$suppressSubmit;
1400 $this->mShowCancel = $show;
1411 $this->mCancelTarget = $target;
1425 $this->mTableId = $id;
1446 $this->mName =
$name;
1463 $this->mWrapperLegend = $legend;
1478 if ( !$msg instanceof
Message ) {
1479 $msg = $this->
msg( $msg );
1496 $this->mMessagePrefix = $p;
1519 return $this->mTitle ===
false
1532 $this->mMethod = strtolower( $method );
1574 $fieldsetIDPrefix =
'',
1575 &$hasUserVisibleFields =
false
1577 if ( $this->mFieldData === null ) {
1578 throw new LogicException(
'HTMLForm::displaySection() called on uninitialized field data. '
1579 .
'You probably called displayForm() without calling prepareForm() first.' );
1585 $subsectionHtml =
'';
1592 foreach ( $fields
as $key =>
$value ) {
1594 $v = array_key_exists( $key, $this->mFieldData )
1595 ? $this->mFieldData[$key]
1602 if (
$value->hasVisibleOutput() ) {
1605 $labelValue = trim(
$value->getLabel() );
1606 if ( $labelValue !==
' ' && $labelValue !==
'' ) {
1610 $hasUserVisibleFields =
true;
1612 } elseif ( is_array(
$value ) ) {
1613 $subsectionHasVisibleFields =
false;
1617 "$fieldsetIDPrefix$key-",
1618 $subsectionHasVisibleFields );
1621 if ( $subsectionHasVisibleFields ===
true ) {
1623 $hasUserVisibleFields =
true;
1632 if ( $fieldsetIDPrefix ) {
1645 if ( $subsectionHtml ) {
1646 if ( $this->mSubSectionBeforeFields ) {
1647 return $subsectionHtml .
"\n" .
$html;
1649 return $html .
"\n" . $subsectionHtml;
1665 $html = implode(
'', $fieldsHtml );
1673 if ( !$anyFieldHasLabel ) {
1674 $classes[] =
'mw-htmlform-nolabel';
1678 'class' => implode(
' ', $classes ),
1681 if ( $sectionName ) {
1702 foreach ( $this->mFlatFields
as $fieldname => $field ) {
1704 if ( $field->skipLoadData(
$request ) ) {
1706 } elseif ( !empty( $field->mParams[
'disabled'] ) ) {
1707 $fieldData[$fieldname] = $field->getDefault();
1709 $fieldData[$fieldname] = $field->loadDataFromRequest(
$request );
1715 $field = $this->mFlatFields[
$name];
1719 $this->mFieldData = $fieldData;
1730 $this->mShowReset = !$suppressReset;
1757 return $this->
msg(
"{$this->mMessagePrefix}-$key" )->text();
1771 $this->mAction = $action;
1785 if ( $this->mAction !==
false ) {
1789 $articlePath = $this->
getConfig()->get(
'ArticlePath' );
1795 if ( strpos( $articlePath,
'?' ) !==
false && $this->
getMethod() ===
'get' ) {
1799 return $this->
getTitle()->getLocalURL();
1813 $this->mAutocomplete = $autocomplete;
setContext(IContextSource $context)
Set the IContextSource object.
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
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
Interface for objects which can provide a MediaWiki context on request.
the array() calling protocol came about after MediaWiki 1.4rc1.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static newMainPage()
Create a new Title for the Main Page.
The Message class provides methods which fulfil two basic services:
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Generic operation result class Has warning/error list, boolean status and arbitrary value...
Represents a title within MediaWiki.
static tooltipAndAccesskeyAttribs($name, array $msgParams=[])
Returns the attributes for the tooltip and access key.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
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
getRequest()
Get the WebRequest object.
static fieldset($legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
getConfig()
Get the Config object.
getContext()
Get the base IContextSource object.
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
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
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
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
static escapeId($id, $options=[])
Given a value, escape it so that it can be used in an id attribute and return it. ...
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
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 after processing & $attribs
isGood()
Returns whether the operation completed and didn't have any error or warnings.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
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 incomplete not yet checked for validity & $retval
getUser()
Get the User object.
getOutput()
Get the OutputPage object.
Allows to change the fields on the form that will be generated $name
static newFromSpecifier($value)
Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key...