Index: trunk/phase3/includes/Skin.php |
— | — | @@ -333,13 +333,17 @@ |
334 | 334 | } |
335 | 335 | |
336 | 336 | static function makeVariablesScript( $data ) { |
337 | | - $r = array(); |
338 | | - foreach ( $data as $name => $value ) { |
339 | | - $encValue = Xml::encodeJsVar( $value ); |
340 | | - $r[] = "var $name = $encValue;"; |
| 337 | + if( $data ) { |
| 338 | + $r = array(); |
| 339 | + foreach ( $data as $name => $value ) { |
| 340 | + $encValue = Xml::encodeJsVar( $value ); |
| 341 | + $r[] = "$name=$encValue"; |
| 342 | + } |
| 343 | + $js = 'var ' . implode( ",\n", $r ) . ';'; |
| 344 | + return Html::inlineScript( "\n$js\n" ); |
| 345 | + } else { |
| 346 | + return ''; |
341 | 347 | } |
342 | | - return Html::inlineScript( "\n\t\t" . implode( "\n\t\t", $r ) . |
343 | | - "\n\t\t" ); |
344 | 348 | } |
345 | 349 | |
346 | 350 | /** |