MediaWiki REL1_32
Xml.php
Go to the documentation of this file.
1<?php
24
28class Xml {
41 public static function element( $element, $attribs = null, $contents = '',
42 $allowShortTag = true
43 ) {
44 $out = '<' . $element;
45 if ( !is_null( $attribs ) ) {
46 $out .= self::expandAttributes( $attribs );
47 }
48 if ( is_null( $contents ) ) {
49 $out .= '>';
50 } else {
51 if ( $allowShortTag && $contents === '' ) {
52 $out .= ' />';
53 } else {
54 $out .= '>' . htmlspecialchars( $contents, ENT_NOQUOTES ) . "</$element>";
55 }
56 }
57 return $out;
58 }
59
69 public static function expandAttributes( $attribs ) {
70 $out = '';
71 if ( is_null( $attribs ) ) {
72 return null;
73 } elseif ( is_array( $attribs ) ) {
74 foreach ( $attribs as $name => $val ) {
75 $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"';
76 }
77 return $out;
78 } else {
79 throw new MWException( 'Expected attribute array, got something else in ' . __METHOD__ );
80 }
81 }
82
92 public static function elementClean( $element, $attribs = [], $contents = '' ) {
93 if ( $attribs ) {
94 $attribs = array_map( [ 'UtfNormal\Validator', 'cleanUp' ], $attribs );
95 }
96 if ( $contents ) {
97 $contents =
98 MediaWikiServices::getInstance()->getContentLanguage()->normalize( $contents );
99 }
100 return self::element( $element, $attribs, $contents );
101 }
102
110 public static function openElement( $element, $attribs = null ) {
111 return '<' . $element . self::expandAttributes( $attribs ) . '>';
112 }
113
119 public static function closeElement( $element ) {
120 return "</$element>";
121 }
122
132 public static function tags( $element, $attribs, $contents ) {
133 return self::openElement( $element, $attribs ) . $contents . "</$element>";
134 }
135
145 public static function monthSelector( $selected = '', $allmonths = null, $id = 'month' ) {
146 global $wgLang;
147 $options = [];
148 $data = new XmlSelect( 'month', $id, $selected );
149 if ( is_null( $selected ) ) {
150 $selected = '';
151 }
152 if ( !is_null( $allmonths ) ) {
153 $options[wfMessage( 'monthsall' )->text()] = $allmonths;
154 }
155 for ( $i = 1; $i < 13; $i++ ) {
156 $options[$wgLang->getMonthName( $i )] = $i;
157 }
158 $data->addOptions( $options );
159 $data->setAttribute( 'class', 'mw-month-selector' );
160 return $data->getHTML();
161 }
162
169 public static function dateMenu( $year, $month ) {
170 # Offset overrides year/month selection
171 if ( $month && $month !== -1 ) {
172 $encMonth = intval( $month );
173 } else {
174 $encMonth = '';
175 }
176 if ( $year ) {
177 $encYear = intval( $year );
178 } elseif ( $encMonth ) {
179 $timestamp = MWTimestamp::getInstance();
180 $thisMonth = intval( $timestamp->format( 'n' ) );
181 $thisYear = intval( $timestamp->format( 'Y' ) );
182 if ( intval( $encMonth ) > $thisMonth ) {
183 $thisYear--;
184 }
185 $encYear = $thisYear;
186 } else {
187 $encYear = '';
188 }
189 $inputAttribs = [ 'id' => 'year', 'maxlength' => 4, 'size' => 7 ];
190 return self::label( wfMessage( 'year' )->text(), 'year' ) . ' ' .
191 Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' ' .
192 self::label( wfMessage( 'month' )->text(), 'month' ) . ' ' .
193 self::monthSelector( $encMonth, -1 );
194 }
195
206 public static function languageSelector( $selected, $customisedOnly = true,
207 $inLanguage = null, $overrideAttrs = [], Message $msg = null
208 ) {
209 global $wgLanguageCode;
210
211 $include = $customisedOnly ? 'mwfile' : 'mw';
212 $languages = Language::fetchLanguageNames( $inLanguage, $include );
213
214 // Make sure the site language is in the list;
215 // a custom language code might not have a defined name...
216 if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
218 // Sort the array again
219 ksort( $languages );
220 }
221
227 $selected = isset( $languages[$selected] ) ? $selected : $wgLanguageCode;
228 $options = "\n";
229 foreach ( $languages as $code => $name ) {
230 $options .= self::option( "$code - $name", $code, $code == $selected ) . "\n";
231 }
232
233 $attrs = [ 'id' => 'wpUserLanguage', 'name' => 'wpUserLanguage' ];
234 $attrs = array_merge( $attrs, $overrideAttrs );
235
236 if ( $msg === null ) {
237 $msg = wfMessage( 'yourlanguage' );
238 }
239 return [
240 self::label( $msg->text(), $attrs['id'] ),
241 self::tags( 'select', $attrs, $options )
242 ];
243 }
244
252 public static function span( $text, $class, $attribs = [] ) {
253 return self::element( 'span', [ 'class' => $class ] + $attribs, $text );
254 }
255
264 public static function wrapClass( $text, $class, $tag = 'span', $attribs = [] ) {
265 return self::tags( $tag, [ 'class' => $class ] + $attribs, $text );
266 }
267
276 public static function input( $name, $size = false, $value = false, $attribs = [] ) {
277 $attributes = [ 'name' => $name ];
278
279 if ( $size ) {
280 $attributes['size'] = $size;
281 }
282
283 if ( $value !== false ) { // maybe 0
284 $attributes['value'] = $value;
285 }
286
287 return self::element( 'input',
288 Html::getTextInputAttributes( $attributes + $attribs ) );
289 }
290
299 public static function password( $name, $size = false, $value = false,
300 $attribs = []
301 ) {
302 return self::input( $name, $size, $value,
303 array_merge( $attribs, [ 'type' => 'password' ] ) );
304 }
305
314 public static function attrib( $name, $present = true ) {
315 return $present ? [ $name => $name ] : [];
316 }
317
325 public static function check( $name, $checked = false, $attribs = [] ) {
326 return self::element( 'input', array_merge(
327 [
328 'name' => $name,
329 'type' => 'checkbox',
330 'value' => 1 ],
331 self::attrib( 'checked', $checked ),
332 $attribs ) );
333 }
334
343 public static function radio( $name, $value, $checked = false, $attribs = [] ) {
344 return self::element( 'input', [
345 'name' => $name,
346 'type' => 'radio',
347 'value' => $value ] + self::attrib( 'checked', $checked ) + $attribs );
348 }
349
360 public static function label( $label, $id, $attribs = [] ) {
361 $a = [ 'for' => $id ];
362
363 foreach ( [ 'class', 'title' ] as $attr ) {
364 if ( isset( $attribs[$attr] ) ) {
365 $a[$attr] = $attribs[$attr];
366 }
367 }
368
369 return self::element( 'label', $a, $label );
370 }
371
382 public static function inputLabel( $label, $name, $id, $size = false,
383 $value = false, $attribs = []
384 ) {
385 list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
386 return $label . "\u{00A0}" . $input;
387 }
388
401 public static function inputLabelSep( $label, $name, $id, $size = false,
402 $value = false, $attribs = []
403 ) {
404 return [
405 self::label( $label, $id, $attribs ),
406 self::input( $name, $size, $value, [ 'id' => $id ] + $attribs )
407 ];
408 }
409
421 public static function checkLabel( $label, $name, $id, $checked = false, $attribs = [] ) {
423 $chkLabel = self::check( $name, $checked, [ 'id' => $id ] + $attribs ) .
424 "\u{00A0}" .
425 self::label( $label, $id, $attribs );
426
428 $chkLabel = self::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) .
429 $chkLabel . self::closeElement( 'div' );
430 }
431 return $chkLabel;
432 }
433
446 public static function radioLabel( $label, $name, $value, $id,
447 $checked = false, $attribs = []
448 ) {
449 return self::radio( $name, $value, $checked, [ 'id' => $id ] + $attribs ) .
450 "\u{00A0}" .
451 self::label( $label, $id, $attribs );
452 }
453
461 public static function submitButton( $value, $attribs = [] ) {
463 $baseAttrs = [
464 'type' => 'submit',
465 'value' => $value,
466 ];
467 // Done conditionally for time being as it is possible
468 // some submit forms
469 // might need to be mw-ui-destructive (e.g. delete a page)
471 $baseAttrs['class'] = 'mw-ui-button mw-ui-progressive';
472 }
473 // Any custom attributes will take precendence of anything in baseAttrs e.g. override the class
474 $attribs = $attribs + $baseAttrs;
475 return Html::element( 'input', $attribs );
476 }
477
486 public static function option( $text, $value = null, $selected = false,
487 $attribs = [] ) {
488 if ( !is_null( $value ) ) {
489 $attribs['value'] = $value;
490 }
491 if ( $selected ) {
492 $attribs['selected'] = 'selected';
493 }
494 return Html::element( 'option', $attribs, $text );
495 }
496
510 public static function listDropDown( $name = '', $list = '', $other = '',
511 $selected = '', $class = '', $tabindex = null
512 ) {
513 $options = self::listDropDownOptions( $list, [ 'other' => $other ] );
514
515 $xmlSelect = new XmlSelect( $name, $name, $selected );
516 $xmlSelect->addOptions( $options );
517
518 if ( $class ) {
519 $xmlSelect->setAttribute( 'class', $class );
520 }
521 if ( $tabindex ) {
522 $xmlSelect->setAttribute( 'tabindex', $tabindex );
523 }
524
525 return $xmlSelect->getHTML();
526 }
527
541 public static function listDropDownOptions( $list, $params = [] ) {
542 $options = [];
543
544 if ( isset( $params['other'] ) ) {
545 $options[ $params['other'] ] = 'other';
546 }
547
548 $optgroup = false;
549 foreach ( explode( "\n", $list ) as $option ) {
550 $value = trim( $option );
551 if ( $value == '' ) {
552 continue;
553 } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
554 # A new group is starting...
555 $value = trim( substr( $value, 1 ) );
556 $optgroup = $value;
557 } elseif ( substr( $value, 0, 2 ) == '**' ) {
558 # groupmember
559 $opt = trim( substr( $value, 2 ) );
560 if ( $optgroup === false ) {
561 $options[$opt] = $opt;
562 } else {
563 $options[$optgroup][$opt] = $opt;
564 }
565 } else {
566 # groupless reason list
567 $optgroup = false;
568 $options[$option] = $option;
569 }
570 }
571
572 return $options;
573 }
574
583 public static function listDropDownOptionsOoui( $options ) {
584 $optionsOoui = [];
585
586 foreach ( $options as $text => $value ) {
587 if ( is_array( $value ) ) {
588 $optionsOoui[] = [ 'optgroup' => (string)$text ];
589 foreach ( $value as $text2 => $value2 ) {
590 $optionsOoui[] = [ 'data' => (string)$value2, 'label' => (string)$text2 ];
591 }
592 } else {
593 $optionsOoui[] = [ 'data' => (string)$value, 'label' => (string)$text ];
594 }
595 }
596
597 return $optionsOoui;
598 }
599
611 public static function fieldset( $legend = false, $content = false, $attribs = [] ) {
612 $s = self::openElement( 'fieldset', $attribs ) . "\n";
613
614 if ( $legend ) {
615 $s .= self::element( 'legend', null, $legend ) . "\n";
616 }
617
618 if ( $content !== false ) {
619 $s .= $content . "\n";
620 $s .= self::closeElement( 'fieldset' ) . "\n";
621 }
622
623 return $s;
624 }
625
637 public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = [] ) {
638 return self::element( 'textarea',
639 Html::getTextInputAttributes(
640 [
641 'name' => $name,
642 'id' => $name,
643 'cols' => $cols,
644 'rows' => $rows
645 ] + $attribs
646 ),
647 $content, false );
648 }
649
661 public static function encodeJsVar( $value, $pretty = false ) {
662 if ( $value instanceof XmlJsCode ) {
663 return $value->value;
664 }
665 return FormatJson::encode( $value, $pretty, FormatJson::UTF8_OK );
666 }
667
679 public static function encodeJsCall( $name, $args, $pretty = false ) {
680 foreach ( $args as &$arg ) {
681 $arg = self::encodeJsVar( $arg, $pretty );
682 if ( $arg === false ) {
683 return false;
684 }
685 }
686
687 return "$name(" . ( $pretty
688 ? ( ' ' . implode( ', ', $args ) . ' ' )
689 : implode( ',', $args )
690 ) . ");";
691 }
692
704 private static function isWellFormed( $text ) {
705 $parser = xml_parser_create( "UTF-8" );
706
707 # case folding violates XML standard, turn it off
708 xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
709
710 if ( !xml_parse( $parser, $text, true ) ) {
711 // $err = xml_error_string( xml_get_error_code( $parser ) );
712 // $position = xml_get_current_byte_index( $parser );
713 // $fragment = $this->extractFragment( $html, $position );
714 // $this->mXmlError = "$err at byte $position:\n$fragment";
715 xml_parser_free( $parser );
716 return false;
717 }
718
719 xml_parser_free( $parser );
720
721 return true;
722 }
723
732 public static function isWellFormedXmlFragment( $text ) {
733 $html =
734 Sanitizer::hackDocType() .
735 '<html>' .
736 $text .
737 '</html>';
738
739 return self::isWellFormed( $html );
740 }
741
749 public static function escapeTagsOnly( $in ) {
750 return str_replace(
751 [ '"', '>', '<' ],
752 [ '&quot;', '&gt;', '&lt;' ],
753 $in );
754 }
755
767 public static function buildForm( $fields, $submitLabel = null, $submitAttribs = [] ) {
768 $form = '';
769 $form .= "<table><tbody>";
770
771 foreach ( $fields as $labelmsg => $input ) {
772 $id = "mw-$labelmsg";
773 $form .= self::openElement( 'tr', [ 'id' => $id ] );
774
775 // TODO use a <label> here for accessibility purposes - will need
776 // to either not use a table to build the form, or find the ID of
777 // the input somehow.
778
779 $form .= self::tags( 'td', [ 'class' => 'mw-label' ], wfMessage( $labelmsg )->parse() );
780 $form .= self::openElement( 'td', [ 'class' => 'mw-input' ] )
781 . $input . self::closeElement( 'td' );
782 $form .= self::closeElement( 'tr' );
783 }
784
785 if ( $submitLabel ) {
786 $form .= self::openElement( 'tr' );
787 $form .= self::tags( 'td', [], '' );
788 $form .= self::openElement( 'td', [ 'class' => 'mw-submit' ] )
789 . self::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs )
790 . self::closeElement( 'td' );
791 $form .= self::closeElement( 'tr' );
792 }
793
794 $form .= "</tbody></table>";
795
796 return $form;
797 }
798
806 public static function buildTable( $rows, $attribs = [], $headers = null ) {
807 $s = self::openElement( 'table', $attribs );
808
809 if ( is_array( $headers ) ) {
810 $s .= self::openElement( 'thead', $attribs );
811
812 foreach ( $headers as $id => $header ) {
813 $attribs = [];
814
815 if ( is_string( $id ) ) {
816 $attribs['id'] = $id;
817 }
818
819 $s .= self::element( 'th', $attribs, $header );
820 }
821 $s .= self::closeElement( 'thead' );
822 }
823
824 foreach ( $rows as $id => $row ) {
825 $attribs = [];
826
827 if ( is_string( $id ) ) {
828 $attribs['id'] = $id;
829 }
830
831 $s .= self::buildTableRow( $attribs, $row );
832 }
833
834 $s .= self::closeElement( 'table' );
835
836 return $s;
837 }
838
845 public static function buildTableRow( $attribs, $cells ) {
846 $s = self::openElement( 'tr', $attribs );
847
848 foreach ( $cells as $id => $cell ) {
849 $attribs = [];
850
851 if ( is_string( $id ) ) {
852 $attribs['id'] = $id;
853 }
854
855 $s .= self::element( 'td', $attribs, $cell );
856 }
857
858 $s .= self::closeElement( 'tr' );
859
860 return $s;
861 }
862}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
$wgLanguageCode
Site language code.
$wgUseMediaWikiUIEverywhere
Temporary variable that applies MediaWiki UI wherever it can be supported.
$wgLang
Definition Setup.php:910
if( $line===false) $args
Definition cdb.php:64
MediaWiki exception.
MediaWikiServices is the service locator for the application scope of MediaWiki.
The Message class provides methods which fulfil two basic services:
Definition Message.php:160
A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to interpret a given string a...
Definition XmlJsCode.php:39
Class for generating HTML <select> or <datalist> elements.
Definition XmlSelect.php:26
Module of static functions for generating XML.
Definition Xml.php:28
static password( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML password input field.
Definition Xml.php:299
static closeElement( $element)
Shortcut to close an XML element.
Definition Xml.php:119
static textarea( $name, $content, $cols=40, $rows=5, $attribs=[])
Shortcut for creating textareas.
Definition Xml.php:637
static inputLabelSep( $label, $name, $id, $size=false, $value=false, $attribs=[])
Same as Xml::inputLabel() but return input and label in an array.
Definition Xml.php:401
static isWellFormed( $text)
Check if a string is well-formed XML.
Definition Xml.php:704
static listDropDownOptions( $list, $params=[])
Build options for a drop-down box from a textual list.
Definition Xml.php:541
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
Definition Xml.php:661
static listDropDownOptionsOoui( $options)
Convert options for a drop-down box into a format accepted by OOUI\DropdownInputWidget etc.
Definition Xml.php:583
static isWellFormedXmlFragment( $text)
Check if a string is a well-formed XML fragment.
Definition Xml.php:732
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
Definition Xml.php:325
static dateMenu( $year, $month)
Definition Xml.php:169
static buildForm( $fields, $submitLabel=null, $submitAttribs=[])
Generate a form (without the opening form element).
Definition Xml.php:767
static attrib( $name, $present=true)
Internal function for use in checkboxes and radio buttons and such.
Definition Xml.php:314
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition Xml.php:360
static openElement( $element, $attribs=null)
This opens an XML element.
Definition Xml.php:110
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition Xml.php:276
static wrapClass( $text, $class, $tag='span', $attribs=[])
Shortcut to make a specific element with a class attribute.
Definition Xml.php:264
static buildTable( $rows, $attribs=[], $headers=null)
Build a table of data.
Definition Xml.php:806
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition Xml.php:461
static option( $text, $value=null, $selected=false, $attribs=[])
Convenience function to build an HTML drop-down list item.
Definition Xml.php:486
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition Xml.php:421
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field with a label.
Definition Xml.php:382
static languageSelector( $selected, $customisedOnly=true, $inLanguage=null, $overrideAttrs=[], Message $msg=null)
Construct a language selector appropriate for use in a form or preferences.
Definition Xml.php:206
static expandAttributes( $attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : att...
Definition Xml.php:69
static span( $text, $class, $attribs=[])
Shortcut to make a span element.
Definition Xml.php:252
static escapeTagsOnly( $in)
Replace " > and < with their respective HTML entities ( ", >, <)
Definition Xml.php:749
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition Xml.php:132
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition Xml.php:41
static radio( $name, $value, $checked=false, $attribs=[])
Convenience function to build an HTML radio button.
Definition Xml.php:343
static buildTableRow( $attribs, $cells)
Build a row for a table.
Definition Xml.php:845
static radioLabel( $label, $name, $value, $id, $checked=false, $attribs=[])
Convenience function to build an HTML radio button with a label.
Definition Xml.php:446
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition Xml.php:679
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
Definition Xml.php:510
static monthSelector( $selected='', $allmonths=null, $id='month')
Create a date selector.
Definition Xml.php:145
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition Xml.php:611
static elementClean( $element, $attribs=[], $contents='')
Format an XML element as with self::element(), but run text through the content language's normalize(...
Definition Xml.php:92
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
Definition deferred.txt:11
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
Definition hooks.txt:2857
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
Definition hooks.txt:1873
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition hooks.txt:181
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 & $options
Definition hooks.txt:2050
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
Definition hooks.txt:895
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
Definition hooks.txt:1475
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 use $formDescriptor instead 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 "&lt;div ...>$1&lt;/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 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:894
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:2062
Allows to change the fields on the form that will be generated $name
Definition hooks.txt:302
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 initially an empty< div id="toolbar"></div > Hook subscribers can return false to have no toolbar HTML be loaded overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
Definition hooks.txt:1514
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
Definition hooks.txt:2063
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
$content
if(is_array($mode)) switch( $mode) $input
$params
switch( $options['output']) $languages
Definition transstat.php:76
$header