diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index ec3b6f0f36..135749c475 100644
a
|
b
|
function wp_ajax_ajax_tag_search() { |
148 | 148 | * Require $term_search_min_chars chars for matching (default: 2) |
149 | 149 | * ensure it's a non-negative, non-zero integer. |
150 | 150 | */ |
151 | | if ( ( 0 == $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) { |
| 151 | if ( ( 0 === $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) { |
152 | 152 | wp_die(); |
153 | 153 | } |
154 | 154 | |
… |
… |
function wp_ajax_wp_compression_test() { |
205 | 205 | $force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ); |
206 | 206 | $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; |
207 | 207 | |
208 | | if ( 1 == $_GET['test'] ) { |
| 208 | if ( 1 === $_GET['test'] ) { |
209 | 209 | echo $test_str; |
210 | 210 | wp_die(); |
211 | | } elseif ( 2 == $_GET['test'] ) { |
| 211 | } elseif ( 2 === $_GET['test'] ) { |
212 | 212 | if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) { |
213 | 213 | wp_die( -1 ); |
214 | 214 | } |
… |
… |
function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { |
509 | 509 | } |
510 | 510 | |
511 | 511 | // Only do the expensive stuff on a page-break, and about 1 other time per page. |
512 | | if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) { |
| 512 | if ( 0 === $total % $per_page || 1 === mt_rand( 1, $per_page ) ) { |
513 | 513 | $post_id = 0; |
514 | 514 | // What type of comment count are we looking for? |
515 | 515 | $status = 'all'; |
… |
… |
function wp_ajax_delete_comment() { |
729 | 729 | $status = wp_get_comment_status( $comment ); |
730 | 730 | $delta = -1; |
731 | 731 | |
732 | | if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) { |
| 732 | if ( isset( $_POST['trash'] ) && 1 === $_POST['trash'] ) { |
733 | 733 | if ( 'trash' === $status ) { |
734 | 734 | wp_die( time() ); |
735 | 735 | } |
736 | 736 | |
737 | 737 | $r = wp_trash_comment( $comment ); |
738 | | } elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) { |
| 738 | } elseif ( isset( $_POST['untrash'] ) && 1 === $_POST['untrash'] ) { |
739 | 739 | if ( 'trash' !== $status ) { |
740 | 740 | wp_die( time() ); |
741 | 741 | } |
… |
… |
function wp_ajax_delete_comment() { |
752 | 752 | } |
753 | 753 | |
754 | 754 | $r = wp_spam_comment( $comment ); |
755 | | } elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) { |
| 755 | } elseif ( isset( $_POST['unspam'] ) && 1 === $_POST['unspam'] ) { |
756 | 756 | if ( 'spam' !== $status ) { |
757 | 757 | wp_die( time() ); |
758 | 758 | } |
… |
… |
function wp_ajax_delete_comment() { |
763 | 763 | if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) { |
764 | 764 | $delta = 1; |
765 | 765 | } |
766 | | } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) { |
| 766 | } elseif ( isset( $_POST['delete'] ) && 1 === $_POST['delete'] ) { |
767 | 767 | $r = wp_delete_comment( $comment ); |
768 | 768 | } else { |
769 | 769 | wp_die( -1 ); |
… |
… |
function wp_ajax_dim_comment() { |
996 | 996 | |
997 | 997 | $current = wp_get_comment_status( $comment ); |
998 | 998 | |
999 | | if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) { |
| 999 | if ( isset( $_POST['new'] ) && $_POST['new'] === $current ) { |
1000 | 1000 | wp_die( time() ); |
1001 | 1001 | } |
1002 | 1002 | |
… |
… |
function wp_ajax_replyto_comment( $action ) { |
1380 | 1380 | if ( ! empty( $_POST['approve_parent'] ) ) { |
1381 | 1381 | $parent = get_comment( $comment_parent ); |
1382 | 1382 | |
1383 | | if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_id ) { |
| 1383 | if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID === $comment_post_id ) { |
1384 | 1384 | if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) { |
1385 | 1385 | wp_die( -1 ); |
1386 | 1386 | } |
… |
… |
function wp_ajax_edit_comment() { |
1479 | 1479 | } |
1480 | 1480 | |
1481 | 1481 | $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; |
1482 | | $checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0; |
| 1482 | $checkbox = ( isset( $_POST['checkbox'] ) && true === $_POST['checkbox'] ) ? 1 : 0; |
1483 | 1483 | $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); |
1484 | 1484 | |
1485 | 1485 | $comment = get_comment( $comment_id ); |
… |
… |
function wp_ajax_save_widget() { |
2401 | 2401 | |
2402 | 2402 | foreach ( (array) $wp_registered_widget_updates as $name => $control ) { |
2403 | 2403 | |
2404 | | if ( $name == $id_base ) { |
| 2404 | if ( $name === $id_base ) { |
2405 | 2405 | if ( ! is_callable( $control['callback'] ) ) { |
2406 | 2406 | continue; |
2407 | 2407 | } |
… |
… |
function wp_ajax_set_post_thumbnail() { |
2727 | 2727 | check_ajax_referer( "set_post_thumbnail-$post_id" ); |
2728 | 2728 | } |
2729 | 2729 | |
2730 | | if ( '-1' == $thumbnail_id ) { |
| 2730 | if ( '-1' === $thumbnail_id ) { |
2731 | 2731 | if ( delete_post_thumbnail( $post_id ) ) { |
2732 | 2732 | $return = _wp_post_thumbnail_html( null, $post_id ); |
2733 | 2733 | $json ? wp_send_json_success( $return ) : wp_die( $return ); |
… |
… |
function wp_ajax_send_attachment_to_editor() { |
3308 | 3308 | // If this attachment is unattached, attach it. Primarily a back compat thing. |
3309 | 3309 | $insert_into_post_id = (int) $_POST['post_id']; |
3310 | 3310 | |
3311 | | if ( 0 == $post->post_parent && $insert_into_post_id ) { |
| 3311 | if ( 0 === $post->post_parent && $insert_into_post_id ) { |
3312 | 3312 | wp_update_post( |
3313 | 3313 | array( |
3314 | 3314 | 'ID' => $id, |
… |
… |
function wp_ajax_send_attachment_to_editor() { |
3319 | 3319 | } |
3320 | 3320 | |
3321 | 3321 | $url = empty( $attachment['url'] ) ? '' : $attachment['url']; |
3322 | | $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $id ) == $url ); |
| 3322 | $rel = ( strpos( $url, 'attachment_id' ) || get_attachment_link( $id ) === $url ); |
3323 | 3323 | |
3324 | 3324 | remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' ); |
3325 | 3325 | |
… |
… |
function wp_ajax_crop_image() { |
3991 | 3991 | $wp_site_icon = new WP_Site_Icon(); |
3992 | 3992 | |
3993 | 3993 | // Skip creating a new attachment if the attachment is a Site Icon. |
3994 | | if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) { |
| 3994 | if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) === $context ) { |
3995 | 3995 | |
3996 | 3996 | // Delete the temporary cropped file, we don't need it. |
3997 | 3997 | wp_delete_file( $cropped ); |