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-admin/includes/ajax-actions.php

    r29758 r30055  
    287287    }
    288288
    289     wp_die( json_encode( $return ) );
     289    wp_die( wp_json_encode( $return ) );
    290290}
    291291
     
    13661366        $markup = ob_get_clean();
    13671367
    1368         echo json_encode(array(
     1368        echo wp_json_encode(array(
    13691369            'replace-id' => $type . '-' . $item->name,
    13701370            'markup' => $markup,
     
    13951395        wp_die( 0 );
    13961396
    1397     echo json_encode( $results );
     1397    echo wp_json_encode( $results );
    13981398    echo "\n";
    13991399
     
    18411841        $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'], false );
    18421842        if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
    1843             echo json_encode( array(
     1843            echo wp_json_encode( array(
    18441844                'success' => false,
    18451845                'data'    => array(
     
    18561856
    18571857    if ( is_wp_error( $attachment_id ) ) {
    1858         echo json_encode( array(
     1858        echo wp_json_encode( array(
    18591859            'success' => false,
    18601860            'data'    => array(
     
    18781878        wp_die();
    18791879
    1880     echo json_encode( array(
     1880    echo wp_json_encode( array(
    18811881        'success' => true,
    18821882        'data'    => $attachment,
     
    19031903        case 'save' :
    19041904            $msg = wp_save_image($attachment_id);
    1905             $msg = json_encode($msg);
     1905            $msg = wp_json_encode($msg);
    19061906            wp_die( $msg );
    19071907            break;
Note: See TracChangeset for help on using the changeset viewer.