From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/HTMLForm.php | 286 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 227 insertions(+), 59 deletions(-) (limited to 'includes/HTMLForm.php') diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 6f89d5b8..68639739 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -112,6 +112,7 @@ class HTMLForm extends ContextSource { 'submit' => 'HTMLSubmitField', 'hidden' => 'HTMLHiddenField', 'edittools' => 'HTMLEditTools', + 'checkmatrix' => 'HTMLCheckMatrix', // HTMLTextField will output the correct type="" attribute automagically. // There are about four zillion other HTML5 input types, like url, but @@ -189,10 +190,10 @@ class HTMLForm extends ContextSource { /** * Build a new HTMLForm from an array of field attributes - * @param $descriptor Array of Field constructs, as described above + * @param array $descriptor of Field constructs, as described above * @param $context IContextSource available since 1.18, will become compulsory in 1.18. * Obviates the need to call $form->setTitle() - * @param $messagePrefix String a prefix to go in front of default messages + * @param string $messagePrefix a prefix to go in front of default messages */ public function __construct( $descriptor, /*IContextSource*/ $context = null, $messagePrefix = '' ) { if ( $context instanceof IContextSource ) { @@ -247,8 +248,9 @@ class HTMLForm extends ContextSource { /** * Set format in which to display the form - * @param $format String the name of the format to use, must be one of + * @param string $format the name of the format to use, must be one of * $this->availableDisplayFormats + * @throws MWException * @since 1.20 * @return HTMLForm $this for chaining calls (since 1.20) */ @@ -279,7 +281,8 @@ class HTMLForm extends ContextSource { /** * Initialise a new Object for the field * @param $fieldname string - * @param $descriptor string input Descriptor, as described above + * @param string $descriptor input Descriptor, as described above + * @throws MWException * @return HTMLFormField subclass */ static function loadInputFromParameters( $fieldname, $descriptor ) { @@ -313,6 +316,7 @@ class HTMLForm extends ContextSource { * @attention When doing method chaining, that should be the very last * method call before displayForm(). * + * @throws MWException * @return HTMLForm $this for chaining calls (since 1.20) */ function prepareForm() { @@ -374,11 +378,12 @@ class HTMLForm extends ContextSource { } /** - * Validate all the fields, and call the submision callback + * Validate all the fields, and call the submission callback * function if everything is kosher. + * @throws MWException * @return Mixed Bool true == Successful submission, Bool false - * == No submission attempted, anything else == Error to - * display. + * == No submission attempted, anything else == Error to + * display. */ function trySubmit() { # Check for validation @@ -412,7 +417,7 @@ class HTMLForm extends ContextSource { /** * Set a callback to a function to do something with the form * once it's been successfully validated. - * @param $cb String function name. The function will be passed + * @param string $cb function name. The function will be passed * the output from HTMLForm::filterDataForSubmit, and must * return Bool true on success, Bool false if no submission * was attempted, or String HTML output to display on error. @@ -436,7 +441,7 @@ class HTMLForm extends ContextSource { /** * Set the introductory message, overwriting any existing message. - * @param $msg String complete text of message to display + * @param string $msg complete text of message to display * @return HTMLForm $this for chaining calls (since 1.20) */ function setIntro( $msg ) { @@ -447,7 +452,7 @@ class HTMLForm extends ContextSource { /** * Set the introductory message, overwriting any existing message. * @since 1.19 - * @param $msg String complete text of message to display + * @param string $msg complete text of message to display * @return HTMLForm $this for chaining calls (since 1.20) */ function setPreText( $msg ) { @@ -457,7 +462,7 @@ class HTMLForm extends ContextSource { /** * Add introductory text. - * @param $msg String complete text of message to display + * @param string $msg complete text of message to display * @return HTMLForm $this for chaining calls (since 1.20) */ function addPreText( $msg ) { @@ -467,8 +472,8 @@ class HTMLForm extends ContextSource { /** * Add header text, inside the form. - * @param $msg String complete text of message to display - * @param $section string The section to add the header to + * @param string $msg complete text of message to display + * @param string $section The section to add the header to * @return HTMLForm $this for chaining calls (since 1.20) */ function addHeaderText( $msg, $section = null ) { @@ -486,7 +491,7 @@ class HTMLForm extends ContextSource { /** * Set header text, inside the form. * @since 1.19 - * @param $msg String complete text of message to display + * @param string $msg complete text of message to display * @param $section The section to add the header to * @return HTMLForm $this for chaining calls (since 1.20) */ @@ -501,8 +506,8 @@ class HTMLForm extends ContextSource { /** * Add footer text, inside the form. - * @param $msg String complete text of message to display - * @param $section string The section to add the footer text to + * @param string $msg complete text of message to display + * @param string $section The section to add the footer text to * @return HTMLForm $this for chaining calls (since 1.20) */ function addFooterText( $msg, $section = null ) { @@ -520,8 +525,8 @@ class HTMLForm extends ContextSource { /** * Set footer text, inside the form. * @since 1.19 - * @param $msg String complete text of message to display - * @param $section string The section to add the footer text to + * @param string $msg complete text of message to display + * @param string $section The section to add the footer text to * @return HTMLForm $this for chaining calls (since 1.20) */ function setFooterText( $msg, $section = null ) { @@ -535,7 +540,7 @@ class HTMLForm extends ContextSource { /** * Add text to the end of the display. - * @param $msg String complete text of message to display + * @param string $msg complete text of message to display * @return HTMLForm $this for chaining calls (since 1.20) */ function addPostText( $msg ) { @@ -545,7 +550,7 @@ class HTMLForm extends ContextSource { /** * Set text at the end of the display. - * @param $msg String complete text of message to display + * @param string $msg complete text of message to display * @return HTMLForm $this for chaining calls (since 1.20) */ function setPostText( $msg ) { @@ -555,8 +560,8 @@ class HTMLForm extends ContextSource { /** * Add a hidden field to the output - * @param $name String field name. This will be used exactly as entered - * @param $value String field value + * @param string $name field name. This will be used exactly as entered + * @param string $value field value * @param $attribs Array * @return HTMLForm $this for chaining calls (since 1.20) */ @@ -568,9 +573,9 @@ class HTMLForm extends ContextSource { /** * Add a button to the form - * @param $name String field name. - * @param $value String field value - * @param $id String DOM id for the button (default: null) + * @param string $name field name. + * @param string $value field value + * @param string $id DOM id for the button (default: null) * @param $attribs Array * @return HTMLForm $this for chaining calls (since 1.20) */ @@ -620,7 +625,7 @@ class HTMLForm extends ContextSource { /** * Wrap the form innards in an actual "
" element - * @param $html String HTML contents to wrap. + * @param string $html HTML contents to wrap. * @return String wrapped HTML. */ function wrapForm( $html ) { @@ -635,9 +640,9 @@ class HTMLForm extends ContextSource { : 'application/x-www-form-urlencoded'; # Attributes $attribs = array( - 'action' => $this->mAction === false ? $this->getTitle()->getFullURL() : $this->mAction, - 'method' => $this->mMethod, - 'class' => 'visualClear', + 'action' => $this->mAction === false ? $this->getTitle()->getFullURL() : $this->mAction, + 'method' => $this->mMethod, + 'class' => 'visualClear', 'enctype' => $encType, ); if ( !empty( $this->mId ) ) { @@ -708,8 +713,8 @@ class HTMLForm extends ContextSource { foreach ( $this->mButtons as $button ) { $attrs = array( - 'type' => 'submit', - 'name' => $button['name'], + 'type' => 'submit', + 'name' => $button['name'], 'value' => $button['value'] ); @@ -760,7 +765,7 @@ class HTMLForm extends ContextSource { /** * Format a stack of error messages into a single HTML string - * @param $errors Array of message keys/values + * @param array $errors of message keys/values * @return String HTML, a "