Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php |
— | — | @@ -107,6 +107,9 @@ |
108 | 108 | static $num_autocompletion_inputs = 0; |
109 | 109 | |
110 | 110 | static function registerFunctions( &$parser ) { |
| 111 | + |
| 112 | + global $wgOut; |
| 113 | + |
111 | 114 | $parser->setFunctionHook( 'forminput', array( 'SFParserFunctions', 'renderFormInput' ) ); |
112 | 115 | $parser->setFunctionHook( 'formlink', array( 'SFParserFunctions', 'renderFormLink' ) ); |
113 | 116 | if ( defined( get_class( $parser ) . '::SFH_OBJECT_ARGS' ) ) { |
— | — | @@ -117,11 +120,9 @@ |
118 | 121 | $parser->setFunctionHook( 'arraymaptemplate', array( 'SFParserFunctions', 'renderArrayMapTemplate' ) ); |
119 | 122 | } |
120 | 123 | |
121 | | - // load jQuery |
122 | | - // only necessary in MW 1.16, does nothing in MW 1.17+ |
123 | | - global $wgVersion, $wgOut; |
124 | | - if ( version_compare( $wgVersion, '1.17', '<=' ) && is_callable( array( $wgOut, 'includeJQuery' ) ) ) { |
125 | | - $wgOut->includeJQuery(); // Fixme: this is including jQuery on every page load |
| 124 | + // load jQuery on MW 1.16 |
| 125 | + if ( is_callable( array( $wgOut, 'includeJQuery' ) ) ) { |
| 126 | + $wgOut -> includeJQuery(); |
126 | 127 | } |
127 | 128 | |
128 | 129 | return true; |
— | — | @@ -140,6 +141,9 @@ |
141 | 142 | } |
142 | 143 | |
143 | 144 | static function renderFormLink ( &$parser ) { |
| 145 | + |
| 146 | + global $wgVersion; |
| 147 | + |
144 | 148 | $params = func_get_args(); |
145 | 149 | array_shift( $params ); // don't need the parser |
146 | 150 | // set defaults |
— | — | @@ -164,7 +168,8 @@ |
165 | 169 | $inQueryStr = $value; |
166 | 170 | elseif ( $param_name == 'target' ) |
167 | 171 | $inTargetName = $value; |
168 | | - elseif ( $param_name == null && $value == 'popup' ) { |
| 172 | + elseif ( $param_name == null && $value == 'popup' |
| 173 | + && version_compare( $wgVersion, '1.16', '>=' )) { |
169 | 174 | self::loadScriptsForPopupForm( $parser ); |
170 | 175 | $popupClassString = 'class="popupformlink"'; |
171 | 176 | } |
— | — | @@ -259,7 +264,8 @@ |
260 | 265 | } elseif ( $param_name == 'autocomplete on namespace' ) { |
261 | 266 | $inAutocompletionSource = $value; |
262 | 267 | $autocompletion_type = 'namespace'; |
263 | | - } elseif ( $param_name == null && $value == 'popup' ) { |
| 268 | + } elseif ( $param_name == null && $value == 'popup' |
| 269 | + && version_compare( $wgVersion, '1.16', '>=' )) { |
264 | 270 | self::loadScriptsForPopupForm( $parser ); |
265 | 271 | $popupClassString = 'class="popupforminput"'; |
266 | 272 | } |