r109214 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109213‎ | r109214 | r109215 >
Date:21:15, 17 January 2012
Author:yaron
Status:deferred
Tags:
Comment:
Fixed handling in #formlink of parentheses in {{PAGENAME}} within query string; also improved some general #formlink code
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -190,7 +190,7 @@
191191 } elseif ( $param_name == 'link type' ) {
192192 $inLinkType = $value;
193193 } elseif ( $param_name == 'query string' ) {
194 - $inQueryStr = $value;
 194+ $inQueryStr = Sanitizer::decodeCharReferences( $value );
195195 } elseif ( $param_name == 'tooltip' ) {
196196 $inTooltip = Sanitizer::decodeCharReferences( $value );
197197 } elseif ( $param_name == 'target' ) {
@@ -206,7 +206,7 @@
207207 } elseif ( $i == 2 ) {
208208 $inLinkType = $value;
209209 } elseif ( $i == 3 ) {
210 - $inQueryStr = $value;
 210+ $inQueryStr = Sanitizer::decodeCharReferences( $value );
211211 }
212212 }
213213
@@ -244,18 +244,12 @@
245245 $link_url .= $inQueryStr;
246246 }
247247 }
248 - if ( $inLinkType == 'button' ) {
249 - $str =
250 - Html::rawElement( 'form', array( 'action' => $link_url, 'method' => 'get', 'class' => $classStr ),
251 - Html::rawElement( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
252 - $hidden_inputs
253 - );
254 - } elseif ( $inLinkType == 'post button' ) {
255 - $str =
256 - Html::rawElement( 'form', array( 'action' => $link_url, 'method' => 'post', 'class' => $classStr ),
257 - Html::rawElement( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
258 - $hidden_inputs
259 - );
 248+ if ( $inLinkType == 'button' || $inLinkType == 'post button' ) {
 249+ $formMethod = ( $inLinkType == 'button' ) ? 'get' : 'post';
 250+ $str = Html::rawElement( 'form', array( 'action' => $link_url, 'method' => $formMethod, 'class' => $classStr ),
 251+ Html::rawElement( 'button', array( 'type' => 'submit', 'value' => $inLinkStr ), $inLinkStr ) .
 252+ $hidden_inputs
 253+ );
260254 } else {
261255 // If a target page has been specified but it doesn't
262256 // exist, make it a red link.