MediaWiki  1.23.12
Xml.php
Go to the documentation of this file.
1 <?php
26 class Xml {
39  public static function element( $element, $attribs = null, $contents = '', $allowShortTag = true ) {
40  $out = '<' . $element;
41  if ( !is_null( $attribs ) ) {
43  }
44  if ( is_null( $contents ) ) {
45  $out .= '>';
46  } else {
47  if ( $allowShortTag && $contents === '' ) {
48  $out .= ' />';
49  } else {
50  $out .= '>' . htmlspecialchars( $contents ) . "</$element>";
51  }
52  }
53  return $out;
54  }
55 
65  public static function expandAttributes( $attribs ) {
66  $out = '';
67  if ( is_null( $attribs ) ) {
68  return null;
69  } elseif ( is_array( $attribs ) ) {
70  foreach ( $attribs as $name => $val ) {
71  $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"';
72  }
73  return $out;
74  } else {
75  throw new MWException( 'Expected attribute array, got something else in ' . __METHOD__ );
76  }
77  }
78 
89  public static function elementClean( $element, $attribs = array(), $contents = '' ) {
91  if ( $attribs ) {
92  $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );
93  }
94  if ( $contents ) {
95  wfProfileIn( __METHOD__ . '-norm' );
96  $contents = $wgContLang->normalize( $contents );
97  wfProfileOut( __METHOD__ . '-norm' );
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 
145  public static function namespaceSelector( $selected = '', $all = null, $element_name = 'namespace', $label = null ) {
146  wfDeprecated( __METHOD__, '1.19' );
148  'selected' => $selected,
149  'all' => $all,
150  'label' => $label,
151  ), array(
152  'name' => $element_name,
153  'id' => 'namespace',
154  'class' => 'namespaceselector',
155  ) );
156  }
157 
166  public static function monthSelector( $selected = '', $allmonths = null, $id = 'month' ) {
167  global $wgLang;
168  $options = array();
169  if ( is_null( $selected ) ) {
170  $selected = '';
171  }
172  if ( !is_null( $allmonths ) ) {
173  $options[] = self::option( wfMessage( 'monthsall' )->text(), $allmonths, $selected === $allmonths );
174  }
175  for ( $i = 1; $i < 13; $i++ ) {
176  $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i );
177  }
178  return self::openElement( 'select', array( 'id' => $id, 'name' => 'month', 'class' => 'mw-month-selector' ) )
179  . implode( "\n", $options )
180  . self::closeElement( 'select' );
181  }
182 
188  public static function dateMenu( $year, $month ) {
189  # Offset overrides year/month selection
190  if ( $month && $month !== -1 ) {
191  $encMonth = intval( $month );
192  } else {
193  $encMonth = '';
194  }
195  if ( $year ) {
196  $encYear = intval( $year );
197  } elseif ( $encMonth ) {
199  $thisMonth = intval( $timestamp->format( 'n' ) );
200  $thisYear = intval( $timestamp->format( 'Y' ) );
201  if ( intval( $encMonth ) > $thisMonth ) {
202  $thisYear--;
203  }
204  $encYear = $thisYear;
205  } else {
206  $encYear = '';
207  }
208  $inputAttribs = array( 'id' => 'year', 'maxlength' => 4, 'size' => 7 );
209  return self::label( wfMessage( 'year' )->text(), 'year' ) . ' ' .
210  Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' ' .
211  self::label( wfMessage( 'month' )->text(), 'month' ) . ' ' .
212  self::monthSelector( $encMonth, -1 );
213  }
214 
225  public static function languageSelector( $selected, $customisedOnly = true, $inLanguage = null, $overrideAttrs = array(), Message $msg = null ) {
226  global $wgLanguageCode;
227 
228  $include = $customisedOnly ? 'mwfile' : 'mw';
229  $languages = Language::fetchLanguageNames( $inLanguage, $include );
230 
231  // Make sure the site language is in the list;
232  // a custom language code might not have a defined name...
233  if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
234  $languages[$wgLanguageCode] = $wgLanguageCode;
235  }
236 
237  ksort( $languages );
238 
244  $selected = isset( $languages[$selected] ) ? $selected : $wgLanguageCode;
245  $options = "\n";
246  foreach ( $languages as $code => $name ) {
247  $options .= Xml::option( "$code - $name", $code, $code == $selected ) . "\n";
248  }
249 
250  $attrs = array( 'id' => 'wpUserLanguage', 'name' => 'wpUserLanguage' );
251  $attrs = array_merge( $attrs, $overrideAttrs );
252 
253  if ( $msg === null ) {
254  $msg = wfMessage( 'yourlanguage' );
255  }
256  return array(
257  Xml::label( $msg->text(), $attrs['id'] ),
258  Xml::tags( 'select', $attrs, $options )
259  );
260 
261  }
262 
270  public static function span( $text, $class, $attribs = array() ) {
271  return self::element( 'span', array( 'class' => $class ) + $attribs, $text );
272  }
273 
282  public static function wrapClass( $text, $class, $tag = 'span', $attribs = array() ) {
283  return self::tags( $tag, array( 'class' => $class ) + $attribs, $text );
284  }
285 
294  public static function input( $name, $size = false, $value = false, $attribs = array() ) {
295  $attributes = array( 'name' => $name );
296 
297  if ( $size ) {
298  $attributes['size'] = $size;
299  }
300 
301  if ( $value !== false ) { // maybe 0
302  $attributes['value'] = $value;
303  }
304 
305  return self::element( 'input', $attributes + $attribs );
306  }
307 
316  public static function password( $name, $size = false, $value = false, $attribs = array() ) {
317  return self::input( $name, $size, $value, array_merge( $attribs, array( 'type' => 'password' ) ) );
318  }
319 
328  public static function attrib( $name, $present = true ) {
329  return $present ? array( $name => $name ) : array();
330  }
331 
339  public static function check( $name, $checked = false, $attribs = array() ) {
340  return self::element( 'input', array_merge(
341  array(
342  'name' => $name,
343  'type' => 'checkbox',
344  'value' => 1 ),
345  self::attrib( 'checked', $checked ),
346  $attribs ) );
347  }
348 
357  public static function radio( $name, $value, $checked = false, $attribs = array() ) {
358  return self::element( 'input', array(
359  'name' => $name,
360  'type' => 'radio',
361  'value' => $value ) + self::attrib( 'checked', $checked ) + $attribs );
362  }
363 
374  public static function label( $label, $id, $attribs = array() ) {
375  $a = array( 'for' => $id );
376 
377  # FIXME avoid copy pasting below:
378  if ( isset( $attribs['class'] ) ) {
379  $a['class'] = $attribs['class'];
380  }
381  if ( isset( $attribs['title'] ) ) {
382  $a['title'] = $attribs['title'];
383  }
384 
385  return self::element( 'label', $a, $label );
386  }
387 
398  public static function inputLabel( $label, $name, $id, $size = false, $value = false, $attribs = array() ) {
399  list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
400  return $label . '&#160;' . $input;
401  }
402 
415  public static function inputLabelSep( $label, $name, $id, $size = false, $value = false, $attribs = array() ) {
416  return array(
417  Xml::label( $label, $id, $attribs ),
418  self::input( $name, $size, $value, array( 'id' => $id ) + $attribs )
419  );
420  }
421 
433  public static function checkLabel( $label, $name, $id, $checked = false, $attribs = array() ) {
434  return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) .
435  '&#160;' .
436  self::label( $label, $id, $attribs );
437  }
438 
451  public static function radioLabel( $label, $name, $value, $id, $checked = false, $attribs = array() ) {
452  return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) .
453  '&#160;' .
454  self::label( $label, $id, $attribs );
455  }
456 
463  public static function submitButton( $value, $attribs = array() ) {
464  return Html::element( 'input', array( 'type' => 'submit', 'value' => $value ) + $attribs );
465  }
466 
475  public static function option( $text, $value = null, $selected = false,
476  $attribs = array() ) {
477  if ( !is_null( $value ) ) {
478  $attribs['value'] = $value;
479  }
480  if ( $selected ) {
481  $attribs['selected'] = 'selected';
482  }
483  return Html::element( 'option', $attribs, $text );
484  }
485 
497  public static function listDropDown( $name = '', $list = '', $other = '', $selected = '', $class = '', $tabindex = null ) {
498  $optgroup = false;
499 
500  $options = self::option( $other, 'other', $selected === 'other' );
501 
502  foreach ( explode( "\n", $list ) as $option ) {
503  $value = trim( $option );
504  if ( $value == '' ) {
505  continue;
506  } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
507  // A new group is starting ...
508  $value = trim( substr( $value, 1 ) );
509  if ( $optgroup ) {
510  $options .= self::closeElement( 'optgroup' );
511  }
512  $options .= self::openElement( 'optgroup', array( 'label' => $value ) );
513  $optgroup = true;
514  } elseif ( substr( $value, 0, 2 ) == '**' ) {
515  // groupmember
516  $value = trim( substr( $value, 2 ) );
517  $options .= self::option( $value, $value, $selected === $value );
518  } else {
519  // groupless reason list
520  if ( $optgroup ) {
521  $options .= self::closeElement( 'optgroup' );
522  }
523  $options .= self::option( $value, $value, $selected === $value );
524  $optgroup = false;
525  }
526  }
527 
528  if ( $optgroup ) {
529  $options .= self::closeElement( 'optgroup' );
530  }
531 
532  $attribs = array();
533 
534  if ( $name ) {
535  $attribs['id'] = $name;
536  $attribs['name'] = $name;
537  }
538 
539  if ( $class ) {
540  $attribs['class'] = $class;
541  }
542 
543  if ( $tabindex ) {
544  $attribs['tabindex'] = $tabindex;
545  }
546 
547  return Xml::openElement( 'select', $attribs )
548  . "\n"
549  . $options
550  . "\n"
551  . Xml::closeElement( 'select' );
552  }
553 
563  public static function fieldset( $legend = false, $content = false, $attribs = array() ) {
564  $s = Xml::openElement( 'fieldset', $attribs ) . "\n";
565 
566  if ( $legend ) {
567  $s .= Xml::element( 'legend', null, $legend ) . "\n";
568  }
569 
570  if ( $content !== false ) {
571  $s .= $content . "\n";
572  $s .= Xml::closeElement( 'fieldset' ) . "\n";
573  }
574 
575  return $s;
576  }
577 
589  public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = array() ) {
590  return self::element( 'textarea',
591  array(
592  'name' => $name,
593  'id' => $name,
594  'cols' => $cols,
595  'rows' => $rows
596  ) + $attribs,
597  $content, false );
598  }
599 
609  public static function escapeJsString( $string ) {
610  // See ECMA 262 section 7.8.4 for string literal format
611  $pairs = array(
612  "\\" => "\\\\",
613  "\"" => "\\\"",
614  '\'' => '\\\'',
615  "\n" => "\\n",
616  "\r" => "\\r",
617 
618  # To avoid closing the element or CDATA section
619  "<" => "\\x3c",
620  ">" => "\\x3e",
621 
622  # To avoid any complaints about bad entity refs
623  "&" => "\\x26",
624 
625  # Work around https://bugzilla.mozilla.org/show_bug.cgi?id=274152
626  # Encode certain Unicode formatting chars so affected
627  # versions of Gecko don't misinterpret our strings;
628  # this is a common problem with Farsi text.
629  "\xe2\x80\x8c" => "\\u200c", // ZERO WIDTH NON-JOINER
630  "\xe2\x80\x8d" => "\\u200d", // ZERO WIDTH JOINER
631  );
632 
633  return strtr( $string, $pairs );
634  }
635 
647  public static function encodeJsVar( $value, $pretty = false ) {
648  if ( $value instanceof XmlJsCode ) {
649  return $value->value;
650  }
651  return FormatJson::encode( $value, $pretty, FormatJson::UTF8_OK );
652  }
653 
665  public static function encodeJsCall( $name, $args, $pretty = false ) {
666  foreach ( $args as &$arg ) {
667  $arg = Xml::encodeJsVar( $arg, $pretty );
668  if ( $arg === false ) {
669  return false;
670  }
671  }
672 
673  return "$name(" . ( $pretty
674  ? ( ' ' . implode( ', ', $args ) . ' ' )
675  : implode( ',', $args )
676  ) . ");";
677  }
678 
690  private static function isWellFormed( $text ) {
691  $parser = xml_parser_create( "UTF-8" );
692 
693  # case folding violates XML standard, turn it off
694  xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
695 
696  if ( !xml_parse( $parser, $text, true ) ) {
697  //$err = xml_error_string( xml_get_error_code( $parser ) );
698  //$position = xml_get_current_byte_index( $parser );
699  //$fragment = $this->extractFragment( $html, $position );
700  //$this->mXmlError = "$err at byte $position:\n$fragment";
701  xml_parser_free( $parser );
702  return false;
703  }
704 
705  xml_parser_free( $parser );
706 
707  return true;
708  }
709 
718  public static function isWellFormedXmlFragment( $text ) {
719  $html =
720  Sanitizer::hackDocType() .
721  '<html>' .
722  $text .
723  '</html>';
724 
725  return Xml::isWellFormed( $html );
726  }
727 
735  public static function escapeTagsOnly( $in ) {
736  return str_replace(
737  array( '"', '>', '<' ),
738  array( '&quot;', '&gt;', '&lt;' ),
739  $in );
740  }
741 
750  public static function buildForm( $fields, $submitLabel = null, $submitAttribs = array() ) {
751  $form = '';
752  $form .= "<table><tbody>";
753 
754  foreach ( $fields as $labelmsg => $input ) {
755  $id = "mw-$labelmsg";
756  $form .= Xml::openElement( 'tr', array( 'id' => $id ) );
757 
758  // TODO use a <label> here for accessibility purposes - will need
759  // to either not use a table to build the form, or find the ID of
760  // the input somehow.
761 
762  $form .= Xml::tags( 'td', array( 'class' => 'mw-label' ), wfMessage( $labelmsg )->parse() );
763  $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) . $input . Xml::closeElement( 'td' );
764  $form .= Xml::closeElement( 'tr' );
765  }
766 
767  if ( $submitLabel ) {
768  $form .= Xml::openElement( 'tr' );
769  $form .= Xml::tags( 'td', array(), '' );
770  $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs ) . Xml::closeElement( 'td' );
771  $form .= Xml::closeElement( 'tr' );
772  }
773 
774  $form .= "</tbody></table>";
775 
776  return $form;
777  }
778 
786  public static function buildTable( $rows, $attribs = array(), $headers = null ) {
787  $s = Xml::openElement( 'table', $attribs );
788 
789  if ( is_array( $headers ) ) {
790  $s .= Xml::openElement( 'thead', $attribs );
791 
792  foreach ( $headers as $id => $header ) {
793  $attribs = array();
794 
795  if ( is_string( $id ) ) {
796  $attribs['id'] = $id;
797  }
798 
799  $s .= Xml::element( 'th', $attribs, $header );
800  }
801  $s .= Xml::closeElement( 'thead' );
802  }
803 
804  foreach ( $rows as $id => $row ) {
805  $attribs = array();
806 
807  if ( is_string( $id ) ) {
808  $attribs['id'] = $id;
809  }
810 
811  $s .= Xml::buildTableRow( $attribs, $row );
812  }
813 
814  $s .= Xml::closeElement( 'table' );
815 
816  return $s;
817  }
818 
825  public static function buildTableRow( $attribs, $cells ) {
826  $s = Xml::openElement( 'tr', $attribs );
827 
828  foreach ( $cells as $id => $cell ) {
829  $attribs = array();
830 
831  if ( is_string( $id ) ) {
832  $attribs['id'] = $id;
833  }
834 
835  $s .= Xml::element( 'td', $attribs, $cell );
836  }
837 
838  $s .= Xml::closeElement( 'tr' );
839 
840  return $s;
841  }
842 }
843 
844 class XmlSelect {
845  protected $options = array();
846  protected $default = false;
847  protected $attributes = array();
848 
849  public function __construct( $name = false, $id = false, $default = false ) {
850  if ( $name ) {
851  $this->setAttribute( 'name', $name );
852  }
853 
854  if ( $id ) {
855  $this->setAttribute( 'id', $id );
856  }
857 
858  if ( $default !== false ) {
859  $this->default = $default;
860  }
861  }
862 
866  public function setDefault( $default ) {
867  $this->default = $default;
868  }
869 
874  public function setAttribute( $name, $value ) {
875  $this->attributes[$name] = $value;
876  }
877 
882  public function getAttribute( $name ) {
883  if ( isset( $this->attributes[$name] ) ) {
884  return $this->attributes[$name];
885  } else {
886  return null;
887  }
888  }
889 
894  public function addOption( $name, $value = false ) {
895  // Stab stab stab
896  $value = $value !== false ? $value : $name;
897 
898  $this->options[] = array( $name => $value );
899  }
900 
908  public function addOptions( $options ) {
909  $this->options[] = $options;
910  }
911 
921  static function formatOptions( $options, $default = false ) {
922  $data = '';
923 
924  foreach ( $options as $label => $value ) {
925  if ( is_array( $value ) ) {
926  $contents = self::formatOptions( $value, $default );
927  $data .= Html::rawElement( 'optgroup', array( 'label' => $label ), $contents ) . "\n";
928  } else {
929  $data .= Xml::option( $label, $value, $value === $default ) . "\n";
930  }
931  }
932 
933  return $data;
934  }
935 
939  public function getHTML() {
940  $contents = '';
941 
942  foreach ( $this->options as $options ) {
943  $contents .= self::formatOptions( $options, $this->default );
944  }
945 
946  return Html::rawElement( 'select', $this->attributes, rtrim( $contents ) );
947  }
948 }
949 
967 class XmlJsCode {
968  public $value;
969 
970  function __construct( $value ) {
971  $this->value = $value;
972  }
973 }
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:433
Xml\escapeJsString
static escapeJsString( $string)
Returns an escaped string suitable for inclusion in a string literal for JavaScript source code.
Definition: Xml.php:609
of
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
Definition: globals.txt:10
Xml\expandAttributes
static expandAttributes( $attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : att...
Definition: Xml.php:65
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Xml\tags
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
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
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
Xml\elementClean
static elementClean( $element, $attribs=array(), $contents='')
Format an XML element as with self::element(), but run text through the $wgContLang->normalize() vali...
Definition: Xml.php:89
Xml\option
static option( $text, $value=null, $selected=false, $attribs=array())
Convenience function to build an HTML drop-down list item.
Definition: Xml.php:475
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
n
if(! $in) print Initializing normalization quick check tables n
Definition: UtfNormalGenerate.php:36
$s
$s
Definition: mergeMessageFileList.php:156
Xml\languageSelector
static languageSelector( $selected, $customisedOnly=true, $inLanguage=null, $overrideAttrs=array(), Message $msg=null)
Construct a language selector appropriate for use in a form or preferences.
Definition: Xml.php:225
$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
$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:1038
Xml\openElement
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
Xml\radioLabel
static radioLabel( $label, $name, $value, $id, $checked=false, $attribs=array())
Convenience function to build an HTML radio button with a label.
Definition: Xml.php:451
MWException
MediaWiki exception.
Definition: MWException.php:26
$out
$out
Definition: UtfNormalGenerate.php:167
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1174
Language\fetchLanguageNames
static fetchLanguageNames( $inLanguage=null, $include='mw')
Get an array of language names, indexed by code.
Definition: Language.php:875
table
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 then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if so it s not worth the trouble Since there is a job queue in the jobs table
Definition: deferred.txt:11
so
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the but if you want to contribute without by all means do so(and don 't be surprised if I reformat your code). - I have the code indented with tabs to save file size and so that users can set their tab stops to any depth they like. I use 4-space tab stops
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:148
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
wfMessage
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 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
Sanitizer\encodeAttribute
static encodeAttribute( $text)
Encode an attribute value for HTML output.
Definition: Sanitizer.php:1020
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
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
MWTimestamp\getInstance
static getInstance( $ts=false)
Get a timestamp instance in GMT.
Definition: MWTimestamp.php:387
Xml\inputLabel
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field with a label.
Definition: Xml.php:398
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
Html\input
static input( $name, $value='', $type='text', $attribs=array())
Convenience function to produce an "<input>" element.
Definition: Html.php:648
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
$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 & $options
Definition: hooks.txt:1530
$languages
$languages
Definition: rebuildLanguage.php:129
Xml\span
static span( $text, $class, $attribs=array())
Shortcut to make a span element.
Definition: Xml.php:270
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$size
$size
Definition: RandomTest.php:75
$value
$value
Definition: styleTest.css.php:45
Xml\check
static check( $name, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox.
Definition: Xml.php:339
Xml\inputLabelSep
static inputLabelSep( $label, $name, $id, $size=false, $value=false, $attribs=array())
Same as Xml::inputLabel() but return input and label in an array.
Definition: Xml.php:415
Xml\attrib
static attrib( $name, $present=true)
Internal function for use in checkboxes and radio buttons and such.
Definition: Xml.php:328
Xml\textarea
static textarea( $name, $content, $cols=40, $rows=5, $attribs=array())
Shortcut for creating textareas.
Definition: Xml.php:589
Xml\namespaceSelector
static namespaceSelector( $selected='', $all=null, $element_name='namespace', $label=null)
Build a drop-down box for selecting a namespace.
Definition: Xml.php:145
$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
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:497
https
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 https
Definition: design.txt:12
Xml\radio
static radio( $name, $value, $checked=false, $attribs=array())
Convenience function to build an HTML radio button.
Definition: Xml.php:357
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:188
Html\namespaceSelector
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
Definition: Html.php:710
Xml\submitButton
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
Definition: Xml.php:463
Xml\monthSelector
static monthSelector( $selected='', $allmonths=null, $id='month')
Create a date selector.
Definition: Xml.php:166
Xml\input
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
Definition: Xml.php:294
Xml\label
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
Definition: Xml.php:374
$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:1530
Xml\wrapClass
static wrapClass( $text, $class, $tag='span', $attribs=array())
Shortcut to make a specific element with a class attribute.
Definition: Xml.php:282
Xml\password
static password( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML password input field.
Definition: Xml.php:316
Xml
Module of static functions for generating XML.
Definition: Xml.php:26
section
section
Definition: parserTests.txt:378
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
Definition: Xml.php:563