MediaWiki  1.23.1
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 
688  public static function isWellFormed( $text ) {
689  $parser = xml_parser_create( "UTF-8" );
690 
691  # case folding violates XML standard, turn it off
692  xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
693 
694  if ( !xml_parse( $parser, $text, true ) ) {
695  //$err = xml_error_string( xml_get_error_code( $parser ) );
696  //$position = xml_get_current_byte_index( $parser );
697  //$fragment = $this->extractFragment( $html, $position );
698  //$this->mXmlError = "$err at byte $position:\n$fragment";
699  xml_parser_free( $parser );
700  return false;
701  }
702 
703  xml_parser_free( $parser );
704 
705  return true;
706  }
707 
716  public static function isWellFormedXmlFragment( $text ) {
717  $html =
718  Sanitizer::hackDocType() .
719  '<html>' .
720  $text .
721  '</html>';
722 
723  return Xml::isWellFormed( $html );
724  }
725 
733  public static function escapeTagsOnly( $in ) {
734  return str_replace(
735  array( '"', '>', '<' ),
736  array( '&quot;', '&gt;', '&lt;' ),
737  $in );
738  }
739 
748  public static function buildForm( $fields, $submitLabel = null, $submitAttribs = array() ) {
749  $form = '';
750  $form .= "<table><tbody>";
751 
752  foreach ( $fields as $labelmsg => $input ) {
753  $id = "mw-$labelmsg";
754  $form .= Xml::openElement( 'tr', array( 'id' => $id ) );
755 
756  // TODO use a <label> here for accessibility purposes - will need
757  // to either not use a table to build the form, or find the ID of
758  // the input somehow.
759 
760  $form .= Xml::tags( 'td', array( 'class' => 'mw-label' ), wfMessage( $labelmsg )->parse() );
761  $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) . $input . Xml::closeElement( 'td' );
762  $form .= Xml::closeElement( 'tr' );
763  }
764 
765  if ( $submitLabel ) {
766  $form .= Xml::openElement( 'tr' );
767  $form .= Xml::tags( 'td', array(), '' );
768  $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs ) . Xml::closeElement( 'td' );
769  $form .= Xml::closeElement( 'tr' );
770  }
771 
772  $form .= "</tbody></table>";
773 
774  return $form;
775  }
776 
784  public static function buildTable( $rows, $attribs = array(), $headers = null ) {
785  $s = Xml::openElement( 'table', $attribs );
786 
787  if ( is_array( $headers ) ) {
788  $s .= Xml::openElement( 'thead', $attribs );
789 
790  foreach ( $headers as $id => $header ) {
791  $attribs = array();
792 
793  if ( is_string( $id ) ) {
794  $attribs['id'] = $id;
795  }
796 
797  $s .= Xml::element( 'th', $attribs, $header );
798  }
799  $s .= Xml::closeElement( 'thead' );
800  }
801 
802  foreach ( $rows as $id => $row ) {
803  $attribs = array();
804 
805  if ( is_string( $id ) ) {
806  $attribs['id'] = $id;
807  }
808 
809  $s .= Xml::buildTableRow( $attribs, $row );
810  }
811 
812  $s .= Xml::closeElement( 'table' );
813 
814  return $s;
815  }
816 
823  public static function buildTableRow( $attribs, $cells ) {
824  $s = Xml::openElement( 'tr', $attribs );
825 
826  foreach ( $cells as $id => $cell ) {
827  $attribs = array();
828 
829  if ( is_string( $id ) ) {
830  $attribs['id'] = $id;
831  }
832 
833  $s .= Xml::element( 'td', $attribs, $cell );
834  }
835 
836  $s .= Xml::closeElement( 'tr' );
837 
838  return $s;
839  }
840 }
841 
842 class XmlSelect {
843  protected $options = array();
844  protected $default = false;
845  protected $attributes = array();
846 
847  public function __construct( $name = false, $id = false, $default = false ) {
848  if ( $name ) {
849  $this->setAttribute( 'name', $name );
850  }
851 
852  if ( $id ) {
853  $this->setAttribute( 'id', $id );
854  }
855 
856  if ( $default !== false ) {
857  $this->default = $default;
858  }
859  }
860 
864  public function setDefault( $default ) {
865  $this->default = $default;
866  }
867 
872  public function setAttribute( $name, $value ) {
873  $this->attributes[$name] = $value;
874  }
875 
880  public function getAttribute( $name ) {
881  if ( isset( $this->attributes[$name] ) ) {
882  return $this->attributes[$name];
883  } else {
884  return null;
885  }
886  }
887 
892  public function addOption( $name, $value = false ) {
893  // Stab stab stab
894  $value = $value !== false ? $value : $name;
895 
896  $this->options[] = array( $name => $value );
897  }
898 
906  public function addOptions( $options ) {
907  $this->options[] = $options;
908  }
909 
919  static function formatOptions( $options, $default = false ) {
920  $data = '';
921 
922  foreach ( $options as $label => $value ) {
923  if ( is_array( $value ) ) {
924  $contents = self::formatOptions( $value, $default );
925  $data .= Html::rawElement( 'optgroup', array( 'label' => $label ), $contents ) . "\n";
926  } else {
927  $data .= Xml::option( $label, $value, $value === $default ) . "\n";
928  }
929  }
930 
931  return $data;
932  }
933 
937  public function getHTML() {
938  $contents = '';
939 
940  foreach ( $this->options as $options ) {
941  $contents .= self::formatOptions( $options, $this->default );
942  }
943 
944  return Html::rawElement( 'select', $this->attributes, rtrim( $contents ) );
945  }
946 }
947 
965 class XmlJsCode {
966  public $value;
967 
968  function __construct( $value ) {
969  $this->value = $value;
970  }
971 }
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:1127
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:1003
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:645
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:707
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