Go to the documentation of this file.
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 'sizefilter' =>
'HTMLSizeFilterField',
151 'submit' =>
'HTMLSubmitField',
152 'hidden' =>
'HTMLHiddenField',
153 'edittools' =>
'HTMLEditTools',
154 'checkmatrix' =>
'HTMLCheckMatrix',
155 'cloner' =>
'HTMLFormFieldCloner',
156 'autocompleteselect' =>
'HTMLAutoCompleteSelectField',
157 'date' =>
'HTMLDateTimeField',
158 'time' =>
'HTMLDateTimeField',
159 'datetime' =>
'HTMLDateTimeField',
163 'email' =>
'HTMLTextField',
164 'password' =>
'HTMLTextField',
165 'url' =>
'HTMLTextField',
166 'title' =>
'HTMLTitleTextField',
167 'user' =>
'HTMLUserTextField',
168 'usersmultiselect' =>
'HTMLUsersMultiselectField',
278 $arguments = func_get_args();
279 array_shift( $arguments );
307 $this->mTitle =
false;
308 $this->mMessagePrefix = $messagePrefix;
309 } elseif (
$context ===
null && $messagePrefix !==
'' ) {
310 $this->mMessagePrefix = $messagePrefix;
311 } elseif ( is_string(
$context ) && $messagePrefix ===
'' ) {
319 !$this->
getConfig()->
get(
'HTMLFormAllowTableFormat' )
320 && $this->displayFormat ===
'table'
322 $this->displayFormat =
'div';
326 $loadedDescriptor = [];
327 $this->mFlatFields = [];
329 foreach ( $descriptor
as $fieldname => $info ) {
330 $section = isset( $info[
'section'] )
334 if ( isset( $info[
'type'] ) && $info[
'type'] ===
'file' ) {
335 $this->mUseMultipart =
true;
338 $field = static::loadInputFromParameters( $fieldname, $info, $this );
340 $setSection =& $loadedDescriptor;
342 $sectionParts = explode(
'/',
$section );
344 while (
count( $sectionParts ) ) {
345 $newName = array_shift( $sectionParts );
347 if ( !isset( $setSection[$newName] ) ) {
348 $setSection[$newName] = [];
351 $setSection =& $setSection[$newName];
355 $setSection[$fieldname] = $field;
356 $this->mFlatFields[$fieldname] = $field;
359 $this->mFieldTree = $loadedDescriptor;
367 return isset( $this->mFlatFields[$fieldname] );
376 if ( !$this->
hasField( $fieldname ) ) {
377 throw new DomainException( __METHOD__ .
': no field named ' . $fieldname );
379 return $this->mFlatFields[$fieldname];
394 in_array( $format, $this->availableSubclassDisplayFormats,
true ) ||
395 in_array( $this->displayFormat, $this->availableSubclassDisplayFormats,
true )
397 throw new MWException(
'Cannot change display format after creation, ' .
398 'use HTMLForm::factory() instead' );
401 if ( !in_array( $format, $this->availableDisplayFormats,
true ) ) {
402 throw new MWException(
'Display format must be one of ' .
403 print_r( $this->availableDisplayFormats,
true ) );
407 if ( !$this->
getConfig()->
get(
'HTMLFormAllowTableFormat' ) && $format ===
'table' ) {
411 $this->displayFormat = $format;
453 if ( isset( $descriptor[
'class'] ) ) {
454 $class = $descriptor[
'class'];
455 } elseif ( isset( $descriptor[
'type'] ) ) {
456 $class = static::$typeMappings[$descriptor[
'type']];
457 $descriptor[
'class'] = $class;
463 throw new MWException(
"Descriptor with no class for $fieldname: "
464 . print_r( $descriptor,
true ) );
483 $class = static::getClassFromDescriptor( $fieldname, $descriptor );
485 $descriptor[
'fieldname'] = $fieldname;
487 $descriptor[
'parent'] = $parent;
490 # @todo This will throw a fatal error whenever someone try to use
491 # 'class' to feed a CSS class instead of 'cssclass'. Would be
492 # great to avoid the fatal error and show a nice error.
493 return new $class( $descriptor );
506 # Check if we have the info we need
507 if ( !$this->mTitle instanceof
Title && $this->mTitle !==
false ) {
508 throw new MWException(
'You must call setTitle() on an HTMLForm' );
511 # Load data from the request.
513 $this->mFormIdentifier ===
null ||
514 $this->
getRequest()->getVal(
'wpFormIdentifier' ) === $this->mFormIdentifier
518 $this->mFieldData = [];
532 if ( $this->mFormIdentifier ===
null ) {
541 } elseif ( $this->
getRequest()->wasPosted() ) {
542 $editToken = $this->
getRequest()->getVal(
'wpEditToken' );
543 if ( $this->
getUser()->isLoggedIn() || $editToken !==
null ) {
547 $tokenOkay = $this->
getUser()->matchEditToken( $editToken, $this->mTokenSalt );
553 if ( $tokenOkay && $identOkay ) {
554 $this->mWasSubmitted =
true;
609 if ( $this->mValidationErrorMessage ) {
610 foreach ( (
array)$this->mValidationErrorMessage
as $error ) {
611 call_user_func_array( [ $hoistedErrors,
'fatal' ], $error );
614 $hoistedErrors->fatal(
'htmlform-invalid-input' );
617 $this->mWasSubmitted =
true;
619 # Check for cancelled submission
620 foreach ( $this->mFlatFields
as $fieldname => $field ) {
621 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
624 if ( $field->cancelSubmit( $this->mFieldData[$fieldname], $this->mFieldData ) ) {
625 $this->mWasSubmitted =
false;
630 # Check for validation
631 foreach ( $this->mFlatFields
as $fieldname => $field ) {
632 if ( !array_key_exists( $fieldname, $this->mFieldData ) ) {
635 if ( $field->isHidden( $this->mFieldData ) ) {
638 $res = $field->validate( $this->mFieldData[$fieldname], $this->mFieldData );
639 if (
$res !==
true ) {
641 if (
$res !==
false && !$field->canDisplayErrors() ) {
642 if ( is_string(
$res ) ) {
643 $hoistedErrors->fatal(
'rawmessage',
$res );
645 $hoistedErrors->fatal(
$res );
652 return $hoistedErrors;
656 if ( !is_callable( $callback ) ) {
657 throw new MWException(
'HTMLForm: no submit callback provided. Use ' .
658 'setSubmitCallback() to set one.' );
663 $res = call_user_func( $callback, $data, $this );
664 if (
$res ===
false ) {
665 $this->mWasSubmitted =
false;
697 $this->mSubmitCallback = $cb;
711 $this->mValidationErrorMessage = $msg;
766 $this->mHeader .= $msg;
768 if ( !isset( $this->mSectionHeaders[
$section] ) ) {
769 $this->mSectionHeaders[
$section] =
'';
771 $this->mSectionHeaders[
$section] .= $msg;
788 $this->mHeader = $msg;
790 $this->mSectionHeaders[
$section] = $msg;
807 return isset( $this->mSectionHeaders[
$section] ) ? $this->mSectionHeaders[
$section] :
'';
821 $this->mFooter .= $msg;
823 if ( !isset( $this->mSectionFooters[
$section] ) ) {
824 $this->mSectionFooters[
$section] =
'';
826 $this->mSectionFooters[
$section] .= $msg;
843 $this->mFooter = $msg;
845 $this->mSectionFooters[
$section] = $msg;
862 return isset( $this->mSectionFooters[
$section] ) ? $this->mSectionFooters[
$section] :
'';
874 $this->mPost .= $msg;
920 $this->mHiddenFields[] = [
$value, [
'name' =>
$name ] ];
951 if ( !is_array( $data ) ) {
952 $args = func_get_args();
954 throw new InvalidArgumentException(
955 'Incorrect number of arguments for deprecated calling style'
962 'attribs' => isset(
$args[3] ) ?
$args[3] :
null,
965 if ( !isset( $data[
'name'] ) ) {
966 throw new InvalidArgumentException(
'A name is required' );
968 if ( !isset( $data[
'value'] ) ) {
969 throw new InvalidArgumentException(
'A value is required' );
972 $this->mButtons[] = $data + [
992 $this->mTokenSalt = $salt;
1021 # For good measure (it is the default)
1022 $this->
getOutput()->preventClickjacking();
1023 $this->
getOutput()->addModules(
'mediawiki.htmlform' );
1024 $this->
getOutput()->addModuleStyles(
'mediawiki.htmlform.styles' );
1045 # Use multipart/form-data
1046 $encType = $this->mUseMultipart
1047 ?
'multipart/form-data'
1048 :
'application/x-www-form-urlencoded';
1051 'class' =>
'mw-htmlform',
1054 'enctype' => $encType,
1059 if ( $this->mAutocomplete ) {
1062 if ( $this->mName ) {
1079 # Include a <fieldset> wrapper for style, if requested.
1080 if ( $this->mWrapperLegend !==
false ) {
1081 $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend :
false;
1098 if ( $this->mFormIdentifier !==
null ) {
1101 $this->mFormIdentifier
1107 $this->
getUser()->getEditToken( $this->mTokenSalt ),
1108 [
'id' =>
'wpEditToken' ]
1113 $articlePath = $this->
getConfig()->get(
'ArticlePath' );
1114 if ( strpos( $articlePath,
'?' ) !==
false && $this->
getMethod() ===
'get' ) {
1118 foreach ( $this->mHiddenFields
as $data ) {
1132 $useMediaWikiUIEverywhere = $this->
getConfig()->get(
'UseMediaWikiUIEverywhere' );
1134 if ( $this->mShowSubmit ) {
1137 if ( isset( $this->mSubmitID ) ) {
1141 if ( isset( $this->mSubmitName ) ) {
1145 if ( isset( $this->mSubmitTooltip ) ) {
1149 $attribs[
'class'] = [
'mw-htmlform-submit' ];
1151 if ( $useMediaWikiUIEverywhere ) {
1152 foreach ( $this->mSubmitFlags
as $flag ) {
1153 $attribs[
'class'][] =
'mw-ui-' . $flag;
1155 $attribs[
'class'][] =
'mw-ui-button';
1161 if ( $this->mShowReset ) {
1166 'value' => $this->
msg(
'htmlform-reset' )->
text(),
1167 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' :
null,
1172 if ( $this->mShowCancel ) {
1174 if ( $target instanceof
Title ) {
1175 $target = $target->getLocalURL();
1180 'class' => $useMediaWikiUIEverywhere ?
'mw-ui-button' :
null,
1183 $this->
msg(
'cancel' )->
text()
1188 $isBadIE = preg_match(
'/MSIE [1-7]\./i', $this->
getRequest()->getHeader(
'User-Agent' ) );
1190 foreach ( $this->mButtons
as $button ) {
1193 'name' => $button[
'name'],
1194 'value' => $button[
'value']
1197 if ( isset( $button[
'label-message'] ) ) {
1198 $label = $this->
getMessage( $button[
'label-message'] )->parse();
1199 } elseif ( isset( $button[
'label'] ) ) {
1200 $label = htmlspecialchars( $button[
'label'] );
1201 } elseif ( isset( $button[
'label-raw'] ) ) {
1202 $label = $button[
'label-raw'];
1204 $label = htmlspecialchars( $button[
'value'] );
1207 if ( $button[
'attribs'] ) {
1208 $attrs += $button[
'attribs'];
1211 if ( isset( $button[
'id'] ) ) {
1212 $attrs[
'id'] = $button[
'id'];
1215 if ( $useMediaWikiUIEverywhere ) {
1216 $attrs[
'class'] = isset( $attrs[
'class'] ) ? (
array)$attrs[
'class'] : [];
1217 $attrs[
'class'][] =
'mw-ui-button';
1232 [
'class' =>
'mw-htmlform-submit-buttons' ],
"\n$buttons" ) .
"\n";
1240 return $this->
displaySection( $this->mFieldTree, $this->mTableId );
1266 if ( !in_array( $elementsType, [
'error',
'warning' ],
true ) ) {
1267 throw new DomainException( $elementsType .
' is not a valid type.' );
1269 $elementstr =
false;
1270 if ( $elements instanceof
Status ) {
1271 list( $errorStatus, $warningStatus ) = $elements->splitByErrorType();
1272 $status = $elementsType ===
'error' ? $errorStatus : $warningStatus;
1276 $elementstr = $this->
getOutput()->parse(
1280 } elseif ( is_array( $elements ) && $elementsType ===
'error' ) {
1282 } elseif ( $elementsType ===
'error' ) {
1283 $elementstr = $elements;
1301 foreach ( $errors
as $error ) {
1322 $this->mSubmitText =
$t;
1334 $this->mSubmitFlags = [
'destructive',
'primary' ];
1346 $this->mSubmitFlags = [
'progressive',
'primary' ];
1360 if ( !$msg instanceof Message ) {
1361 $msg = $this->
msg( $msg );
1373 return $this->mSubmitText ?: $this->
msg(
'htmlform-submit' )->text();
1382 $this->mSubmitName =
$name;
1393 $this->mSubmitTooltip =
$name;
1407 $this->mSubmitID =
$t;
1428 $this->mFormIdentifier = $ident;
1444 $this->mShowSubmit = !$suppressSubmit;
1456 $this->mShowCancel = $show;
1467 $this->mCancelTarget = $target;
1481 $this->mTableId = $id;
1502 $this->mName =
$name;
1519 $this->mWrapperLegend = $legend;
1534 if ( !$msg instanceof Message ) {
1535 $msg = $this->
msg( $msg );
1552 $this->mMessagePrefix = $p;
1575 return $this->mTitle ===
false
1588 $this->mMethod = strtolower( $method );
1630 $fieldsetIDPrefix =
'',
1631 &$hasUserVisibleFields =
false
1633 if ( $this->mFieldData ===
null ) {
1634 throw new LogicException(
'HTMLForm::displaySection() called on uninitialized field data. '
1635 .
'You probably called displayForm() without calling prepareForm() first.' );
1641 $subsectionHtml =
'';
1648 foreach ( $fields
as $key =>
$value ) {
1650 $v = array_key_exists( $key, $this->mFieldData )
1651 ? $this->mFieldData[$key]
1658 if (
$value->hasVisibleOutput() ) {
1661 $labelValue = trim(
$value->getLabel() );
1662 if ( $labelValue !==
' ' && $labelValue !==
'' ) {
1666 $hasUserVisibleFields =
true;
1668 } elseif ( is_array(
$value ) ) {
1669 $subsectionHasVisibleFields =
false;
1673 "$fieldsetIDPrefix$key-",
1674 $subsectionHasVisibleFields );
1677 if ( $subsectionHasVisibleFields ===
true ) {
1679 $hasUserVisibleFields =
true;
1688 if ( $fieldsetIDPrefix ) {
1689 $attributes[
'id'] = Sanitizer::escapeId(
"$fieldsetIDPrefix$key" );
1701 if ( $subsectionHtml ) {
1702 if ( $this->mSubSectionBeforeFields ) {
1703 return $subsectionHtml .
"\n" .
$html;
1705 return $html .
"\n" . $subsectionHtml;
1721 $html = implode(
'', $fieldsHtml );
1729 if ( !$anyFieldHasLabel ) {
1730 $classes[] =
'mw-htmlform-nolabel';
1734 'class' => implode(
' ', $classes ),
1737 if ( $sectionName ) {
1738 $attribs[
'id'] = Sanitizer::escapeId( $sectionName );
1758 foreach ( $this->mFlatFields
as $fieldname => $field ) {
1760 if ( $field->skipLoadData(
$request ) ) {
1762 } elseif ( !empty( $field->mParams[
'disabled'] ) ) {
1763 $fieldData[$fieldname] = $field->getDefault();
1765 $fieldData[$fieldname] = $field->loadDataFromRequest(
$request );
1771 $field = $this->mFlatFields[
$name];
1775 $this->mFieldData = $fieldData;
1786 $this->mShowReset = !$suppressReset;
1813 return $this->
msg(
"{$this->mMessagePrefix}-$key" )->text();
1827 $this->mAction = $action;
1841 if ( $this->mAction !==
false ) {
1845 $articlePath = $this->
getConfig()->get(
'ArticlePath' );
1851 if ( strpos( $articlePath,
'?' ) !==
false && $this->
getMethod() ===
'get' ) {
1855 return $this->
getTitle()->getLocalURL();
1869 $this->mAutocomplete = $autocomplete;
1881 return Message::newFromSpecifier(
$value )->setContext( $this );
1894 foreach ( $this->mFlatFields
as $fieldname => $field ) {
1895 if ( $field->needsJSForHtml5FormValidation() ) {
getConfig()
Get the Config object.
getContext()
Get the base IContextSource object.
error also a ContextSource you ll probably need to make sure the header is varied on $request
msg()
Get a Message object with context set Parameters are the same as wfMessage()
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
static newMainPage()
Create a new Title for the Main Page.
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:Array with elements of the form "language:title" in the order that they will be output. & $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
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
Allows to change the fields on the form that will be generated $name
getRequest()
Get the WebRequest object.
getUser()
Get the User object.
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
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
isGood()
Returns whether the operation completed and didn't have any error or warnings.
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
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
getOutput()
Get the OutputPage object.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
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
setContext(IContextSource $context)
Set the IContextSource object.
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
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[])
Returns the attributes for the tooltip and access key.
static newGood( $value=null)
Factory function for good results.
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 account incomplete not yet checked for validity & $retval
static constructClassInstance( $clazz, $args)
Construct an instance of the given class using the given arguments.
Interface for objects which can provide a MediaWiki context on request.
Represents a title within MediaWiki.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
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 rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
the array() calling protocol came about after MediaWiki 1.4rc1.
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...