Go to the documentation of this file.
42 $out =
'<' . $element;
46 if ( is_null( $contents ) ) {
49 if ( $allowShortTag && $contents ===
'' ) {
52 $out .=
'>' . htmlspecialchars( $contents ) .
"</$element>";
73 $out .=
" {$name}=\"" . Sanitizer::encodeAttribute( $val ) .
'"';
77 throw new MWException(
'Expected attribute array, got something else in ' . __METHOD__ );
119 return "</$element>";
144 public static function monthSelector( $selected =
'', $allmonths =
null, $id =
'month' ) {
147 $data =
new XmlSelect(
'month', $id, $selected );
148 if ( is_null( $selected ) ) {
151 if ( !is_null( $allmonths ) ) {
154 for ( $i = 1; $i < 13; $i++ ) {
158 $data->setAttribute(
'class',
'mw-month-selector' );
159 return $data->getHTML();
168 # Offset overrides year/month selection
169 if ( $month && $month !== -1 ) {
170 $encMonth = intval( $month );
175 $encYear = intval( $year );
176 } elseif ( $encMonth ) {
178 $thisMonth = intval( $timestamp->format(
'n' ) );
179 $thisYear = intval( $timestamp->format(
'Y' ) );
180 if ( intval( $encMonth ) > $thisMonth ) {
183 $encYear = $thisYear;
187 $inputAttribs = [
'id' =>
'year',
'maxlength' => 4,
'size' => 7 ];
189 Html::input(
'year', $encYear,
'number', $inputAttribs ) .
' ' .
205 $inLanguage =
null, $overrideAttrs = [], Message $msg =
null
209 $include = $customisedOnly ?
'mwfile' :
'mw';
231 $attrs = [
'id' =>
'wpUserLanguage',
'name' =>
'wpUserLanguage' ];
232 $attrs = array_merge( $attrs, $overrideAttrs );
234 if ( $msg ===
null ) {
275 $attributes = [
'name' =>
$name ];
278 $attributes[
'size'] = $size;
282 $attributes[
'value'] =
$value;
301 array_merge(
$attribs, [
'type' =>
'password' ] ) );
327 'type' =>
'checkbox',
329 self::attrib(
'checked', $checked ),
345 'value' =>
$value ] + self::attrib(
'checked', $checked ) +
$attribs );
359 $a = [
'for' => $id ];
361 foreach ( [
'class',
'title' ]
as $attr ) {
384 return $label .
' ' .
$input;
420 global $wgUseMediaWikiUIEverywhere;
425 if ( $wgUseMediaWikiUIEverywhere ) {
460 global $wgUseMediaWikiUIEverywhere;
468 if ( $wgUseMediaWikiUIEverywhere ) {
469 $baseAttrs[
'class'] =
'mw-ui-button mw-ui-progressive';
484 public static function option( $text,
$value =
null, $selected =
false,
486 if ( !is_null(
$value ) ) {
508 $selected =
'', $class =
'',
$tabindex =
null
514 foreach ( explode(
"\n", $list )
as $option ) {
518 } elseif ( substr(
$value, 0, 1 ) ==
'*' && substr(
$value, 1, 1 ) !=
'*' ) {
526 } elseif ( substr(
$value, 0, 2 ) ==
'**' ) {
648 if ( $arg ===
false ) {
653 return "$name(" . ( $pretty
654 ? (
' ' . implode(
', ',
$args ) .
' ' )
655 : implode(
',',
$args )
671 $parser = xml_parser_create(
"UTF-8" );
673 # case folding violates XML standard, turn it off
674 xml_parser_set_option(
$parser, XML_OPTION_CASE_FOLDING,
false );
676 if ( !xml_parse(
$parser, $text,
true ) ) {
700 Sanitizer::hackDocType() .
718 [
'"',
'>',
'<' ],
733 public static function buildForm( $fields, $submitLabel =
null, $submitAttribs = [] ) {
735 $form .=
"<table><tbody>";
737 foreach ( $fields
as $labelmsg =>
$input ) {
738 $id =
"mw-$labelmsg";
745 $form .=
Xml::tags(
'td', [
'class' =>
'mw-label' ],
wfMessage( $labelmsg )->parse() );
751 if ( $submitLabel ) {
760 $form .=
"</tbody></table>";
775 if ( is_array( $headers ) ) {
781 if ( is_string( $id ) ) {
790 foreach ( $rows
as $id => $row ) {
793 if ( is_string( $id ) ) {
814 foreach ( $cells
as $id => $cell ) {
817 if ( is_string( $id ) ) {
static isWellFormed( $text)
Check if a string is well-formed XML.
static buildTableRow( $attribs, $cells)
Build a row for a table.
static expandAttributes( $attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : att...
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
static getTextInputAttributes(array $attrs)
Modifies a set of attributes meant for text input elements and apply a set of default attributes.
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
switch( $options['output']) $languages
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 textarea( $name, $content, $cols=40, $rows=5, $attribs=[])
Shortcut for creating textareas.
static radio( $name, $value, $checked=false, $attribs=[])
Convenience function to build an HTML radio button.
static inputLabelSep( $label, $name, $id, $size=false, $value=false, $attribs=[])
Same as Xml::inputLabel() but return input and label in an array.
static option( $text, $value=null, $selected=false, $attribs=[])
Convenience function to build an HTML drop-down list item.
Allows to change the fields on the form that will be generated $name
static password( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML password input field.
static buildForm( $fields, $submitLabel=null, $submitAttribs=[])
Generate a form (without the opening form element).
static openElement( $element, $attribs=null)
This opens an XML element.
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
static languageSelector( $selected, $customisedOnly=true, $inLanguage=null, $overrideAttrs=[], Message $msg=null)
Construct a language selector appropriate for use in a form or preferences.
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 input( $name, $value='', $type='text', array $attribs=[])
Convenience function to produce an "<input>" element.
Class for generating HTML <select> or <datalist> elements.
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to interpret a given string a...
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
static elementClean( $element, $attribs=[], $contents='')
Format an XML element as with self::element(), but run text through the $wgContLang->normalize() vali...
static wrapClass( $text, $class, $tag='span', $attribs=[])
Shortcut to make a specific element with a class attribute.
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
static fetchLanguageNames( $inLanguage=null, $include='mw')
Get an array of language names, indexed by code.
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 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 $content
if(is_array( $mode)) switch( $mode) $input
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 $tag
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
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
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections and Diff & $tabindex
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
do that in ParserLimitReportFormat instead $parser
static getInstance( $ts=false)
Get a timestamp instance in GMT.
when a variable name is used in a it is silently declared as a new masking the global
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 attrib( $name, $present=true)
Internal function for use in checkboxes and radio buttons and such.
$wgLanguageCode
Site language code.
static span( $text, $class, $attribs=[])
Shortcut to make a span element.
static radioLabel( $label, $name, $value, $id, $checked=false, $attribs=[])
Convenience function to build an HTML radio button with a label.
static closeElement( $element)
Shortcut to close an XML element.
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
static isWellFormedXmlFragment( $text)
Check if a string is a well-formed XML fragment.
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 modifiable & $code
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 dateMenu( $year, $month)
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
static buildTable( $rows, $attribs=[], $headers=null)
Build a table of data.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static monthSelector( $selected='', $allmonths=null, $id='month')
Create a date selector.
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field with a label.
Module of static functions for generating XML.
static escapeTagsOnly( $in)
Replace " > and < with their respective HTML entities ( ", >, <)
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 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 $options
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
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