Merge "Localisation updates from http://translatewiki.net."
[lhc/web/wiklou.git] / includes / HTMLForm.php
index ec1507c..c149965 100644 (file)
@@ -1,4 +1,25 @@
 <?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.
@@ -312,6 +333,9 @@ class HTMLForm extends ContextSource {
                }
 
                $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 );
 
@@ -1096,6 +1120,11 @@ abstract class HTMLFormField {
                                $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
                                }
                        }
@@ -1306,7 +1335,7 @@ class HTMLTextAreaField extends HTMLFormField {
                        $attribs['readonly'] = 'readonly';
                }
 
-               if ( !empty( $this->mParams['placeholder'] ) ) {
+               if ( isset( $this->mParams['placeholder'] ) ) {
                        $attribs['placeholder'] = $this->mParams['placeholder'];
                }