Add wp_json_encode(), a wrapper for json_encode() that ensures everything is converted to UTF-8.

Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.



git-svn-id: https://develop.svn.wordpress.org/trunk@30055 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2014-10-28 18:34:16 +00:00
parent 3d35d8bc5d
commit 0e68ecc0b6
17 changed files with 194 additions and 39 deletions
+10 -10
View File
@@ -94,7 +94,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
);
$post_body = array(
'translations' => json_encode( $translations ),
'translations' => wp_json_encode( $translations ),
);
if ( is_array( $extra_stats ) )
@@ -274,16 +274,16 @@ function wp_update_plugins( $extra_stats = array() ) {
$options = array(
'timeout' => $timeout,
'body' => array(
'plugins' => json_encode( $to_send ),
'translations' => json_encode( $translations ),
'locale' => json_encode( $locales ),
'all' => json_encode( true ),
'plugins' => wp_json_encode( $to_send ),
'translations' => wp_json_encode( $translations ),
'locale' => wp_json_encode( $locales ),
'all' => wp_json_encode( true ),
),
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
);
if ( $extra_stats ) {
$options['body']['update_stats'] = json_encode( $extra_stats );
$options['body']['update_stats'] = wp_json_encode( $extra_stats );
}
$url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
@@ -437,15 +437,15 @@ function wp_update_themes( $extra_stats = array() ) {
$options = array(
'timeout' => $timeout,
'body' => array(
'themes' => json_encode( $request ),
'translations' => json_encode( $translations ),
'locale' => json_encode( $locales ),
'themes' => wp_json_encode( $request ),
'translations' => wp_json_encode( $translations ),
'locale' => wp_json_encode( $locales ),
),
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
);
if ( $extra_stats ) {
$options['body']['update_stats'] = json_encode( $extra_stats );
$options['body']['update_stats'] = wp_json_encode( $extra_stats );
}
$url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';