MediaWiki  master
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 ) ) {
44  $out .= self::expandAttributes( $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 = array(), $contents = '' ) {
93  if ( $attribs ) {
94  $attribs = array_map( array( 'UtfNormal', '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 = array();
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 ) {
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 = array( '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 = array(), 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 ) ) {
215  $languages[$wgLanguageCode] = $wgLanguageCode;
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 = array( 'id' => 'wpUserLanguage', 'name' => 'wpUserLanguage' );
232  $attrs = array_merge( $attrs, $overrideAttrs );
233 
234  if ( $msg === null ) {
235  $msg = wfMessage( 'yourlanguage' );
236  }
237  return array(
238  Xml::label( $msg->text(), $attrs['id'] ),
239  Xml::tags( 'select', $attrs, $options )
240  );
241 
242  }
243 
251  public static function span( $text, $class, $attribs = array() ) {
252  return self::element( 'span', array( 'class' => $class ) + $attribs, $text );
253  }
254 
263  public static function wrapClass( $text, $class, $tag = 'span', $attribs = array() ) {
264  return self::tags( $tag, array( 'class' => $class ) + $attribs, $text );
265  }
266 
275  public static function input( $name, $size = false, $value = false, $attribs = array() ) {
276  $attributes = array( 'name' => $name );
277 
278  if ( $size ) {
279  $attributes['size'] = $size;
280  }
281 
282  if ( $value !== false ) { // maybe 0
283  $attributes['value'] = $value;
284  }
285 
286  return self::element( 'input',
287  Html::getTextInputAttributes( $attributes + $attribs ) );
288  }
289 
298  public static function password( $name, $size = false, $value = false,
299  $attribs = array()
300  ) {
301  return self::input( $name, $size, $value,
302  array_merge( $attribs, array( 'type' => 'password' ) ) );
303  }
304 
313  public static function attrib( $name, $present = true ) {
314  return $present ? array( $name => $name ) : array();
315  }
316 
324  public static function check( $name, $checked = false, $attribs = array() ) {
325  return self::element( 'input', array_merge(
326  array(
327  'name' => $name,
328  'type' => 'checkbox',
329  'value' => 1 ),
330  self::attrib( 'checked', $checked ),
331  $attribs ) );
332  }
333 
342  public static function radio( $name, $value, $checked = false, $attribs = array() ) {
343  return self::element( 'input', array(
344  'name' => $name,
345  'type' => 'radio',
346  'value' => $value ) + self::attrib( 'checked', $checked ) + $attribs );
347  }
348 
359  public static function label( $label, $id, $attribs = array() ) {
360  $a = array( 'for' => $id );
361 
362  foreach ( array( 'class', 'title' ) as $attr ) {
363  if ( isset( $attribs[$attr] ) ) {
364  $a[$attr] = $attribs[$attr];
365  }
366  }
367 
368  return self::element( 'label', $a, $label );
369  }
370 
381  public static function inputLabel( $label, $name, $id, $size = false,
382  $value = false, $attribs = array()
383  ) {
384  list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs );
385  return $label . '&#160;' . $input;
386  }
387 
400  public static function inputLabelSep( $label, $name, $id, $size = false,
401  $value = false, $attribs = array()
402  ) {
403  return array(
404  Xml::label( $label, $id, $attribs ),
405  self::input( $name, $size, $value, array( 'id' => $id ) + $attribs )
406  );
407  }
408 
420  public static function checkLabel( $label, $name, $id, $checked = false, $attribs = array() ) {
422  $chkLabel = self::check( $name, $checked, array( 'id' => $id ) + $attribs ) .
423  '&#160;' .
424  self::label( $label, $id, $attribs );
425 
426  if ( $wgUseMediaWikiUIEverywhere ) {
427  $chkLabel = self::openElement( 'div', array( 'class' => 'mw-ui-checkbox' ) ) .
428  $chkLabel . self::closeElement( 'div' );
429  }
430  return $chkLabel;
431  }
432 
445  public static function radioLabel( $label, $name, $value, $id,
446  $checked = false, $attribs = array()
447  ) {
448  return self::radio( $name, $value, $checked, array( 'id' => $id ) + $attribs ) .
449  '&#160;' .
450  self::label( $label, $id, $attribs );
451  }
452 
460  public static function submitButton( $value, $attribs = array() ) {
462  $baseAttrs = array(
463  'type' => 'submit',
464  'value' => $value,
465  );
466  // Done conditionally for time being as it is possible
467  // some submit forms
468  // might need to be mw-ui-destructive (e.g. delete a page)
469  if ( $wgUseMediaWikiUIEverywhere ) {
470  $baseAttrs['class'] = 'mw-ui-button mw-ui-constructive';
471  }
472  // Any custom attributes will take precendence of anything in baseAttrs e.g. override the class
473  $attribs = $attribs + $baseAttrs;
474  return Html::element( 'input', $attribs );
475  }
476 
485  public static function option( $text, $value = null, $selected = false,
486  $attribs = array() ) {
487  if ( !is_null( $value ) ) {
488  $attribs['value'] = $value;
489  }
490  if ( $selected ) {
491  $attribs['selected'] = 'selected';
492  }
493  return Html::element( 'option', $attribs, $text );
494  }
495 
508  public static function listDropDown( $name = '', $list = '', $other = '',
509  $selected = '', $class = '', $tabindex = null
510  ) {
511  $optgroup = false;
512 
513  $options = self::option( $other, 'other', $selected === 'other' );
514 
515  foreach ( explode( "\n", $list ) as $option ) {
516  $value = trim( $option );
517  if ( $value == '' ) {
518  continue;
519  } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
520  // A new group is starting ...
521  $value = trim( substr( $value, 1 ) );
522  if ( $optgroup ) {
523  $options .= self::closeElement( 'optgroup' );
524  }
525  $options .= self::openElement( 'optgroup', array( 'label' => $value ) );
526  $optgroup = true;
527  } elseif ( substr( $value, 0, 2 ) == '**' ) {
528  // groupmember
529  $value = trim( substr( $value, 2 ) );
530  $options .= self::option( $value, $value, $selected === $value );
531  } else {
532  // groupless reason list
533  if ( $optgroup ) {
534  $options .= self::closeElement( 'optgroup' );
535  }
536  $options .= self::option( $value, $value, $selected === $value );
537  $optgroup = false;
538  }
539  }
540 
541  if ( $optgroup ) {
542  $options .= self::closeElement( 'optgroup' );
543  }
544 
545  $attribs = array();
546 
547  if ( $name ) {
548  $attribs['id'] = $name;
549  $attribs['name'] = $name;
550  }
551 
552  if ( $class ) {
553  $attribs['class'] = $class;
554  }
555 
556  if ( $tabindex ) {
557  $attribs['tabindex'] = $tabindex;
558  }
559 
560  return Xml::openElement( 'select', $attribs )
561  . "\n"
562  . $options
563  . "\n"
564  . Xml::closeElement( 'select' );
565  }
566 
578  public static function fieldset( $legend = false, $content = false, $attribs = array() ) {
579  $s = Xml::openElement( 'fieldset', $attribs ) . "\n";
580 
581  if ( $legend ) {
582  $s .= Xml::element( 'legend', null, $legend ) . "\n";
583  }
584 
585  if ( $content !== false ) {
586  $s .= $content . "\n";
587  $s .= Xml::closeElement( 'fieldset' ) . "\n";
588  }
589 
590  return $s;
591  }
592 
604  public static function textarea( $name, $content, $cols = 40, $rows = 5, $attribs = array() ) {
605  return self::element( 'textarea',
607  array(
608  'name' => $name,
609  'id' => $name,
610  'cols' => $cols,
611  'rows' => $rows
612  ) + $attribs
613  ),
614  $content, false );
615  }
616 
626  public static function escapeJsString( $string ) {
627  // See ECMA 262 section 7.8.4 for string literal format
628  $pairs = array(
629  "\\" => "\\\\",
630  "\"" => "\\\"",
631  '\'' => '\\\'',
632  "\n" => "\\n",
633  "\r" => "\\r",
634 
635  # To avoid closing the element or CDATA section
636  "<" => "\\x3c",
637  ">" => "\\x3e",
638 
639  # To avoid any complaints about bad entity refs
640  "&" => "\\x26",
641 
642  # Work around https://bugzilla.mozilla.org/show_bug.cgi?id=274152
643  # Encode certain Unicode formatting chars so affected
644  # versions of Gecko don't misinterpret our strings;
645  # this is a common problem with Farsi text.
646  "\xe2\x80\x8c" => "\\u200c", // ZERO WIDTH NON-JOINER
647  "\xe2\x80\x8d" => "\\u200d", // ZERO WIDTH JOINER
648  );
649 
650  return strtr( $string, $pairs );
651  }
652 
664  public static function encodeJsVar( $value, $pretty = false ) {
665  if ( $value instanceof XmlJsCode ) {
666  return $value->value;
667  }
668  return FormatJson::encode( $value, $pretty, FormatJson::UTF8_OK );
669  }
670 
682  public static function encodeJsCall( $name, $args, $pretty = false ) {
683  foreach ( $args as &$arg ) {
684  $arg = Xml::encodeJsVar( $arg, $pretty );
685  if ( $arg === false ) {
686  return false;
687  }
688  }
689 
690  return "$name(" . ( $pretty
691  ? ( ' ' . implode( ', ', $args ) . ' ' )
692  : implode( ',', $args )
693  ) . ");";
694  }
695 
707  private static function isWellFormed( $text ) {
708  $parser = xml_parser_create( "UTF-8" );
709 
710  # case folding violates XML standard, turn it off
711  xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
712 
713  if ( !xml_parse( $parser, $text, true ) ) {
714  // $err = xml_error_string( xml_get_error_code( $parser ) );
715  // $position = xml_get_current_byte_index( $parser );
716  // $fragment = $this->extractFragment( $html, $position );
717  // $this->mXmlError = "$err at byte $position:\n$fragment";
718  xml_parser_free( $parser );
719  return false;
720  }
721 
722  xml_parser_free( $parser );
723 
724  return true;
725  }
726 
735  public static function isWellFormedXmlFragment( $text ) {
736  $html =
737  Sanitizer::hackDocType() .
738  '<html>' .
739  $text .
740  '</html>';
741 
742  return Xml::isWellFormed( $html );
743  }
744 
752  public static function escapeTagsOnly( $in ) {
753  return str_replace(
754  array( '"', '>', '<' ),
755  array( '&quot;', '&gt;', '&lt;' ),
756  $in );
757  }
758 
770  public static function buildForm( $fields, $submitLabel = null, $submitAttribs = array() ) {
771  $form = '';
772  $form .= "<table><tbody>";
773 
774  foreach ( $fields as $labelmsg => $input ) {
775  $id = "mw-$labelmsg";
776  $form .= Xml::openElement( 'tr', array( 'id' => $id ) );
777 
778  // TODO use a <label> here for accessibility purposes - will need
779  // to either not use a table to build the form, or find the ID of
780  // the input somehow.
781 
782  $form .= Xml::tags( 'td', array( 'class' => 'mw-label' ), wfMessage( $labelmsg )->parse() );
783  $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) )
784  . $input . Xml::closeElement( 'td' );
785  $form .= Xml::closeElement( 'tr' );
786  }
787 
788  if ( $submitLabel ) {
789  $form .= Xml::openElement( 'tr' );
790  $form .= Xml::tags( 'td', array(), '' );
791  $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) )
792  . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs )
793  . Xml::closeElement( 'td' );
794  $form .= Xml::closeElement( 'tr' );
795  }
796 
797  $form .= "</tbody></table>";
798 
799  return $form;
800  }
801 
809  public static function buildTable( $rows, $attribs = array(), $headers = null ) {
810  $s = Xml::openElement( 'table', $attribs );
811 
812  if ( is_array( $headers ) ) {
813  $s .= Xml::openElement( 'thead', $attribs );
814 
815  foreach ( $headers as $id => $header ) {
816  $attribs = array();
817 
818  if ( is_string( $id ) ) {
819  $attribs['id'] = $id;
820  }
821 
822  $s .= Xml::element( 'th', $attribs, $header );
823  }
824  $s .= Xml::closeElement( 'thead' );
825  }
826 
827  foreach ( $rows as $id => $row ) {
828  $attribs = array();
829 
830  if ( is_string( $id ) ) {
831  $attribs['id'] = $id;
832  }
833 
834  $s .= Xml::buildTableRow( $attribs, $row );
835  }
836 
837  $s .= Xml::closeElement( 'table' );
838 
839  return $s;
840  }
841 
848  public static function buildTableRow( $attribs, $cells ) {
849  $s = Xml::openElement( 'tr', $attribs );
850 
851  foreach ( $cells as $id => $cell ) {
852  $attribs = array();
853 
854  if ( is_string( $id ) ) {
855  $attribs['id'] = $id;
856  }
857 
858  $s .= Xml::element( 'td', $attribs, $cell );
859  }
860 
861  $s .= Xml::closeElement( 'tr' );
862 
863  return $s;
864  }
865 }
866 
884 class XmlJsCode {
885  public $value;
886 
887  function __construct( $value ) {
888  $this->value = $value;
889  }
890 }
static label($label, $id, $attribs=array())
Convenience function to build an HTML form label.
Definition: Xml.php:359
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
static option($text, $value=null, $selected=false, $attribs=array())
Convenience function to build an HTML drop-down list item.
Definition: Xml.php:485
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:381
or
false for read/write
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:324
The Message class provides methods which fulfil two basic services:
Definition: Message.php:159
static span($text, $class, $attribs=array())
Shortcut to make a span element.
Definition: Xml.php:251
static expandAttributes($attribs)
Given an array of ('attributename' => 'value'), it generates the code to set the XML attributes : attr...
Definition: Xml.php:67
Class for generating HTML <select> elements.
Definition: XmlSelect.php:26
$value
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:400
static monthSelector($selected= '', $allmonths=null, $id= 'month')
Create a date selector.
Definition: Xml.php:144
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
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
static fetchLanguageNames($inLanguage=null, $include= 'mw')
Get an array of language names, indexed by code.
Definition: Language.php:883
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
$wgLanguageCode
Site language code.
static closeElement($element)
Shortcut to close an XML element.
Definition: Xml.php:118
static getTextInputAttributes(array $attrs)
Modifies a set of attributes meant for text input elements and apply a set of default attributes...
Definition: Html.php:139
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such entity
static submitButton($value, $attribs=array())
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:460
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:204
namespace and then decline to actually register it file or subcat img or subcat RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
Definition: hooks.txt:882
static password($name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML password input field.
Definition: Xml.php:298
magic word the default is to use $key to get the label
Definition: hooks.txt:2284
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:1203
static checkLabel($label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:420
if($limit) $timestamp
namespace and then decline to actually register it file or subcat img or subcat RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition: hooks.txt:968
static getInstance($ts=false)
Get a timestamp instance in GMT.
static radioLabel($label, $name, $value, $id, $checked=false, $attribs=array())
Convenience function to build an HTML radio button with a label.
Definition: Xml.php:445
MediaWiki exception.
Definition: MWException.php:26
static openElement($element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
static dateMenu($year, $month)
Definition: Xml.php:167
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"&lt
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to and or sell copies of the and to permit persons to whom the Software is furnished to do so
Definition: LICENSE.txt:10
$wgUseMediaWikiUIEverywhere
Temporary variable that applies MediaWiki UI wherever it can be supported.
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
static escapeJsString($string)
Returns an escaped string suitable for inclusion in a string literal for JavaScript source code...
Definition: Xml.php:626
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
#define the
namespace and then decline to actually register it file or subcat img or subcat RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition: hooks.txt:968
static check($name, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox.
Definition: Xml.php:324
static textarea($name, $content, $cols=40, $rows=5, $attribs=array())
Shortcut for creating textareas.
Definition: Xml.php:604
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
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
static input($name, $value= '', $type= 'text', array $attribs=array())
Convenience function to produce an "<input>" element.
Definition: Html.php:710
static radio($name, $value, $checked=false, $attribs=array())
Convenience function to build an HTML radio button.
Definition: Xml.php:342
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static element($element, $attribs=array(), $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:237
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition: design.txt:56
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the Work
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
static attrib($name, $present=true)
Internal function for use in checkboxes and radio buttons and such.
Definition: Xml.php:313
maintenance dev scripts can help quickly setup a local MediaWiki for development purposes Wikis setup in this way are NOT meant to be publicly available They use a development database not acceptible for use in production Place a sqlite database in an unsafe location a real wiki should never place it in And use predictable default logins for the initial administrator user Running maintenance dev install sh will download and install a local copy of php
Definition: README:5
Module of static functions for generating XML.
Definition: Xml.php:26
static listDropDown($name= '', $list= '', $other= '', $selected= '', $class= '', $tabindex=null)
Build a drop-down box from a textual list.
Definition: Xml.php:508
static fieldset($legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
Definition: Xml.php:578
static input($name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
Definition: Xml.php:275
static wrapClass($text, $class, $tag= 'span', $attribs=array())
Shortcut to make a specific element with a class attribute.
Definition: Xml.php:263
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:1750
static encodeAttribute($text)
Encode an attribute value for HTML output.
Definition: Sanitizer.php:1043
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 overridable Default is either copyrightwarning or copyrightwarning2 overridable Default is editpage tos summary such as anonymity and the real check
Definition: hooks.txt:1203
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:91