MediaWiki  1.29.1
Xml.php
Go to the documentation of this file.
1 <?php
26 class Xml {
39  public static function element( $element, $attribs = null, $contents = '',
40  $allowShortTag = true
41  ) {
42  $out = '<' . $element;
43  if ( !is_null( $attribs ) ) {
45  }
46  if ( is_null( $contents ) ) {
47  $out .= '>';
48  } else {
49  if ( $allowShortTag && $contents === '' ) {
50  $out .= ' />';
51  } else {
52  $out .= '>' . htmlspecialchars( $contents ) . "</$element>";
53  }
54  }
55  return $out;
56  }
57 
67  public static function expandAttributes( $attribs ) {
68  $out = '';
69  if ( is_null( $attribs ) ) {
70  return null;
71  } elseif ( is_array( $attribs ) ) {
72  foreach ( $attribs as $name => $val ) {
73  $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"';
74  }
75  return $out;
76  } else {
77  throw new MWException( 'Expected attribute array, got something else in ' . __METHOD__ );
78  }
79  }
80 
91  public static function elementClean( $element, $attribs = [], $contents = '' ) {
93  if ( $attribs ) {
94  $attribs = array_map( [ 'UtfNormal\Validator', 'cleanUp' ], $attribs );
95  }
96  if ( $contents ) {
97  $contents = $wgContLang->normalize( $contents );
98  }
99  return self::element( $element, $attribs, $contents );
100  }
101 
109  public static function openElement( $element, $attribs = null ) {
110  return '<' . $element . self::expandAttributes( $attribs ) . '>';
111  }
112 
118  public static function closeElement( $element ) {
119  return "</$element>";
120  }
121 
131  public static function tags( $element, $attribs = null, $contents ) {
132  return self::openElement( $element, $attribs ) . $contents . "</$element>";
133  }
134 
144  public static function monthSelector( $selected = '', $allmonths = null, $id = 'month' ) {
145  global $wgLang;
146  $options = [];
147  $data = new XmlSelect( 'month', $id, $selected );
148  if ( is_null( $selected ) ) {
149  $selected = '';
150  }
151  if ( !is_null( $allmonths ) ) {
152  $options[wfMessage( 'monthsall' )->text()] = $allmonths;
153  }
154  for ( $i = 1; $i < 13; $i++ ) {
155  $options[$wgLang->getMonthName( $i )] = $i;
156  }
157  $data->addOptions( $options );
158  $data->setAttribute( 'class', 'mw-month-selector' );
159  return $data->getHTML();
160  }
161 
167  public static function dateMenu( $year, $month ) {
168  # Offset overrides year/month selection
169  if ( $month && $month !== -1 ) {
170  $encMonth = intval( $month );
171  } else {
172  $encMonth = '';
173  }
174  if ( $year ) {
175  $encYear = intval( $year );
176  } elseif ( $encMonth ) {
177  $timestamp = MWTimestamp::getInstance();
178  $thisMonth = intval( $timestamp->format( 'n' ) );
179  $thisYear = intval( $timestamp->format( 'Y' ) );
180  if ( intval( $encMonth ) > $thisMonth ) {
181  $thisYear--;
182  }
183  $encYear = $thisYear;
184  } else {
185  $encYear = '';
186  }
187  $inputAttribs = [ 'id' => 'year', 'maxlength' => 4, 'size' => 7 ];
188  return self::label( wfMessage( 'year' )->text(), 'year' ) . ' ' .
189  Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' ' .
190  self::label( wfMessage( 'month' )->text(), 'month' ) . ' ' .
191  self::monthSelector( $encMonth, -1 );
192  }
193 
204  public static function languageSelector( $selected, $customisedOnly = true,
205  $inLanguage = null, $overrideAttrs = [], Message $msg = null
206  ) {
208 
209  $include = $customisedOnly ? 'mwfile' : 'mw';
210  $languages = Language::fetchLanguageNames( $inLanguage, $include );
211 
212  // Make sure the site language is in the list;
213  // a custom language code might not have a defined name...
214  if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
216  }
217 
218  ksort( $languages );
219 
225  $selected = isset( $languages[$selected] ) ? $selected : $wgLanguageCode;
226  $options = "\n";
227  foreach ( $languages as $code => $name ) {
228  $options .= Xml::option( "$code - $name", $code, $code == $selected ) . "\n";
229  }
230 
231  $attrs = [ 'id' => 'wpUserLanguage', 'name' => 'wpUserLanguage' ];
232  $attrs = array_merge( $attrs, $overrideAttrs );
233 
234  if ( $msg === null ) {
235  $msg = wfMessage( 'yourlanguage' );
236  }
237  return [
238  Xml::label( $msg->text(), $attrs['id'] ),
239  Xml::tags( 'select', $attrs, $options )
240  ];
241  }
242 
250  public static function span( $text, $class, $attribs = [] ) {
251  return self::element( 'span', [ 'class' => $class ] + $attribs, $text );
252  }
253 
262  public static function wrapClass( $text, $class, $tag = 'span', $attribs = [] ) {
263  return self::tags( $tag, [ 'class' => $class ] + $attribs, $text );
264  }
265 
274  public static function input( $name, $size = false, $value = false, $attribs = [] ) {
275  $attributes = [ 'name' => $name ];
276 
277  if ( $size ) {
278  $attributes['size'] = $size;
279  }
280 
281  if ( $value !== false ) { // maybe 0
282  $attributes['value'] = $value;
283  }
284 
285  return self::element( 'input',
286  Html::getTextInputAttributes( $attributes + $attribs ) );
287  }
288 
297  public static function password( $name, $size = false, $value = false,
298  $attribs = []
299  ) {
300  return self::input( $name, $size, $value,
301  array_merge( $attribs, [ 'type' => 'password' ] ) );
302  }
303 
312  public static function attrib( $name, $present = true ) {
313  return $present ? [ $name => $name ] : [];
314  }
315 
323  public static function check( $name, $checked = false, $attribs = [] ) {
324  return self::element( 'input', array_merge(
325  [
326  'name' => $name,
327  'type' => 'checkbox',
328  'value' => 1 ],
329  self::attrib( 'checked', $checked ),
330  $attribs ) );
331  }
332 
341  public static function radio( $name, $value, $checked = false, $attribs = [] ) {
342  return self::element( 'input', [
343  'name' => $name,
344  'type' => 'radio',
345  'value' => $value ] + self::attrib( 'checked', $checked ) + $attribs );
346  }
347 
358  public static function label( $label, $id, $attribs = [] ) {
359  $a = [ 'for' => $id ];
360 
361  foreach ( [ 'class', 'title' ] as $attr ) {
362  if ( isset( $attribs[$attr] ) ) {
363  $a[$attr] = $attribs[$attr];
364  }
365  }
366 
367  return self::element( 'label', $a, $label );
368  }
369 
380  public static function inputLabel( $label, $name, $id, $size = false,
381  $value = false, $attribs = []
382  ) {
383  list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
384  return $label . '&#160;' . $input;
385  }
386 
399  public static function inputLabelSep( $label, $name, $id, $size = false,
400  $value = false, $attribs = []
401  ) {
402  return [
403  Xml::label( $label, $id, $attribs ),
404  self::input( $name, $size, $value, [ 'id' => $id ] + $attribs )
405  ];
406  }
407 
419  public static function checkLabel( $label, $name, $id, $checked = false, $attribs = [] ) {
420  global $wgUseMediaWikiUIEverywhere;
421  $chkLabel = self::check( $name, $checked, [ 'id' => $id ] + $attribs ) .
422  '&#160;' .
423  self::label( $label, $id, $attribs );
424 
425  if ( $wgUseMediaWikiUIEverywhere ) {
426  $chkLabel = self::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) .
427  $chkLabel . self::closeElement( 'div' );
428  }
429  return $chkLabel;
430  }
431 
444  public static function radioLabel( $label, $name, $value, $id,
445  $checked = false, $attribs = []
446  ) {
447  return self::radio( $name, $value, $checked, [ 'id' => $id ] + $attribs ) .
448  '&#160;' .
449  self::label( $label, $id, $attribs );
450  }
451 
459  public static function submitButton( $value, $attribs = [] ) {
460  global $wgUseMediaWikiUIEverywhere;
461  $baseAttrs = [
462  'type' => 'submit',
463  'value' => $value,
464  ];
465  // Done conditionally for time being as it is possible
466  // some submit forms
467  // might need to be mw-ui-destructive (e.g. delete a page)
468  if ( $wgUseMediaWikiUIEverywhere ) {
469  $baseAttrs['class'] = 'mw-ui-button mw-ui-progressive';
470  }
471  // Any custom attributes will take precendence of anything in baseAttrs e.g. override the class
472  $attribs = $attribs + $baseAttrs;
473  return Html::element( 'input', $attribs );
474  }
475 
484  public static function option( $text, $value = null, $selected = false,
485  $attribs = [] ) {
486  if ( !is_null( $value ) ) {
487  $attribs['value'] = $value;
488  }
489  if ( $selected ) {
490  $attribs['selected'] = 'selected';
491  }
492  return Html::element( 'option', $attribs, $text );
493  }
494 
507  public static function listDropDown( $name = '', $list = '', $other = '',
508  $selected = '', $class = '', $tabindex = null
509  ) {
510  $optgroup = false;
511 
512  $options = self::option( $other, 'other', $selected === 'other' );
513 
514  foreach ( explode( "\n", $list ) as $option ) {
515  $value = trim( $option );
516  if ( $value == '' ) {
517  continue;
518  } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
519  // A new group is starting ...
520  $value = trim( substr( $value, 1 ) );
521  if ( $optgroup ) {
522  $options .= self::closeElement( 'optgroup' );
523  }
524  $options .= self::openElement( 'optgroup', [ 'label' => $value ] );
525  $optgroup = true;
526  } elseif ( substr( $value, 0, 2 ) == '**' ) {
527  // groupmember
528  $value = trim( substr( $value, 2 ) );
529  $options .= self::option( $value, $value, $selected === $value );
530  } else {
531  // groupless reason list
532  if ( $optgroup ) {
533  $options .= self::closeElement( 'optgroup' );
534  }
535  $options .= self::option( $value, $value, $selected === $value );
536  $optgroup = false;
537  }
538  }
539 
540  if ( $optgroup ) {
541  $options .= self::closeElement( 'optgroup' );
542  }
543 
544  $attribs = [];
545 
546  if ( $name ) {
547  $attribs['id'] = $name;
548  $attribs['name'] = $name;
549  }
550 
551  if ( $class ) {
552  $attribs['class'] = $class;
553  }
554 
555  if ( $tabindex ) {
556  $attribs['tabindex'] = $tabindex;
557  }
558 
559  return Xml::openElement( 'select', $attribs )
560  . "\n"
561  . $options
562  . "\n"
563  . Xml::closeElement( 'select' );
564  }
565 
577  public static function fieldset( $legend = false, $content = false, $attribs = [] ) {
578  $s = Xml::openElement( 'fieldset', $attribs ) . "\n";
579 
580  if ( $legend ) {
581  $s .= Xml::element( 'legend', null, $legend ) . "\n";
582  }
583 
584  if ( $content !== false ) {
585  $s .= $content . "\n";
586  $s .= Xml::closeElement( 'fieldset' ) . "\n";
587  }
588 
589  return $s;
590  }
591 
603  public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = [] ) {
604  return self::element( 'textarea',
606  [
607  'name' => $name,
608  'id' => $name,
609  'cols' => $cols,
610  'rows' => $rows
611  ] + $attribs
612  ),
613  $content, false );
614  }
615 
627  public static function encodeJsVar( $value, $pretty = false ) {
628  if ( $value instanceof XmlJsCode ) {
629  return $value->value;
630  }
631  return FormatJson::encode( $value, $pretty, FormatJson::UTF8_OK );
632  }
633 
645  public static function encodeJsCall( $name, $args, $pretty = false ) {
646  foreach ( $args as &$arg ) {
647  $arg = Xml::encodeJsVar( $arg, $pretty );
648  if ( $arg === false ) {
649  return false;
650  }
651  }
652 
653  return "$name(" . ( $pretty
654  ? ( ' ' . implode( ', ', $args ) . ' ' )
655  : implode( ',', $args )
656  ) . ");";
657  }
658 
670  private static function isWellFormed( $text ) {
671  $parser = xml_parser_create( "UTF-8" );
672 
673  # case folding violates XML standard, turn it off
674  xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
675 
676  if ( !xml_parse( $parser, $text, true ) ) {
677  // $err = xml_error_string( xml_get_error_code( $parser ) );
678  // $position = xml_get_current_byte_index( $parser );
679  // $fragment = $this->extractFragment( $html, $position );
680  // $this->mXmlError = "$err at byte $position:\n$fragment";
681  xml_parser_free( $parser );
682  return false;
683  }
684 
685  xml_parser_free( $parser );
686 
687  return true;
688  }
689 
698  public static function isWellFormedXmlFragment( $text ) {
699  $html =
700  Sanitizer::hackDocType() .
701  '<html>' .
702  $text .
703  '</html>';
704 
705  return Xml::isWellFormed( $html );
706  }
707 
715  public static function escapeTagsOnly( $in ) {
716  return str_replace(
717  [ '"', '>', '<' ],
718  [ '&quot;', '&gt;', '&lt;' ],
719  $in );
720  }
721 
733  public static function buildForm( $fields, $submitLabel = null, $submitAttribs = [] ) {
734  $form = '';
735  $form .= "<table><tbody>";
736 
737  foreach ( $fields as $labelmsg => $input ) {
738  $id = "mw-$labelmsg";
739  $form .= Xml::openElement( 'tr', [ 'id' => $id ] );
740 
741  // TODO use a <label> here for accessibility purposes - will need
742  // to either not use a table to build the form, or find the ID of
743  // the input somehow.
744 
745  $form .= Xml::tags( 'td', [ 'class' => 'mw-label' ], wfMessage( $labelmsg )->parse() );
746  $form .= Xml::openElement( 'td', [ 'class' => 'mw-input' ] )
747  . $input . Xml::closeElement( 'td' );
748  $form .= Xml::closeElement( 'tr' );
749  }
750 
751  if ( $submitLabel ) {
752  $form .= Xml::openElement( 'tr' );
753  $form .= Xml::tags( 'td', [], '' );
754  $form .= Xml::openElement( 'td', [ 'class' => 'mw-submit' ] )
755  . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs )
756  . Xml::closeElement( 'td' );
757  $form .= Xml::closeElement( 'tr' );
758  }
759 
760  $form .= "</tbody></table>";
761 
762  return $form;
763  }
764 
772  public static function buildTable( $rows, $attribs = [], $headers = null ) {
773  $s = Xml::openElement( 'table', $attribs );
774 
775  if ( is_array( $headers ) ) {
776  $s .= Xml::openElement( 'thead', $attribs );
777 
778  foreach ( $headers as $id => $header ) {
779  $attribs = [];
780 
781  if ( is_string( $id ) ) {
782  $attribs['id'] = $id;
783  }
784 
785  $s .= Xml::element( 'th', $attribs, $header );
786  }
787  $s .= Xml::closeElement( 'thead' );
788  }
789 
790  foreach ( $rows as $id => $row ) {
791  $attribs = [];
792 
793  if ( is_string( $id ) ) {
794  $attribs['id'] = $id;
795  }
796 
797  $s .= Xml::buildTableRow( $attribs, $row );
798  }
799 
800  $s .= Xml::closeElement( 'table' );
801 
802  return $s;
803  }
804 
811  public static function buildTableRow( $attribs, $cells ) {
812  $s = Xml::openElement( 'tr', $attribs );
813 
814  foreach ( $cells as $id => $cell ) {
815  $attribs = [];
816 
817  if ( is_string( $id ) ) {
818  $attribs['id'] = $id;
819  }
820 
821  $s .= Xml::element( 'td', $attribs, $cell );
822  }
823 
824  $s .= Xml::closeElement( 'tr' );
825 
826  return $s;
827  }
828 }
829 
847 class XmlJsCode {
848  public $value;
849 
850  function __construct( $value ) {
851  $this->value = $value;
852  }
853 }
Xml\isWellFormed
static isWellFormed( $text)
Check if a string is well-formed XML.
Definition: Xml.php:670
Xml\buildTableRow
static buildTableRow( $attribs, $cells)
Build a row for a table.
Definition: Xml.php:811
Xml\expandAttributes
static expandAttributes( $attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : att...
Definition: Xml.php:67
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
Html\getTextInputAttributes
static getTextInputAttributes(array $attrs)
Modifies a set of attributes meant for text input elements and apply a set of default attributes.
Definition: Html.php:136
Xml\label
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:358
$languages
switch( $options['output']) $languages
Definition: transstat.php:76
text
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
Definition: design.txt:12
Xml\textarea
static textarea( $name, $content, $cols=40, $rows=5, $attribs=[])
Shortcut for creating textareas.
Definition: Xml.php:603
Xml\radio
static radio( $name, $value, $checked=false, $attribs=[])
Convenience function to build an HTML radio button.
Definition: Xml.php:341
Xml\inputLabelSep
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:399
Xml\option
static option( $text, $value=null, $selected=false, $attribs=[])
Convenience function to build an HTML drop-down list item.
Definition: Xml.php:484
$s
$s
Definition: mergeMessageFileList.php:188
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:304
Xml\password
static password( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML password input field.
Definition: Xml.php:297
Xml\buildForm
static buildForm( $fields, $submitLabel=null, $submitAttribs=[])
Generate a form (without the opening form element).
Definition: Xml.php:733
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
Xml\encodeJsVar
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
Definition: Xml.php:627
Xml\languageSelector
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:204
FormatJson\UTF8_OK
const UTF8_OK
Skip escaping most characters above U+007F for readability and compactness.
Definition: FormatJson.php:34
php
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:35
Html\input
static input( $name, $value='', $type='text', array $attribs=[])
Convenience function to produce an "<input>" element.
Definition: Html.php:663
XmlSelect
Class for generating HTML <select> or <datalist> elements.
Definition: XmlSelect.php:26
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:577
XmlJsCode
A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to interpret a given string a...
Definition: Xml.php:847
Xml\encodeJsCall
static encodeJsCall( $name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:645
Xml\elementClean
static elementClean( $element, $attribs=[], $contents='')
Format an XML element as with self::element(), but run text through the $wgContLang->normalize() vali...
Definition: Xml.php:91
FormatJson\encode
static encode( $value, $pretty=false, $escaping=0)
Returns the JSON representation of a value.
Definition: FormatJson.php:127
Xml\wrapClass
static wrapClass( $text, $class, $tag='span', $attribs=[])
Shortcut to make a specific element with a class attribute.
Definition: Xml.php:262
$html
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:1956
MWException
MediaWiki exception.
Definition: MWException.php:26
Language\fetchLanguageNames
static fetchLanguageNames( $inLanguage=null, $include='mw')
Get an array of language names, indexed by code.
Definition: Language.php:803
$content
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
Definition: hooks.txt:1049
$input
if(is_array( $mode)) switch( $mode) $input
Definition: postprocess-phan.php:141
$tag
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
Definition: hooks.txt:1028
Xml\check
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
Definition: Xml.php:323
$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 & $attribs
Definition: hooks.txt:1956
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
$tabindex
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:1398
$wgLang
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
Definition: design.txt:56
$parser
do that in ParserLimitReportFormat instead $parser
Definition: hooks.txt:2536
MWTimestamp\getInstance
static getInstance( $ts=false)
Get a timestamp instance in GMT.
Definition: MWTimestamp.php:39
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
list
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
XmlJsCode\$value
$value
Definition: Xml.php:848
value
$status value
Definition: SyntaxHighlight_GeSHi.class.php:309
$value
$value
Definition: styleTest.css.php:45
$header
$header
Definition: updateCredits.php:35
Xml\attrib
static attrib( $name, $present=true)
Internal function for use in checkboxes and radio buttons and such.
Definition: Xml.php:312
XmlJsCode\__construct
__construct( $value)
Definition: Xml.php:850
$wgLanguageCode
$wgLanguageCode
Site language code.
Definition: DefaultSettings.php:2839
Xml\span
static span( $text, $class, $attribs=[])
Shortcut to make a span element.
Definition: Xml.php:250
$args
if( $line===false) $args
Definition: cdb.php:63
Xml\radioLabel
static radioLabel( $label, $name, $value, $id, $checked=false, $attribs=[])
Convenience function to build an HTML radio button with a label.
Definition: Xml.php:444
Xml\closeElement
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:118
Xml\listDropDown
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
Definition: Xml.php:507
Xml\isWellFormedXmlFragment
static isWellFormedXmlFragment( $text)
Check if a string is a well-formed XML fragment.
Definition: Xml.php:698
$code
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:783
as
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
Definition: distributors.txt:9
Xml\dateMenu
static dateMenu( $year, $month)
Definition: Xml.php:167
wfMessage
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 "&lt
Xml\input
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition: Xml.php:274
Xml\buildTable
static buildTable( $rows, $attribs=[], $headers=null)
Build a table of data.
Definition: Xml.php:772
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
Xml\monthSelector
static monthSelector( $selected='', $allmonths=null, $id='month')
Create a date selector.
Definition: Xml.php:144
Xml\inputLabel
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:380
Xml
Module of static functions for generating XML.
Definition: Xml.php:26
Xml\escapeTagsOnly
static escapeTagsOnly( $in)
Replace " > and < with their respective HTML entities ( ", >, <)
Definition: Xml.php:715
$options
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
Definition: hooks.txt:1049
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:459
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:419
$wgContLang
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
Definition: design.txt:56
$out
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:783