Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -430,18 +430,8 @@ |
431 | 431 | public static function makeCustomLoaderScript( $name, $version, $dependencies, $group, $script ) { |
432 | 432 | $name = Xml::escapeJsString( $name ); |
433 | 433 | $version = (int) $version > 1 ? (int) $version : 1; |
434 | | - if ( is_array( $dependencies ) ) { |
435 | | - $dependencies = FormatJson::encode( $dependencies ); |
436 | | - } else if ( is_string( $dependencies ) ) { |
437 | | - $dependencies = "'" . Xml::escapeJsString( $dependencies ) . "'"; |
438 | | - } else { |
439 | | - $dependencies = 'null'; |
440 | | - } |
441 | | - if ( is_string( $group ) ) { |
442 | | - $group = "'" . Xml::escapeJsString( $group ) . "'"; |
443 | | - } else { |
444 | | - $group = 'null'; |
445 | | - } |
| 434 | + $dependencies = FormatJson::encode( $dependencies ); |
| 435 | + $group = FormatJson::encode( $group ); |
446 | 436 | $script = str_replace( "\n", "\n\t", trim( $script ) ); |
447 | 437 | return "( function( name, version, dependencies, group ) {\n\t$script\n} )" . |
448 | 438 | "( '$name', $version, $dependencies, $group );\n"; |
— | — | @@ -454,18 +444,8 @@ |
455 | 445 | } else { |
456 | 446 | $name = Xml::escapeJsString( $name ); |
457 | 447 | $version = (int) $version > 1 ? (int) $version : 1; |
458 | | - if ( is_array( $dependencies ) ) { |
459 | | - $dependencies = FormatJson::encode( $dependencies ); |
460 | | - } else if ( is_string( $dependencies ) ) { |
461 | | - $dependencies = "'" . Xml::escapeJsString( $dependencies ) . "'"; |
462 | | - } else { |
463 | | - $dependencies = 'null'; |
464 | | - } |
465 | | - if ( is_string( $group ) ) { |
466 | | - $group = "'" . Xml::escapeJsString( $group ) . "'"; |
467 | | - } else { |
468 | | - $group = 'null'; |
469 | | - } |
| 448 | + $dependencies = FormatJson::encode( $dependencies ); |
| 449 | + $group = FormatJson::encode( $group ); |
470 | 450 | return "mediaWiki.loader.register( '$name', $version, $dependencies, $group );\n"; |
471 | 451 | } |
472 | 452 | } |