113 if ( isset( $attrs[
'class'] ) ) {
114 if ( is_array( $attrs[
'class'] ) ) {
115 $attrs[
'class'][] =
'mw-ui-button';
116 $attrs[
'class'] = array_merge( $attrs[
'class'], $modifiers );
118 $attrs[
'class'] = implode(
' ', $attrs[
'class'] );
120 $attrs[
'class'] .=
' mw-ui-button ' . implode(
' ', $modifiers );
124 $attrs[
'class'] =
'mw-ui-button ' . implode(
' ', $modifiers );
140 if ( isset( $attrs[
'class'] ) ) {
141 if ( is_array( $attrs[
'class'] ) ) {
142 $attrs[
'class'][] =
'mw-ui-input';
144 $attrs[
'class'] .=
' mw-ui-input';
147 $attrs[
'class'] =
'mw-ui-input';
168 self::buttonAttributes( $attrs, $modifiers ),
187 $attrs[
'type'] =
'submit';
188 $attrs[
'value'] = $contents;
189 return self::element(
'input', self::buttonAttributes( $attrs, $modifiers ) );
212 if ( in_array( $element, self::$voidElements ) ) {
214 return substr( $start, 0, -1 ) .
'/>';
252 $element = strtolower( $element );
255 if ( $element ==
'input' ) {
283 if ( isset(
$attribs[
'type'] ) && !in_array(
$attribs[
'type'], $validTypes ) ) {
291 if ( $element ==
'button' && !isset(
$attribs[
'type'] ) ) {
296 self::dropDefaults( $element,
$attribs ) ) .
'>';
307 $element = strtolower( $element );
309 return "</$element>";
332 static $attribDefaults = [
333 'area' => [
'shape' =>
'rect' ],
335 'formaction' =>
'GET',
336 'formenctype' =>
'application/x-www-form-urlencoded',
342 'command' => [
'type' =>
'command' ],
345 'autocomplete' =>
'on',
346 'enctype' =>
'application/x-www-form-urlencoded',
349 'formaction' =>
'GET',
352 'keygen' => [
'keytype' =>
'rsa' ],
353 'link' => [
'media' =>
'all' ],
354 'menu' => [
'type' =>
'list' ],
355 'script' => [
'type' =>
'text/javascript' ],
358 'type' =>
'text/css',
360 'textarea' => [
'wrap' =>
'soft' ],
363 $element = strtolower( $element );
366 $lcattrib = strtolower( $attrib );
367 if ( is_array(
$value ) ) {
374 if ( isset( $attribDefaults[$element][$lcattrib] )
375 && $attribDefaults[$element][$lcattrib] ==
$value
380 if ( $lcattrib ==
'class' &&
$value ==
'' ) {
386 if ( $element ===
'link'
391 if ( $element ===
'input' ) {
394 if (
$type ===
'checkbox' ||
$type ===
'radio' ) {
401 } elseif (
$type ===
'submit' ) {
414 if ( $element ===
'select' && isset(
$attribs[
'size'] ) ) {
415 if ( in_array(
'multiple',
$attribs )
419 if ( strval(
$attribs[
'size'] ) ==
'4' ) {
424 if ( strval(
$attribs[
'size'] ) ==
'1' ) {
482 if ( is_int( $key ) && in_array( strtolower(
$value ), self::$boolAttribs ) ) {
488 $key = strtolower( $key );
501 if ( in_array( $key, [
'max',
'min',
'pattern',
'required' ] )
502 || $key ===
'step' &&
$value !==
'any' ) {
508 $spaceSeparatedListAttributes = [
518 if ( in_array( $key, $spaceSeparatedListAttributes ) ) {
523 if ( is_array(
$value ) ) {
527 if ( is_string( $v ) ) {
530 if ( !isset(
$value[$v] ) ) {
542 $value = implode(
' ', $newValue );
552 } elseif ( is_array(
$value ) ) {
553 throw new MWException(
"HTML attribute $key can not contain a list of values" );
558 if ( in_array( $key, self::$boolAttribs ) ) {
559 $ret .=
" $key=\"\"";
582 $ret .=
" $key=$quote" . strtr(
$value, $map ) . $quote;
600 if ( preg_match(
'/[<&]/', $contents ) ) {
601 $contents =
"/*<![CDATA[*/$contents/*]]>*/";
615 $attrs = [
'src' => $url ];
633 $contents = strtr( $contents, [
637 ']]>' =>
'\5D\5D\3E '
640 if ( preg_match(
'/[<&]/', $contents ) ) {
641 $contents =
"/*<![CDATA[*/$contents/*]]>*/";
659 'rel' =>
'stylesheet',
680 if ( in_array(
$type, [
'text',
'search',
'email',
'password',
'number' ] ) ) {
683 if ( in_array(
$type, [
'button',
'reset',
'submit' ] ) ) {
778 if ( substr(
$value, 0, 1 ) ==
"\n" ) {
783 $spacedValue =
"\n" .
$value;
800 if ( !isset(
$params[
'exclude'] ) || !is_array(
$params[
'exclude'] ) ) {
804 if ( isset(
$params[
'all'] ) ) {
821 $nsName =
wfMessage(
'blanknamespace' )->text();
822 } elseif ( is_int( $nsId ) ) {
825 $optionsOut[$nsId] = $nsName;
848 array $selectAttribs = []
850 ksort( $selectAttribs );
853 if ( isset(
$params[
'selected'] ) ) {
858 if ( preg_match(
'/^\d+$/',
$params[
'selected'] ) ) {
866 if ( !isset(
$params[
'disable'] ) || !is_array(
$params[
'disable'] ) ) {
878 'disabled' => in_array( $nsId,
$params[
'disable'] ),
880 'selected' => $nsId ===
$params[
'selected'],
885 if ( !array_key_exists(
'id', $selectAttribs ) ) {
886 $selectAttribs[
'id'] =
'namespace';
889 if ( !array_key_exists(
'name', $selectAttribs ) ) {
890 $selectAttribs[
'name'] =
'namespace';
894 if ( isset(
$params[
'label'] ) ) {
897 'for' => isset( $selectAttribs[
'id'] ) ? $selectAttribs[
'id'] :
null,
905 . implode(
"\n", $optionsHtml )
930 $ret .=
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?" .
">\n";
933 $attribs[
'xmlns'] =
'http://www.w3.org/1999/xhtml';
941 $ret .=
"<!DOCTYPE html>\n";
969 # * Any MIME type with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
970 return (
bool)preg_match(
'!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
983 static function infoBox( $text, $icon, $alt, $class =
'' ) {
1032 foreach (
$urls as $density => $url ) {
1034 $candidates[] = $url .
' ' . (float)$density .
'x';
1036 return implode(
", ", $candidates );
$wgMimeType
The default Content-Type header.
$wgUseMediaWikiUIEverywhere
Temporary variable that applies MediaWiki UI wherever it can be supported.
$wgHtml5Version
Defines the value of the version attribute in the <html> tag, if any.
$wgXhtmlNamespaces
Permit other namespaces in addition to the w3.org default.
This class is a collection of static functions that serve two purposes:
static label( $label, $id, array $attribs=[])
Convenience function for generating a label for inputs.
static textarea( $name, $value='', array $attribs=[])
Convenience function to produce a <textarea> element.
static infoBox( $text, $icon, $alt, $class='')
Get HTML for an info box with an icon.
static namespaceSelectorOptions(array $params=[])
Helper for Html::namespaceSelector().
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
static buttonAttributes(array $attrs, array $modifiers=[])
Modifies a set of attributes meant for button elements and apply a set of default attributes when $wg...
static linkedStyle( $url, $media='all')
Output a "<link rel=stylesheet>" linking to the given URL for the given media type (if any).
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static isXmlMimeType( $mimetype)
Determines if the given MIME type is xml.
static linkButton( $contents, array $attrs, array $modifiers=[])
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enab...
static htmlHeader(array $attribs=[])
Constructs the opening html-tag with necessary doctypes depending on global variables.
static input( $name, $value='', $type='text', array $attribs=[])
Convenience function to produce an "<input>" element.
static dropDefaults( $element, array $attribs)
Given an element name and an associative array of element attributes, return an array that is functio...
static submitButton( $contents, array $attrs, array $modifiers=[])
Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enab...
static getTextInputAttributes(array $attrs)
Modifies a set of attributes meant for text input elements and apply a set of default attributes.
static radio( $name, $checked=false, array $attribs=[])
Convenience function to produce a radio button (input element with type=radio)
static expandAttributes(array $attribs)
Given an associative array of element attributes, generate a string to stick after the element name i...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static inlineScript( $contents)
Output a "<script>" tag with the given contents.
static check( $name, $checked=false, array $attribs=[])
Convenience function to produce a checkbox (input element with type=checkbox)
static srcSet(array $urls)
Generate a srcset attribute value.
static inlineStyle( $contents, $media='all')
Output a "<style>" tag with the given contents for the given media type (if any).
static closeElement( $element)
Returns "</$element>".
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
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 local content language as $wgContLang
when a variable name is used in a it is silently declared as a new local masking the global
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
the array() calling protocol came about after MediaWiki 1.4rc1.
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
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 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 "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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 $options
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 & $ret
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
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
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
Allows to change the fields on the form that will be generated $name
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