r93551 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93550‎ | r93551 | r93552 >
Date:18:56, 30 July 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
cheking in getXMLTextForPS
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -176,6 +176,41 @@
177177 }
178178 return true;
179179 }
 180+ public static function getXMLTextForPS( $wgRequest, &$text_extensions ){
 181+
 182+ $Xmltext = "";
 183+ $templateNum = -1;
 184+ foreach ( $wgRequest->getValues() as $var => $val ) {
 185+ if(substr($var,0,14) == 'sf_input_type_'){
 186+ $templateNum = substr($var,14,1);
 187+ $Xmltext .= '<FormInput>';
 188+ $Xmltext .= '<InputType>'.$val.'</InputType>';
 189+ }else if(substr($var,0,14) == 'sf_key_values_'){
 190+ if ( $val != '' ) {
 191+ // replace the comma substitution character that has no chance of
 192+ // being included in the values list - namely, the ASCII beep
 193+ $listSeparator = ',';
 194+ $key_values_str = str_replace( "\\$listSeparator", "\a", $val );
 195+ $key_values_array = explode( $listSeparator, $key_values_str );
 196+ foreach ( $key_values_array as $i => $value ) {
 197+ // replace beep back with comma, trim
 198+ $value = str_replace( "\a", $listSeparator, trim( $value ) );
 199+ $param_value = explode( "=", $value );
 200+ if($param_value[1] != null ) {
 201+ //handles Parameter name="size">20</Parameter>
 202+ $Xmltext .= '<Parameter name="'.$param_value[0].'">'.$param_value[1].'</Parameter>';
 203+ }else{
 204+ //handlers <Parameter name="mandatory" />
 205+ $Xmltext .= '<Parameter name="'.$param_value[0].'"/>';
 206+ }
 207+ }
 208+ }
 209+ }
 210+ }
 211+ $Xmltext .= '</FormInput>';
 212+ $text_extensions['sf'] = $Xmltext;
 213+ return true;
 214+ }
180215 public static function getHtmlTextForPS( &$js_extensions ,&$text_extensions ) {
181216 $html_text = "";
182217 $html_text .= '<p><legend>semanticForms:FormInput</legend> </p>