Created
July 28, 2010 17:48
-
-
Save stas/495523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: /home/stas/Documente/www/wordpress/wp-includes/class.wp-scripts.php | |
=================================================================== | |
--- class.wp-scripts.php (revision 15473) | |
+++ class.wp-scripts.php (working copy) | |
@@ -60,8 +60,14 @@ | |
$after = $val; | |
continue; | |
} | |
- $data .= "$eol\t$var: \"" . esc_js( $val ) . '"'; | |
- $eol = ",\n"; | |
+ if( !is_array( $val ) ) { | |
+ $data .= "$eol\t$var: \"" . esc_js( $val ) . '"'; | |
+ $eol = ",\n"; | |
+ } else { | |
+ $data .= self::print_scripts_l10n_arr2js( $var, $val, $eol ); | |
+ $eol = ",\n"; | |
+ } | |
+ | |
} | |
$data .= "\n};\n"; | |
$data .= isset($after) ? "$after\n" : ''; | |
@@ -77,6 +83,30 @@ | |
return $data; | |
} | |
} | |
+ | |
+ function print_scripts_l10n_arr2js( $arr_name, $arr, $eol = "\n" ) { | |
+ $data = ''; | |
+ | |
+ $data .= "$eol\t$arr_name: "; | |
+ $eol = "\n\t"; | |
+ $data .= "{"; | |
+ $arr_last = end( $arr ); | |
+ foreach ( $arr as $k => $v ) { | |
+ if( is_array( $v ) ) { | |
+ $data .= self::print_scripts_l10n_arr2js( $k, $v, "\n\t" ); | |
+ $data .= ','; | |
+ } | |
+ else { | |
+ $data .= "$eol\t$k: \"" . esc_js( $v ) . '"'; | |
+ if( $v != $arr_last ) | |
+ $data .= ','; | |
+ } | |
+ } | |
+ $data .= "$eol}"; | |
+ $eol = ",\n"; | |
+ | |
+ return $data; | |
+ } | |
function do_item( $handle, $group = false ) { | |
if ( !parent::do_item($handle) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment