diff --git src/wp-admin/customize.php src/wp-admin/customize.php
index 178db28..5d1a357 100644
|
|
do_action( 'customize_controls_print_scripts' ); |
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
| 307 | $settings = wp_json_encode( $settings ); |
| 308 | // Sanity check to print valid JSON. |
| 309 | if ( false === $settings ) { |
| 310 | $settings = '[]'; |
| 311 | } |
| 312 | |
307 | 313 | ?> |
308 | 314 | <script type="text/javascript"> |
309 | | var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>; |
| 315 | var _wpCustomizeSettings = <?php echo $settings; ?>; |
310 | 316 | </script> |
311 | 317 | </div> |
312 | 318 | </body> |
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index c5718ae..3d51db8 100644
|
|
function wp_ajax_autocomplete_user() { |
289 | 289 | ); |
290 | 290 | } |
291 | 291 | |
292 | | wp_die( wp_json_encode( $return ) ); |
| 292 | $return = wp_json_encode( $return ); |
| 293 | // Sanity check to print valid JSON. |
| 294 | if ( false === $return ) { |
| 295 | $return = '[]'; |
| 296 | } |
| 297 | |
| 298 | wp_die( $return ); |
293 | 299 | } |
294 | 300 | |
295 | 301 | /** |
… |
… |
function wp_ajax_menu_get_metabox() { |
1375 | 1381 | |
1376 | 1382 | $markup = ob_get_clean(); |
1377 | 1383 | |
1378 | | echo wp_json_encode(array( |
| 1384 | $json = wp_json_encode( array( |
1379 | 1385 | 'replace-id' => $type . '-' . $item->name, |
1380 | 1386 | 'markup' => $markup, |
1381 | | )); |
| 1387 | ) ); |
| 1388 | // Sanity check to print valid JSON. |
| 1389 | if ( false === $json ) { |
| 1390 | $json = '[]'; |
| 1391 | } |
| 1392 | |
| 1393 | echo $json; |
1382 | 1394 | } |
1383 | 1395 | |
1384 | 1396 | wp_die(); |
… |
… |
function wp_ajax_wp_link_ajax() { |
1404 | 1416 | if ( ! isset( $results ) ) |
1405 | 1417 | wp_die( 0 ); |
1406 | 1418 | |
1407 | | echo wp_json_encode( $results ); |
| 1419 | $results = wp_json_encode( $results ); |
| 1420 | // Sanity check to print valid JSON. |
| 1421 | if ( false === $results ) { |
| 1422 | $results = '[]'; |
| 1423 | } |
| 1424 | |
| 1425 | echo $results; |
1408 | 1426 | echo "\n"; |
1409 | 1427 | |
1410 | 1428 | wp_die(); |
… |
… |
function wp_ajax_image_editor() { |
1919 | 1937 | case 'save' : |
1920 | 1938 | $msg = wp_save_image($attachment_id); |
1921 | 1939 | $msg = wp_json_encode($msg); |
| 1940 | // Sanity check to print valid JSON. |
| 1941 | if ( false === $msg ) { |
| 1942 | $msg = '{}'; |
| 1943 | } |
1922 | 1944 | wp_die( $msg ); |
1923 | 1945 | break; |
1924 | 1946 | case 'scale' : |
diff --git src/wp-admin/includes/class-wp-list-table.php src/wp-admin/includes/class-wp-list-table.php
index 1152e64..6ca8210 100644
|
|
class WP_List_Table { |
1106 | 1106 | $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] ); |
1107 | 1107 | } |
1108 | 1108 | |
1109 | | die( wp_json_encode( $response ) ); |
| 1109 | $response = wp_json_encode( $response ); |
| 1110 | // Sanity check to print valid JSON. |
| 1111 | if ( false === $response ) { |
| 1112 | $response = '[]'; |
| 1113 | } |
| 1114 | |
| 1115 | die( $response ); |
1110 | 1116 | } |
1111 | 1117 | |
1112 | 1118 | /** |
… |
… |
class WP_List_Table { |
1123 | 1129 | ) |
1124 | 1130 | ); |
1125 | 1131 | |
1126 | | printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) ); |
| 1132 | $args = wp_json_encode( $args ); |
| 1133 | // Sanity check to print valid JSON. |
| 1134 | if ( false === $args ) { |
| 1135 | $args = '[]'; |
| 1136 | } |
| 1137 | |
| 1138 | printf( "<script type='text/javascript'>list_args = %s;</script>\n", $args ); |
1127 | 1139 | } |
1128 | 1140 | } |
diff --git src/wp-admin/includes/class-wp-themes-list-table.php src/wp-admin/includes/class-wp-themes-list-table.php
index 6311e75..f8072bb 100644
|
|
class WP_Themes_List_Table extends WP_List_Table { |
276 | 276 | 'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1, |
277 | 277 | ); |
278 | 278 | |
279 | | if ( is_array( $extra_args ) ) |
| 279 | if ( is_array( $extra_args ) ) { |
280 | 280 | $args = array_merge( $args, $extra_args ); |
| 281 | } |
| 282 | |
| 283 | $args = wp_json_encode( $args ); |
| 284 | // Sanity check to print valid JSON. |
| 285 | if ( false === $args ) { |
| 286 | $args = '[]'; |
| 287 | } |
281 | 288 | |
282 | | printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode( $args ) ); |
| 289 | printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", $args ); |
283 | 290 | parent::_js_vars(); |
284 | 291 | } |
285 | 292 | } |
diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
index 562301e..91c84e1 100644
|
|
if( !$large_size_h ) |
1829 | 1829 | $large_size_w = absint( get_option('large_size_w') ); |
1830 | 1830 | if( !$large_size_w ) |
1831 | 1831 | $large_size_w = 1024; |
| 1832 | |
| 1833 | $plupload_init = wp_json_encode( $plupload_init ); |
| 1834 | // Sanity check to print valid JSON. |
| 1835 | if ( false === $plupload_init ) { |
| 1836 | $plupload_init = '[]'; |
| 1837 | } |
1832 | 1838 | ?> |
1833 | 1839 | var resize_height = <?php echo $large_size_h; ?>, resize_width = <?php echo $large_size_w; ?>, |
1834 | | wpUploaderInit = <?php echo wp_json_encode( $plupload_init ); ?>; |
| 1840 | wpUploaderInit = <?php echo $plupload_init; ?>; |
1835 | 1841 | </script> |
1836 | 1842 | |
1837 | 1843 | <div id="plupload-upload-ui" class="hide-if-no-js"> |
diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
index 7b710cb..9ed886d 100644
|
|
function admin_color_scheme_picker( $user_id ) { |
616 | 616 | <?php |
617 | 617 | wp_nonce_field( 'save-color-scheme', 'color-nonce', false ); |
618 | 618 | foreach ( $_wp_admin_css_colors as $color => $color_info ) : |
619 | | |
| 619 | $icon_colors = wp_json_encode( array( 'icons' => $color_info->icon_colors ) ); |
| 620 | // Sanity check to print valid JSON. |
| 621 | if ( false === $icon_colors ) { |
| 622 | $icon_colors = '[]'; |
| 623 | } |
620 | 624 | ?> |
621 | 625 | <div class="color-option <?php echo ( $color == $current_color ) ? 'selected' : ''; ?>"> |
622 | 626 | <input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> /> |
623 | 627 | <input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" /> |
624 | | <input type="hidden" class="icon_colors" value="<?php echo esc_attr( wp_json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" /> |
| 628 | <input type="hidden" class="icon_colors" value="<?php echo esc_attr( $icon_colors ); ?>" /> |
625 | 629 | <label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label> |
626 | 630 | <table class="color-palette"> |
627 | 631 | <tr> |
… |
… |
function wp_color_scheme_settings() { |
665 | 669 | $icon_colors = array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' ); |
666 | 670 | } |
667 | 671 | |
668 | | echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n"; |
| 672 | $icon_colors = wp_json_encode( array( 'icons' => $icon_colors ) ); |
| 673 | // Sanity check to print valid JSON. |
| 674 | if ( false === $icon_colors ) { |
| 675 | $icon_colors = '[]'; |
| 676 | } |
| 677 | |
| 678 | echo "<script type='text/javascript'>var _wpColorScheme = $icon_colors;</script>\n"; |
669 | 679 | } |
670 | 680 | add_action( 'admin_head', 'wp_color_scheme_settings' ); |
671 | 681 | |
diff --git src/wp-admin/includes/nav-menu.php src/wp-admin/includes/nav-menu.php
index fe588cd..effa34b 100644
|
|
function _wp_ajax_menu_quick_search( $request = array() ) { |
356 | 356 | if ( 'markup' == $response_format ) { |
357 | 357 | echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args ); |
358 | 358 | } elseif ( 'json' == $response_format ) { |
359 | | echo wp_json_encode( |
| 359 | $json = wp_json_encode( |
360 | 360 | array( |
361 | 361 | 'ID' => $object_id, |
362 | 362 | 'post_title' => get_the_title( $object_id ), |
363 | 363 | 'post_type' => get_post_type( $object_id ), |
364 | 364 | ) |
365 | 365 | ); |
366 | | echo "\n"; |
| 366 | // Sanity check to print valid JSON. |
| 367 | if ( false === $json ) { |
| 368 | $json = '[]'; |
| 369 | } |
| 370 | |
| 371 | echo "$json\n"; |
367 | 372 | } |
368 | 373 | } |
369 | 374 | } elseif ( taxonomy_exists( $object_type ) ) { |
… |
… |
function _wp_ajax_menu_quick_search( $request = array() ) { |
373 | 378 | echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args ); |
374 | 379 | } elseif ( 'json' == $response_format ) { |
375 | 380 | $post_obj = get_term( $object_id, $object_type ); |
376 | | echo wp_json_encode( |
| 381 | $json = wp_json_encode( |
377 | 382 | array( |
378 | 383 | 'ID' => $object_id, |
379 | 384 | 'post_title' => $post_obj->name, |
380 | 385 | 'post_type' => $object_type, |
381 | 386 | ) |
382 | 387 | ); |
383 | | echo "\n"; |
| 388 | // Sanity check to print valid JSON. |
| 389 | if ( false === $json ) { |
| 390 | $json = '[]'; |
| 391 | } |
| 392 | |
| 393 | echo "$json\n"; |
384 | 394 | } |
385 | 395 | } |
386 | 396 | |
… |
… |
function _wp_ajax_menu_quick_search( $request = array() ) { |
401 | 411 | $var_by_ref = get_the_ID(); |
402 | 412 | echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args ); |
403 | 413 | } elseif ( 'json' == $response_format ) { |
404 | | echo wp_json_encode( |
| 414 | $json = wp_json_encode( |
405 | 415 | array( |
406 | 416 | 'ID' => get_the_ID(), |
407 | 417 | 'post_title' => get_the_title(), |
408 | 418 | 'post_type' => get_post_type(), |
409 | 419 | ) |
410 | 420 | ); |
411 | | echo "\n"; |
| 421 | // Sanity check to print valid JSON. |
| 422 | if ( false === $json ) { |
| 423 | $json = '[]'; |
| 424 | } |
| 425 | |
| 426 | echo "$json\n"; |
412 | 427 | } |
413 | 428 | } |
414 | 429 | } elseif ( 'taxonomy' == $matches[1] ) { |
… |
… |
function _wp_ajax_menu_quick_search( $request = array() ) { |
422 | 437 | if ( 'markup' == $response_format ) { |
423 | 438 | echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args ); |
424 | 439 | } elseif ( 'json' == $response_format ) { |
425 | | echo wp_json_encode( |
| 440 | $json = wp_json_encode( |
426 | 441 | array( |
427 | 442 | 'ID' => $term->term_id, |
428 | 443 | 'post_title' => $term->name, |
429 | 444 | 'post_type' => $matches[2], |
430 | 445 | ) |
431 | 446 | ); |
432 | | echo "\n"; |
| 447 | // Sanity check to print valid JSON. |
| 448 | if ( false === $json ) { |
| 449 | $json = '[]'; |
| 450 | } |
| 451 | |
| 452 | echo "$json\n"; |
433 | 453 | } |
434 | 454 | } |
435 | 455 | } |
diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
index 1340d1e..3572b78 100644
|
|
final class WP_Internal_Pointers { |
1960 | 1960 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
1961 | 1961 | */ |
1962 | 1962 | private static function print_js( $pointer_id, $selector, $args ) { |
1963 | | if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
| 1963 | if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) { |
1964 | 1964 | return; |
| 1965 | } |
| 1966 | |
| 1967 | $options = wp_json_encode( $args ); |
| 1968 | // Sanity check to print valid JSON. |
| 1969 | if ( false === $options ) { |
| 1970 | $options = 'false'; |
| 1971 | } |
1965 | 1972 | |
1966 | 1973 | ?> |
1967 | 1974 | <script type="text/javascript"> |
1968 | 1975 | (function($){ |
1969 | | var options = <?php echo wp_json_encode( $args ); ?>, setup; |
| 1976 | var options = <?php echo $options; ?>, setup; |
1970 | 1977 | |
1971 | | if ( ! options ) |
| 1978 | if ( ! options ) { |
1972 | 1979 | return; |
| 1980 | } |
1973 | 1981 | |
1974 | 1982 | options = $.extend( options, { |
1975 | 1983 | close: function() { |
… |
… |
final class WP_Internal_Pointers { |
1984 | 1992 | $('<?php echo $selector; ?>').first().pointer( options ).pointer('open'); |
1985 | 1993 | }; |
1986 | 1994 | |
1987 | | if ( options.position && options.position.defer_loading ) |
| 1995 | if ( options.position && options.position.defer_loading ) { |
1988 | 1996 | $(window).bind( 'load.wp-pointers', setup ); |
1989 | | else |
| 1997 | } else { |
1990 | 1998 | $(document).ready( setup ); |
| 1999 | } |
1991 | 2000 | |
1992 | 2001 | })( jQuery ); |
1993 | 2002 | </script> |
diff --git src/wp-admin/options-general.php src/wp-admin/options-general.php
index 960c4f0..7c0bbcd 100644
|
|
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format'); |
26 | 26 | * @since 3.5.0 |
27 | 27 | */ |
28 | 28 | function options_general_add_js() { |
| 29 | $home_url = wp_json_encode( get_home_url() ); |
| 30 | // Sanity check to print valid JSON. |
| 31 | if ( false === $home_url ) { |
| 32 | $home_url = "''"; |
| 33 | } |
29 | 34 | ?> |
30 | 35 | <script type="text/javascript"> |
31 | 36 | jQuery(document).ready(function($){ |
32 | 37 | var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(), |
33 | | homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); |
| 38 | homeURL = ( <?php echo $home_url; ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); |
34 | 39 | |
35 | 40 | $( '#blogname' ).on( 'input', function() { |
36 | 41 | var title = $.trim( $( this ).val() ) || homeURL; |
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 4947d27..3f6d7e7 100644
|
|
final class WP_Customize_Manager { |
550 | 550 | $settings['activeControls'][ $id ] = $control->active(); |
551 | 551 | } |
552 | 552 | |
| 553 | $settings = wp_json_encode( $settings ); |
| 554 | // Sanity check to print valid JSON. |
| 555 | if ( false === $settings ) { |
| 556 | $settings = '[]'; |
| 557 | } |
| 558 | |
553 | 559 | ?> |
554 | 560 | <script type="text/javascript"> |
555 | | var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>; |
| 561 | var _wpCustomizeSettings = <?php echo $settings; ?>; |
556 | 562 | </script> |
557 | 563 | <?php |
558 | 564 | } |
diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php
index ba14828..17a442c 100644
|
|
final class WP_Customize_Widgets { |
741 | 741 | unset( $registered_widget['callback'] ); // may not be JSON-serializeable |
742 | 742 | } |
743 | 743 | |
| 744 | $settings = wp_json_encode( $settings ); |
| 745 | // Sanity check to print valid JSON. |
| 746 | if ( false === $settings ) { |
| 747 | $settings = '[]'; |
| 748 | } |
| 749 | |
744 | 750 | $wp_scripts->add_data( |
745 | 751 | 'customize-widgets', |
746 | 752 | 'data', |
747 | | sprintf( 'var _wpCustomizeWidgetsSettings = %s;', wp_json_encode( $settings ) ) |
| 753 | sprintf( 'var _wpCustomizeWidgetsSettings = %s;', $settings ) |
748 | 754 | ); |
749 | 755 | } |
750 | 756 | |
… |
… |
final class WP_Customize_Widgets { |
1057 | 1063 | unset( $registered_widget['callback'] ); // may not be JSON-serializeable |
1058 | 1064 | } |
1059 | 1065 | |
| 1066 | $settings = wp_json_encode( $settings ); |
| 1067 | // Sanity check to print valid JSON. |
| 1068 | if ( false === $settings ) { |
| 1069 | $settings = '[]'; |
| 1070 | } |
| 1071 | |
1060 | 1072 | ?> |
1061 | 1073 | <script type="text/javascript"> |
1062 | | var _wpWidgetCustomizerPreviewSettings = <?php echo wp_json_encode( $settings ); ?>; |
| 1074 | var _wpWidgetCustomizerPreviewSettings = <?php echo $settings; ?>; |
1063 | 1075 | </script> |
1064 | 1076 | <?php |
1065 | 1077 | } |
diff --git src/wp-includes/class-wp-editor.php src/wp-includes/class-wp-editor.php
index a033b39..0e9fba9 100644
|
|
final class _WP_Editors { |
519 | 519 | ); |
520 | 520 | |
521 | 521 | if ( ! empty( $mce_external_plugins ) ) { |
522 | | self::$first_init['external_plugins'] = wp_json_encode( $mce_external_plugins ); |
| 522 | $mce_external_plugins_json = wp_json_encode( $mce_external_plugins ); |
| 523 | // Sanity check to print valid JSON. |
| 524 | if ( false === $mce_external_plugins_json ) { |
| 525 | $mce_external_plugins_json = '[]'; |
| 526 | } |
| 527 | |
| 528 | self::$first_init['external_plugins'] = $mce_external_plugins_json; |
523 | 529 | } |
524 | 530 | |
525 | 531 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
… |
… |
final class _WP_Editors { |
1044 | 1050 | $mce_translation['_dir'] = 'rtl'; |
1045 | 1051 | } |
1046 | 1052 | |
| 1053 | $mce_translation = wp_json_encode( $mce_translation ); |
| 1054 | // Sanity check to print valid JSON. |
| 1055 | if ( false === $mce_translation ) { |
| 1056 | $mce_translation = '[]'; |
| 1057 | } |
| 1058 | |
1047 | 1059 | if ( $json_only ) { |
1048 | | return wp_json_encode( $mce_translation ); |
| 1060 | return $mce_translation; |
1049 | 1061 | } |
1050 | 1062 | |
1051 | 1063 | $baseurl = self::$baseurl ? self::$baseurl : includes_url( 'js/tinymce' ); |
1052 | 1064 | |
1053 | | return "tinymce.addI18n( '$mce_locale', " . wp_json_encode( $mce_translation ) . ");\n" . |
| 1065 | return "tinymce.addI18n( '$mce_locale', $mce_translation );\n" . |
1054 | 1066 | "tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n"; |
1055 | 1067 | } |
1056 | 1068 | |
diff --git src/wp-includes/class.wp-scripts.php src/wp-includes/class.wp-scripts.php
index 988ba79..4c10bf8 100644
|
|
class WP_Scripts extends WP_Dependencies { |
208 | 208 | $l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8'); |
209 | 209 | } |
210 | 210 | |
211 | | $script = "var $object_name = " . wp_json_encode( $l10n ) . ';'; |
| 211 | $json = wp_json_encode( $l10n ); |
| 212 | // Sanity check to print valid JSON. |
| 213 | if ( false === $json ) { |
| 214 | $json = '[]'; |
| 215 | } |
| 216 | |
| 217 | $script = "var $object_name = $json;"; |
212 | 218 | |
213 | 219 | if ( !empty($after) ) |
214 | 220 | $script .= "\n$after;"; |
diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index b5327ed..1cd8504 100644
|
|
function _wp_json_convert_string( $string ) { |
2784 | 2784 | */ |
2785 | 2785 | function wp_send_json( $response ) { |
2786 | 2786 | @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); |
2787 | | echo wp_json_encode( $response ); |
2788 | | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
| 2787 | |
| 2788 | $json = wp_json_encode( $response ); |
| 2789 | // Sanity check to print valid JSON. |
| 2790 | if ( false === $json ) { |
| 2791 | $json = 'false'; |
| 2792 | } |
| 2793 | |
| 2794 | echo $json; |
| 2795 | |
| 2796 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
2789 | 2797 | wp_die(); |
2790 | | else |
| 2798 | } else { |
2791 | 2799 | die; |
| 2800 | } |
2792 | 2801 | } |
2793 | 2802 | |
2794 | 2803 | /** |
diff --git src/wp-includes/media.php src/wp-includes/media.php
index 4e95b56..02a1ffb 100644
|
|
function wp_playlist_shortcode( $attr ) { |
1365 | 1365 | $safe_type = esc_attr( $atts['type'] ); |
1366 | 1366 | $safe_style = esc_attr( $atts['style'] ); |
1367 | 1367 | |
| 1368 | $data_json = wp_json_encode( $data ); |
| 1369 | // Sanity check to print valid JSON. |
| 1370 | if ( false === $data_json ) { |
| 1371 | $data_json = '[]'; |
| 1372 | } |
| 1373 | |
1368 | 1374 | ob_start(); |
1369 | 1375 | |
1370 | 1376 | if ( 1 === $instance ) { |
… |
… |
function wp_playlist_shortcode( $attr ) { |
1398 | 1404 | } |
1399 | 1405 | ?></ol> |
1400 | 1406 | </noscript> |
1401 | | <script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ) ?></script> |
| 1407 | <script type="application/json" class="wp-playlist-script"><?php echo $data_json; ?></script> |
1402 | 1408 | </div> |
1403 | 1409 | <?php |
1404 | 1410 | return ob_get_clean(); |
… |
… |
function wp_plupload_default_settings() { |
2591 | 2597 | 'limitExceeded' => is_multisite() && ! is_upload_space_available() |
2592 | 2598 | ); |
2593 | 2599 | |
2594 | | $script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';'; |
| 2600 | $settings = wp_json_encode( $settings ); |
| 2601 | // Sanity check to print valid JSON. |
| 2602 | if ( false === $settings ) { |
| 2603 | $settings = '[]'; |
| 2604 | } |
| 2605 | |
| 2606 | $script = "var _wpPluploadSettings = $settings;"; |
2595 | 2607 | |
2596 | 2608 | if ( $data ) |
2597 | 2609 | $script = "$data\n$script"; |
diff --git src/wp-includes/theme.php src/wp-includes/theme.php
index 3f5b5e7..954e598 100644
|
|
function _wp_customize_loader_settings() { |
1964 | 1964 | ), |
1965 | 1965 | ); |
1966 | 1966 | |
1967 | | $script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';'; |
| 1967 | $settings = wp_json_encode( $settings ); |
| 1968 | // Sanity check to print valid JSON. |
| 1969 | if ( false === $settings ) { |
| 1970 | $settings = '[]'; |
| 1971 | } |
| 1972 | $script = "var _wpCustomizeLoaderSettings = $settings;"; |
1968 | 1973 | |
1969 | 1974 | $data = $wp_scripts->get_data( 'customize-loader', 'data' ); |
1970 | 1975 | if ( $data ) |
diff --git src/wp-includes/update.php src/wp-includes/update.php
index 2e2ef9e..c433260 100644
|
|
function wp_version_check( $extra_stats = array(), $force_check = false ) { |
93 | 93 | 'multisite_enabled' => $multisite_enabled, |
94 | 94 | ); |
95 | 95 | |
| 96 | $json = wp_json_encode( $translations ); |
| 97 | // Sanity check to print valid JSON. |
| 98 | if ( false === $json ) { |
| 99 | $json = '[]'; |
| 100 | } |
| 101 | |
96 | 102 | $post_body = array( |
97 | | 'translations' => wp_json_encode( $translations ), |
| 103 | 'translations' => $json, |
98 | 104 | ); |
99 | 105 | |
100 | 106 | if ( is_array( $extra_stats ) ) |
… |
… |
function wp_update_plugins( $extra_stats = array() ) { |
277 | 283 | 'plugins' => wp_json_encode( $to_send ), |
278 | 284 | 'translations' => wp_json_encode( $translations ), |
279 | 285 | 'locale' => wp_json_encode( $locales ), |
280 | | 'all' => wp_json_encode( true ), |
| 286 | 'all' => 'true', // JSON-encoded true. |
281 | 287 | ), |
282 | 288 | 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) |
283 | 289 | ); |
… |
… |
function wp_update_plugins( $extra_stats = array() ) { |
286 | 292 | $options['body']['update_stats'] = wp_json_encode( $extra_stats ); |
287 | 293 | } |
288 | 294 | |
| 295 | // Make sure wp_json_encode() was able to encode everything. |
| 296 | foreach ( $options['body'] as &$item ) { |
| 297 | if ( false === $item ) { |
| 298 | $item = '[]'; |
| 299 | } |
| 300 | } |
| 301 | unset( $item ); |
| 302 | |
289 | 303 | $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/'; |
290 | 304 | if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) |
291 | 305 | $url = set_url_scheme( $url, 'https' ); |
… |
… |
function wp_update_themes( $extra_stats = array() ) { |
448 | 462 | $options['body']['update_stats'] = wp_json_encode( $extra_stats ); |
449 | 463 | } |
450 | 464 | |
| 465 | // Make sure wp_json_encode() was able to encode everything. |
| 466 | foreach ( $options['body'] as &$item ) { |
| 467 | if ( false === $item ) { |
| 468 | $item = '[]'; |
| 469 | } |
| 470 | } |
| 471 | unset( $item ); |
| 472 | |
451 | 473 | $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/'; |
452 | 474 | if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) |
453 | 475 | $url = set_url_scheme( $url, 'https' ); |