Go to the documentation of this file.
13 protected $mLabel; # String label. Set
on construction
54 $args = func_get_args();
56 if ( $this->mParent ) {
57 $callback =
array( $this->mParent,
'msg' );
59 $callback =
'wfMessage';
62 return call_user_func_array( $callback,
$args );
76 if ( isset( $this->mParams[
'required'] )
77 && $this->mParams[
'required'] !==
false
80 return $this->
msg(
'htmlform-required' )->parse();
83 if ( isset( $this->mValidationCallback ) ) {
84 return call_user_func( $this->mValidationCallback,
$value, $alldata, $this->mParent );
91 if ( isset( $this->mFilterCallback ) ) {
92 $value = call_user_func( $this->mFilterCallback,
$value, $alldata, $this->mParent );
118 $this->mShowEmptyLabels = $show;
129 if ( $request->getCheck( $this->mName ) ) {
130 return $request->getText( $this->mName );
147 # Generate the label from a message, if possible
148 if ( isset(
$params[
'label-message'] ) ) {
149 $msgInfo =
$params[
'label-message'];
151 if ( is_array( $msgInfo ) ) {
152 $msg = array_shift( $msgInfo );
158 $this->mLabel =
wfMessage( $msg, $msgInfo )->parse();
159 } elseif ( isset(
$params[
'label'] ) ) {
160 if (
$params[
'label'] ===
' ' ) {
162 $this->mLabel =
' ';
164 $this->mLabel = htmlspecialchars(
$params[
'label'] );
166 } elseif ( isset(
$params[
'label-raw'] ) ) {
167 $this->mLabel =
$params[
'label-raw'];
170 $this->mName =
"wp{$params['fieldname']}";
171 if ( isset(
$params[
'name'] ) ) {
172 $this->mName =
$params[
'name'];
176 if ( $this->mName != $validName && !isset(
$params[
'nodata'] ) ) {
177 throw new MWException(
"Invalid name '{$this->mName}' passed to " . __METHOD__ );
180 $this->mID =
"mw-input-{$this->mName}";
182 if ( isset(
$params[
'default'] ) ) {
183 $this->mDefault =
$params[
'default'];
186 if ( isset(
$params[
'id'] ) ) {
190 if ( $id != $validId ) {
191 throw new MWException(
"Invalid id '$id' passed to " . __METHOD__ );
197 if ( isset(
$params[
'cssclass'] ) ) {
198 $this->mClass =
$params[
'cssclass'];
201 if ( isset(
$params[
'validation-callback'] ) ) {
202 $this->mValidationCallback =
$params[
'validation-callback'];
205 if ( isset(
$params[
'filter-callback'] ) ) {
206 $this->mFilterCallback =
$params[
'filter-callback'];
209 if ( isset(
$params[
'flatlist'] ) ) {
210 $this->mClass .=
' mw-htmlform-flatlist';
213 if ( isset(
$params[
'hidelabel'] ) ) {
214 $this->mShowEmptyLabels =
false;
229 $fieldType = get_class( $this );
231 $cellAttributes =
array();
233 if ( !empty( $this->mParams[
'vertical-label'] ) ) {
234 $cellAttributes[
'colspan'] = 2;
235 $verticalLabel =
true;
237 $verticalLabel =
false;
244 array(
'class' =>
'mw-input' ) + $cellAttributes,
245 $inputHtml .
"\n$errors"
248 if ( $verticalLabel ) {
251 array(
'class' =>
"mw-htmlform-field-$fieldType {$this->mClass} $errorClass" ),
256 array(
'class' =>
"mw-htmlform-field-$fieldType {$this->mClass} $errorClass" ),
260 return $html . $helptext;
275 $fieldType = get_class( $this );
277 $cellAttributes =
array();
280 $outerDivClass =
array(
282 'mw-htmlform-nolabel' => ( $label ===
'' )
287 array(
'class' => $outerDivClass ) + $cellAttributes,
288 $inputHtml .
"\n$errors"
290 $divCssClasses =
array(
"mw-htmlform-field-$fieldType", $this->mClass, $errorClass );
291 if ( $this->mParent->isVForm() ) {
292 $divCssClasses[] =
'mw-ui-vform-div';
313 $cellAttributes =
array();
332 if ( is_null( $helptext ) ) {
351 if ( is_null( $helptext ) ) {
379 if ( isset( $this->mParams[
'help-message'] ) ) {
380 $this->mParams[
'help-messages'] =
array( $this->mParams[
'help-message'] );
383 if ( isset( $this->mParams[
'help-messages'] ) ) {
384 foreach ( $this->mParams[
'help-messages']
as $name ) {
386 $msg = $this->
msg( array_shift( $helpMessage ), $helpMessage );
388 if ( $msg->exists() ) {
389 if ( is_null( $helptext ) ) {
392 $helptext .= $this->
msg(
'word-separator' )->escaped();
394 $helptext .= $msg->parse();
397 } elseif ( isset( $this->mParams[
'help'] ) ) {
398 $helptext = $this->mParams[
'help'];
414 if ( $errors ===
true ||
415 ( !$this->mParent->getRequest()->wasPosted() && $this->mParent->getMethod() ===
'post' )
421 $errorClass =
'mw-htmlform-invalid-input';
424 return array( $errors, $errorClass );
432 # Don't output a for= attribute for labels with no associated input.
433 # Kind of hacky here, possibly we don't want these to be <label>s at all.
440 $labelValue = trim( $this->
getLabel() );
442 if ( $labelValue !==
' ' && $labelValue !==
'' ) {
446 $displayFormat = $this->mParent->getDisplayFormat();
449 if ( $displayFormat ===
'table' ) {
452 array(
'class' =>
'mw-label' ) + $cellAttributes,
454 } elseif ( $hasLabel || $this->mShowEmptyLabels ) {
455 if ( $displayFormat ===
'div' ) {
458 array(
'class' =>
'mw-label' ) + $cellAttributes,
469 if ( isset( $this->mDefault ) ) {
482 if ( empty( $this->mParams[
'tooltip'] ) ) {
496 static $boolAttribs =
array(
'disabled',
'required',
'autofocus',
'multiple',
'readonly' );
500 foreach ( $list
as $key ) {
501 if ( in_array( $key, $boolAttribs ) ) {
502 if ( !empty( $this->mParams[$key] ) ) {
505 } elseif ( isset( $this->mParams[$key] ) ) {
506 $ret[$key] = $this->mParams[$key];
523 $key = $this->
msg( $key )->plain();
539 if ( is_array( $array ) ) {
540 return array_map(
array( __CLASS__,
'forceToStringRecursive' ), $array );
542 return strval( $array );
553 if ( $this->mOptions ===
false ) {
554 if ( array_key_exists(
'options-messages', $this->mParams ) ) {
555 $this->mOptions = $this->
lookupOptionsKeys( $this->mParams[
'options-messages'] );
556 } elseif ( array_key_exists(
'options', $this->mParams ) ) {
557 $this->mOptionsLabelsNotFromMessage =
true;
559 } elseif ( array_key_exists(
'options-message', $this->mParams ) ) {
561 $message = $this->
msg( $this->mParams[
'options-message'] )->inContentLanguage()->plain();
564 $this->mOptions =
array();
565 foreach ( explode(
"\n", $message )
as $option ) {
569 } elseif ( substr(
$value, 0, 1 ) ==
'*' && substr(
$value, 1, 1 ) !=
'*' ) {
570 # A new group is starting...
573 } elseif ( substr(
$value, 0, 2 ) ==
'**' ) {
575 $opt = trim( substr(
$value, 2 ) );
576 if ( $optgroup ===
false ) {
577 $this->mOptions[$opt] = $opt;
579 $this->mOptions[$optgroup][$opt] = $opt;
582 # groupless reason list
584 $this->mOptions[$option] = $option;
588 $this->mOptions =
null;
607 if ( is_array(
$value ) ) {
608 $flatOpts = array_merge( $flatOpts, self::flattenOptions(
$value ) );
625 if ( is_array( $errors ) && count( $errors ) === 1 ) {
626 $errors = array_shift( $errors );
629 if ( is_array( $errors ) ) {
632 if (
$error instanceof Message ) {
641 if ( $errors instanceof Message ) {
642 $errors = $errors->parse();
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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
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 & $ret
static tooltipAndAccesskeyAttribs( $name)
Returns the attributes for the tooltip and access key.
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 "<
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
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
static escapeId( $id, $options=array())
Given a value, escape it so that it can be used in an id attribute and return it.
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
Allows to change the fields on the form that will be generated $name
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
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
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string as detected by MediaWiki Handlers will typically only apply for specific mime types object & $error
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.