Widgets: Prevent fatal error due to calling undefined `wp_json_encode()` when requesting the `load-scripts.php` endpoint.

Props Otto42.
Amends [41352].
Fixes #41610.

Built from https://develop.svn.wordpress.org/trunk@41360


git-svn-id: http://core.svn.wordpress.org/trunk@41193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-09-09 20:44:44 +00:00
parent d35be7a120
commit da3b644df4
2 changed files with 2 additions and 2 deletions

View File

@ -672,7 +672,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) ); $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
$scripts->add_inline_script( 'admin-widgets', sprintf( 'wpWidgets.l10n = %s;', wp_json_encode( array( did_action( 'init' ) && $scripts->add_inline_script( 'admin-widgets', sprintf( 'wpWidgets.l10n = %s;', wp_json_encode( array(
'save' => __( 'Save' ), 'save' => __( 'Save' ),
'saved' => __( 'Saved' ), 'saved' => __( 'Saved' ),
'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-alpha-41359'; $wp_version = '4.9-alpha-41360';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.