From 34ee5d86754d9ed3b42296456e3a64458e061289 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Thu, 24 Apr 2008 11:46:20 +0000 Subject: [PATCH] By suggestion of NikeRabbit, move wfBuildForm into Xml.php --- includes/GlobalFunctions.php | 29 ----------------------------- includes/Xml.php | 29 +++++++++++++++++++++++++++++ includes/XmlFunctions.php | 4 ++++ 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 9983b2dacc..4e56dbda89 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2537,32 +2537,3 @@ function wfGetAvailableRights() { return $rights; } - -/** - * Generate a form (without the opening form element). - * Output DOES include a submit button. - * @param array $fields Associative array, key is message corresponding to a description for the field (colon is in the message), value is appropriate input. - * @param string $submitLable A message containing a label for the submit button. - * @return string HTML form. - */ -function wfBuildForm( $fields, $submitLabel ) { - $form = ''; - $form .= ""; - - foreach( $fields as $labelmsg => $input ) { - $id = "mw-gb-$labelmsg"; - $form .= Xml::openElement( 'tr', array( 'class' => $id ) ); - - $form .= Xml::element( 'td', array('valign' => 'top'), wfMsg( $labelmsg ) ); - - $form .= Xml::openElement( 'td' ) . $input . Xml::closeElement( 'td' ); - - $form .= Xml::closeElement( 'tr' ); - } - - $form .= "
"; - - $form .= wfSubmitButton( wfMsg($submitLabel) ); - - return $form; -} diff --git a/includes/Xml.php b/includes/Xml.php index 5bb64fe6ab..5b8d088ac0 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -520,4 +520,33 @@ class Xml { array( '"', '>', '<' ), $in ); } + + /** + * Generate a form (without the opening form element). + * Output DOES include a submit button. + * @param array $fields Associative array, key is message corresponding to a description for the field (colon is in the message), value is appropriate input. + * @param string $submitLable A message containing a label for the submit button. + * @return string HTML form. + */ + function buildForm( $fields, $submitLabel ) { + $form = ''; + $form .= ""; + + foreach( $fields as $labelmsg => $input ) { + $id = "mw-gb-$labelmsg"; + $form .= Xml::openElement( 'tr' ); + + $form .= Xml::element( 'td', array('valign' => 'top'), wfMsg( $labelmsg ) ); + + $form .= Xml::openElement( 'td' ) . $input . Xml::closeElement( 'td' ); + + $form .= Xml::closeElement( 'tr' ); + } + + $form .= "
"; + + $form .= wfSubmitButton( wfMsg($submitLabel) ); + + return $form; + } } diff --git a/includes/XmlFunctions.php b/includes/XmlFunctions.php index 1a5aeaccac..bc18a2cdac 100644 --- a/includes/XmlFunctions.php +++ b/includes/XmlFunctions.php @@ -60,3 +60,7 @@ function wfIsWellFormedXml( $text ) { function wfIsWellFormedXmlFragment( $text ) { return Xml::isWellFormedXmlFragment( $text ); } + +function wfBuildForm( $fields, $submitLabel ) { + return Xml::buildForm( $fields, $submitLabel ); +} -- 2.20.1