<?php
+/**
+ * HTML form generation and submission handling.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
/**
* Object handling generic submission, CSRF protection, layout and
* other logic for UI forms. in a reusable manner.
}
$callback = $this->mSubmitCallback;
+ if ( !is_callable( $callback ) ) {
+ throw new MWException( 'HTMLForm: no submit callback provided. Use setSubmitCallback() to set one.' );
+ }
$data = $this->filterDataForSubmit( $this->mFieldData );
* @return String HTML.
*/
function getHiddenFields() {
- global $wgUsePathInfo;
+ global $wgArticlePath;
$html = '';
if( $this->getMethod() == 'post' ){
$html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
}
- if ( !$wgUsePathInfo && $this->getMethod() == 'get' ) {
+ if ( strpos( $wgArticlePath, '?' ) !== false && $this->getMethod() == 'get' ) {
$html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
}
* @param $msg String message key
*/
public function setSubmitTextMsg( $msg ) {
- return $this->setSubmitText( $this->msg( $msg )->escaped() );
+ return $this->setSubmitText( $this->msg( $msg )->text() );
}
/**
$msg = wfMessage( array_shift( $helpMessage ), $helpMessage );
if( $msg->exists() ) {
+ if( is_null( $helptext ) ) {
+ $helptext = '';
+ } else {
+ $helptext .= wfMessage( 'word-separator' )->escaped(); // some space
+ }
$helptext .= $msg->parse(); // Append message
}
}
$attribs['readonly'] = 'readonly';
}
+ if ( isset( $this->mParams['placeholder'] ) ) {
+ $attribs['placeholder'] = $this->mParams['placeholder'];
+ }
+
foreach ( array( 'required', 'autofocus' ) as $param ) {
if ( isset( $this->mParams[$param] ) ) {
$attribs[$param] = '';