Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php |
— | — | @@ -163,15 +163,29 @@ |
164 | 164 | $inFormName = $inLinkStr = $inLinkType = $inTitle = |
165 | 165 | $inQueryStr = $inTargetName = ''; |
166 | 166 | $classStr = ""; |
167 | | - // assign params - support unlabelled params, for backwards compatibility |
| 167 | + // assign params |
| 168 | + // - support unlabelled params, for backwards compatibility |
| 169 | + // - parse and sanitize all parameter values |
168 | 170 | foreach ( $params as $i => $param ) { |
| 171 | + |
169 | 172 | $elements = explode( '=', $param, 2 ); |
170 | | - $param_name = null; |
171 | | - $value = trim( $param ); |
| 173 | + |
| 174 | + // set param_name and value |
172 | 175 | if ( count( $elements ) > 1 ) { |
| 176 | + |
173 | 177 | $param_name = trim( $elements[0] ); |
| 178 | + |
| 179 | + // parse (and sanitize) parameter values |
174 | 180 | $value = trim( $parser->recursiveTagParse( $elements[1] ) ); |
| 181 | + |
| 182 | + } else { |
| 183 | + |
| 184 | + $param_name = null; |
| 185 | + |
| 186 | + // parse (and sanitize) parameter values |
| 187 | + $value = trim( $parser->recursiveTagParse( $param ) ); |
175 | 188 | } |
| 189 | + |
176 | 190 | if ( $param_name == 'form' ) { |
177 | 191 | $inFormName = $value; |
178 | 192 | } elseif ( $param_name == 'link text' ) { |
— | — | @@ -190,13 +204,13 @@ |
191 | 205 | $classStr = 'popupformlink'; |
192 | 206 | } |
193 | 207 | elseif ( $i == 0 ) { |
194 | | - $inFormName = $param; |
| 208 | + $inFormName = $value; |
195 | 209 | } elseif ( $i == 1 ) { |
196 | | - $inLinkStr = $param; |
| 210 | + $inLinkStr = $value; |
197 | 211 | } elseif ( $i == 2 ) { |
198 | | - $inLinkType = $param; |
| 212 | + $inLinkType = $value; |
199 | 213 | } elseif ( $i == 3 ) { |
200 | | - $inQueryStr = $param; |
| 214 | + $inQueryStr = $value; |
201 | 215 | } |
202 | 216 | } |
203 | 217 | |
— | — | @@ -236,20 +250,16 @@ |
237 | 251 | } |
238 | 252 | if ( $inLinkType == 'button' ) { |
239 | 253 | $str = |
240 | | - Xml::openElement( 'form', array('action' => $link_url, 'method' => 'get', 'class' => $classStr) ) . |
241 | | - Xml::openElement( 'button', array('type' => 'submit', 'value' => $inLinkStr) ) . |
242 | | - $inLinkStr . |
243 | | - Xml::closeElement( 'button' ) . |
244 | | - $hidden_inputs . |
245 | | - Xml::closeElement( 'form' ); |
| 254 | + Xml::tags( 'form', array('action' => $link_url, 'method' => 'get', 'class' => $classStr), |
| 255 | + Xml::tags( 'button', array('type' => 'submit', 'value' => $inLinkStr), $inLinkStr ) . |
| 256 | + $hidden_inputs |
| 257 | + ); |
246 | 258 | } elseif ( $inLinkType == 'post button' ) { |
247 | 259 | $str = |
248 | | - Xml::openElement( 'form', array('action' => $link_url, 'method' => 'post', 'class' => $classStr) ) . |
249 | | - Xml::openElement( 'button', array('type' => 'submit', 'value' => $inLinkStr) ) . |
250 | | - $inLinkStr . |
251 | | - Xml::closeElement( 'button' ) . |
252 | | - $hidden_inputs . |
253 | | - Xml::closeElement( 'form' ); |
| 260 | + Xml::tags( 'form', array('action' => $link_url, 'method' => 'get', 'class' => $classStr), |
| 261 | + Xml::tags( 'button', array('type' => 'submit', 'value' => $inLinkStr), $inLinkStr ) . |
| 262 | + $hidden_inputs |
| 263 | + ); |
254 | 264 | } else { |
255 | 265 | // If a target page has been specified but it doesn't |
256 | 266 | // exist, make it a red link. |
— | — | @@ -259,10 +269,7 @@ |
260 | 270 | $classStr .= " new"; |
261 | 271 | } |
262 | 272 | } |
263 | | - $str = |
264 | | - Xml::openElement( 'a', array('href' => $link_url, 'class' => $classStr, 'title' => $inTitle) ) . |
265 | | - $inLinkStr . |
266 | | - Xml::closeElement( 'a' ); |
| 273 | + $str = Xml::tags( 'a', array('href' => $link_url, 'class' => $classStr, 'title' => $inTitle), $inLinkStr ); |
267 | 274 | } |
268 | 275 | // hack to remove newline from beginning of output, thanks to |
269 | 276 | // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function |