|
104 | 104 | if ( $admin_only && ! current_user_can( 'manage_options' ) ) {
|
105 | 105 | return;
|
106 | 106 | }
|
107 |
| - $stats = json_encode( $stats ); |
| 107 | + $stats = wp_json_encode( $stats ); |
108 | 108 | $title = str_replace( home_url(), '', $title );
|
109 | 109 | $exists = wpa_get_post_by_title( $title );
|
110 | 110 | if ( $exists ) {
|
|
130 | 130 | // If decode fails for any reason, move on, don't try to unset the timestamp.
|
131 | 131 | $test_old->timestamp = '';
|
132 | 132 | }
|
133 |
| - if ( json_encode( $test_stats ) !== json_encode( $test_old ) ) { |
| 133 | + if ( wp_json_encode( $test_stats ) !== wp_json_encode( $test_old ) ) { |
134 | 134 | add_post_meta( $exists, '_wpa_old_event', array( $test_stats, $test_old ) );
|
135 | 135 | // stats have changed; record the change.
|
136 | 136 | add_post_meta( $exists, '_wpa_event', $stats );
|
|
159 | 159 | $terms = array( $type );
|
160 | 160 | require_once ABSPATH . '/wp-admin/includes/dashboard.php';
|
161 | 161 | $browser = wp_check_browser_version();
|
162 |
| - add_post_meta( $stat, '_wpa_browser', json_encode( $browser ) ); |
| 162 | + add_post_meta( $stat, '_wpa_browser', wp_json_encode( $browser ) ); |
163 | 163 | $terms[] = $browser['name'];
|
164 | 164 | $terms[] = $browser['platform'];
|
165 | 165 | wp_set_object_terms( $stat, $terms, 'wpa-stats-type' );
|
|
0 commit comments