Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php |
— | — | @@ -158,29 +158,30 @@ |
159 | 159 | $param_name = trim( $elements[0] ); |
160 | 160 | $value = trim( $parser->recursiveTagParse( $elements[1] ) ); |
161 | 161 | } |
162 | | - if ( $param_name == 'form' ) |
| 162 | + if ( $param_name == 'form' ) { |
163 | 163 | $inFormName = $value; |
164 | | - elseif ( $param_name == 'link text' ) |
| 164 | + } elseif ( $param_name == 'link text' ) { |
165 | 165 | $inLinkStr = $value; |
166 | | - elseif ( $param_name == 'link type' ) |
| 166 | + } elseif ( $param_name == 'link type' ) { |
167 | 167 | $inLinkType = $value; |
168 | | - elseif ( $param_name == 'query string' ) |
| 168 | + } elseif ( $param_name == 'query string' ) { |
169 | 169 | $inQueryStr = $value; |
170 | | - elseif ( $param_name == 'target' ) |
| 170 | + } elseif ( $param_name == 'target' ) { |
171 | 171 | $inTargetName = $value; |
172 | | - elseif ( $param_name == null && $value == 'popup' |
| 172 | + } elseif ( $param_name == null && $value == 'popup' |
173 | 173 | && version_compare( $wgVersion, '1.16', '>=' )) { |
174 | 174 | self::loadScriptsForPopupForm( $parser ); |
175 | 175 | $popupClassString = 'class="popupformlink"'; |
176 | 176 | } |
177 | | - elseif ( $i == 0 ) |
| 177 | + elseif ( $i == 0 ) { |
178 | 178 | $inFormName = $param; |
179 | | - elseif ( $i == 1 ) |
| 179 | + } elseif ( $i == 1 ) { |
180 | 180 | $inLinkStr = $param; |
181 | | - elseif ( $i == 2 ) |
| 181 | + } elseif ( $i == 2 ) { |
182 | 182 | $inLinkType = $param; |
183 | | - elseif ( $i == 3 ) |
| 183 | + } elseif ( $i == 3 ) { |
184 | 184 | $inQueryStr = $param; |
| 185 | + } |
185 | 186 | } |
186 | 187 | |
187 | 188 | $ad = SpecialPage::getPage( 'FormEdit' ); |
— | — | @@ -203,7 +204,7 @@ |
204 | 205 | $query_component = urldecode( $query_component ); |
205 | 206 | $var_and_val = explode( '=', $query_component ); |
206 | 207 | if ( count( $var_and_val ) == 2 ) { |
207 | | - $hidden_inputs .= '<input type="hidden" name="' . $var_and_val[0] . '" value="' . $var_and_val[1] . '" /> '; |
| 208 | + $hidden_inputs .= Xml::hidden( $var_and_val[0], $var_and_val[1] ) . "\n"; |
208 | 209 | } |
209 | 210 | } |
210 | 211 | } else { |
— | — | @@ -220,9 +221,16 @@ |
221 | 222 | if ( $inLinkType == 'button' ) { |
222 | 223 | $link_url = html_entity_decode( $link_url, ENT_QUOTES ); |
223 | 224 | $link_url = str_replace( "'", "\'", $link_url ); |
224 | | - $str = "<form $popupClassString><input type=\"button\" value=\"$inLinkStr\" onclick=\"window.location.href='$link_url'\"></form>"; |
| 225 | + $str = "<form $popupClassString>"; |
| 226 | + $str .= Xml::element( 'input', array( |
| 227 | + 'type' => 'button', |
| 228 | + 'value' => $inLinkStr, |
| 229 | + 'onclick' => 'window.location.href=' . $link_url |
| 230 | + ) ) . "</form>"; |
225 | 231 | } elseif ( $inLinkType == 'post button' ) { |
226 | | - $str = "<form action=\"$link_url\" method=\"post\" $popupClassString><input type=\"submit\" value=\"$inLinkStr\" />$hidden_inputs</form>"; |
| 232 | + $str = "<form action=\"$link_url\" method=\"post\" $popupClassString>"; |
| 233 | + $str .= Xml::element( 'input', array( 'type' => 'submit', 'value' => $inLinkStr ) ); |
| 234 | + $str .= "$hidden_inputs</form>"; |
227 | 235 | } else { |
228 | 236 | $str = "<a href=\"$link_url\" $popupClassString>$inLinkStr</a>"; |
229 | 237 | } |
— | — | @@ -305,26 +313,37 @@ |
306 | 314 | if ( empty( $inAutocompletionSource ) ) { |
307 | 315 | $str = <<<END |
308 | 316 | <form action="$fs_url" method="get" $popupClassString> |
309 | | - <p><input type="text" name="page_name" size="$inSize" value="$inValue" class="formInput" /> |
| 317 | + <p> |
310 | 318 | |
311 | 319 | END; |
| 320 | + $str .= Xml::element( 'input', |
| 321 | + array( 'type' => 'text', 'name' => 'page_name', 'size' => $inSize, 'value' => $inValue, 'class' => 'formInput' ) ); |
312 | 322 | } else { |
313 | 323 | $str = <<<END |
314 | 324 | <form name="createbox" action="$fs_url" method="get" $popupClassString> |
315 | | - <p><input type="text" name="page_name" id="input_$input_num" size="$inSize" value="$inValue" class="autocompleteInput createboxInput formInput" autocompletesettings="input_$input_num" /> |
| 325 | + <p> |
316 | 326 | |
317 | 327 | END; |
| 328 | + $str .= Xml::element( 'input', array( |
| 329 | + 'type' => 'text', |
| 330 | + 'name' => 'page_name', |
| 331 | + 'id' => 'input_' . $input_num, |
| 332 | + 'size' => $inSize, |
| 333 | + 'value' => $inValue, |
| 334 | + 'class' => 'autocompleteInput createboxInput formInput', |
| 335 | + 'autocompletesettings' => 'input_' . $input_num |
| 336 | + ) ); |
318 | 337 | } |
319 | 338 | // if the form start URL looks like "index.php?title=Special:FormStart" |
320 | 339 | // (i.e., it's in the default URL style), add in the title as a |
321 | 340 | // hidden value |
322 | 341 | if ( ( $pos = strpos( $fs_url, "title=" ) ) > - 1 ) { |
323 | | - $str .= ' <input type="hidden" name="title" value="' . urldecode( substr( $fs_url, $pos + 6 ) ) . '">' . "\n"; |
| 342 | + $str .= "\t\t\t" . Xml::hidden( "title", urldecode( substr( $fs_url, $pos + 6 ) ) ) . "\n"; |
324 | 343 | } |
325 | 344 | if ( $inFormName == '' ) { |
326 | 345 | $str .= SFUtils::formDropdownHTML(); |
327 | 346 | } else { |
328 | | - $str .= ' <input type="hidden" name="form" value="' . $inFormName . '">' . "\n"; |
| 347 | + $str .= "\t\t\t" . Xml::hidden( "form", $inFormName ) . "\n"; |
329 | 348 | } |
330 | 349 | // Recreate the passed-in query string as a set of hidden |
331 | 350 | // variables. |