Make WordPress Core


Ignore:
Timestamp:
10/28/2014 06:34:16 PM (10 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/update.php

    r29226 r30055  
    9595
    9696    $post_body = array(
    97         'translations' => json_encode( $translations ),
     97        'translations' => wp_json_encode( $translations ),
    9898    );
    9999
     
    275275        'timeout' => $timeout,
    276276        'body' => array(
    277             'plugins'      => json_encode( $to_send ),
    278             'translations' => json_encode( $translations ),
    279             'locale'       => json_encode( $locales ),
    280             'all'          => json_encode( true ),
     277            'plugins'      => wp_json_encode( $to_send ),
     278            'translations' => wp_json_encode( $translations ),
     279            'locale'       => wp_json_encode( $locales ),
     280            'all'          => wp_json_encode( true ),
    281281        ),
    282282        'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
     
    284284
    285285    if ( $extra_stats ) {
    286         $options['body']['update_stats'] = json_encode( $extra_stats );
     286        $options['body']['update_stats'] = wp_json_encode( $extra_stats );
    287287    }
    288288
     
    438438        'timeout' => $timeout,
    439439        'body' => array(
    440             'themes'       => json_encode( $request ),
    441             'translations' => json_encode( $translations ),
    442             'locale'       => json_encode( $locales ),
     440            'themes'       => wp_json_encode( $request ),
     441            'translations' => wp_json_encode( $translations ),
     442            'locale'       => wp_json_encode( $locales ),
    443443        ),
    444444        'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
     
    446446
    447447    if ( $extra_stats ) {
    448         $options['body']['update_stats'] = json_encode( $extra_stats );
     448        $options['body']['update_stats'] = wp_json_encode( $extra_stats );
    449449    }
    450450
Note: See TracChangeset for help on using the changeset viewer.