@@ -149,7 +149,7 @@ function wp_ajax_ajax_tag_search() {
149149 * Require $term_search_min_chars chars for matching (default: 2)
150150 * ensure it's a non-negative, non-zero integer.
151151 */
152- if ( ( $ term_search_min_chars == 0 ) || ( strlen ( $ s ) < $ term_search_min_chars ) ) {
152+ if ( ( 0 == $ term_search_min_chars ) || ( strlen ( $ s ) < $ term_search_min_chars ) ) {
153153 wp_die ();
154154 }
155155
@@ -295,14 +295,14 @@ function wp_ajax_autocomplete_user() {
295295 $ id = get_current_blog_id ();
296296 }
297297
298- $ include_blog_users = ( $ type == ' search ' ? get_users (
298+ $ include_blog_users = ( ' search ' === $ type ? get_users (
299299 array (
300300 'blog_id ' => $ id ,
301301 'fields ' => 'ID ' ,
302302 )
303303 ) : array () );
304304
305- $ exclude_blog_users = ( $ type == ' add ' ? get_users (
305+ $ exclude_blog_users = ( ' add ' === $ type ? get_users (
306306 array (
307307 'blog_id ' => $ id ,
308308 'fields ' => 'ID ' ,
@@ -391,7 +391,7 @@ function wp_ajax_dashboard_widgets() {
391391 require_once ABSPATH . 'wp-admin/includes/dashboard.php ' ;
392392
393393 $ pagenow = $ _GET ['pagenow ' ];
394- if ( $ pagenow === 'dashboard-user ' || $ pagenow === 'dashboard-network ' || $ pagenow === 'dashboard ' ) {
394+ if ( 'dashboard-user ' === $ pagenow || 'dashboard-network ' === $ pagenow || 'dashboard ' === $ pagenow ) {
395395 set_current_screen ( $ pagenow );
396396 }
397397
@@ -573,7 +573,7 @@ function _wp_ajax_add_hierarchical_term() {
573573 $ parent = 0 ;
574574 }
575575
576- if ( $ taxonomy ->name == ' category ' ) {
576+ if ( ' category ' === $ taxonomy ->name ) {
577577 $ post_category = isset ( $ _POST ['post_category ' ] ) ? (array ) $ _POST ['post_category ' ] : array ();
578578 } else {
579579 $ post_category = ( isset ( $ _POST ['tax_input ' ] ) && isset ( $ _POST ['tax_input ' ][ $ taxonomy ->name ] ) ) ? (array ) $ _POST ['tax_input ' ][ $ taxonomy ->name ] : array ();
@@ -717,7 +717,7 @@ function wp_ajax_delete_comment() {
717717 $ r = wp_untrash_comment ( $ comment );
718718
719719 // Undo trash, not in trash.
720- if ( ! isset ( $ _POST ['comment_status ' ] ) || $ _POST [ ' comment_status ' ] != ' trash ' ) {
720+ if ( ! isset ( $ _POST ['comment_status ' ] ) || ' trash ' !== $ _POST [ ' comment_status ' ] ) {
721721 $ delta = 1 ;
722722 }
723723 } elseif ( isset ( $ _POST ['spam ' ] ) && 1 == $ _POST ['spam ' ] ) {
@@ -734,7 +734,7 @@ function wp_ajax_delete_comment() {
734734 $ r = wp_unspam_comment ( $ comment );
735735
736736 // Undo spam, not in spam.
737- if ( ! isset ( $ _POST ['comment_status ' ] ) || $ _POST [ ' comment_status ' ] != ' spam ' ) {
737+ if ( ! isset ( $ _POST ['comment_status ' ] ) || ' spam ' !== $ _POST [ ' comment_status ' ] ) {
738738 $ delta = 1 ;
739739 }
740740 } elseif ( isset ( $ _POST ['delete ' ] ) && 1 == $ _POST ['delete ' ] ) {
@@ -1318,7 +1318,7 @@ function wp_ajax_replyto_comment( $action ) {
13181318 if ( ! empty ( $ _POST ['approve_parent ' ] ) ) {
13191319 $ parent = get_comment ( $ comment_parent );
13201320
1321- if ( $ parent && $ parent -> comment_approved === ' 0 ' && $ parent ->comment_post_ID == $ comment_post_ID ) {
1321+ if ( $ parent && ' 0 ' === $ parent -> comment_approved && $ parent ->comment_post_ID == $ comment_post_ID ) {
13221322 if ( ! current_user_can ( 'edit_comment ' , $ parent ->comment_ID ) ) {
13231323 wp_die ( -1 );
13241324 }
@@ -1549,7 +1549,7 @@ function wp_ajax_add_meta() {
15491549 }
15501550
15511551 // If the post is an autodraft, save the post as a draft and then attempt to save the meta.
1552- if ( $ post -> post_status == ' auto-draft ' ) {
1552+ if ( ' auto-draft ' === $ post -> post_status ) {
15531553 $ post_data = array ();
15541554 $ post_data ['action ' ] = 'draft ' ; // Warning fix.
15551555 $ post_data ['post_ID ' ] = $ pid ;
@@ -1720,7 +1720,7 @@ function wp_ajax_closed_postboxes() {
17201720
17211721 $ page = isset ( $ _POST ['page ' ] ) ? $ _POST ['page ' ] : '' ;
17221722
1723- if ( $ page != sanitize_key ( $ page ) ) {
1723+ if ( sanitize_key ( $ page ) != $ page ) {
17241724 wp_die ( 0 );
17251725 }
17261726
@@ -1751,7 +1751,7 @@ function wp_ajax_hidden_columns() {
17511751 check_ajax_referer ( 'screen-options-nonce ' , 'screenoptionnonce ' );
17521752 $ page = isset ( $ _POST ['page ' ] ) ? $ _POST ['page ' ] : '' ;
17531753
1754- if ( $ page != sanitize_key ( $ page ) ) {
1754+ if ( sanitize_key ( $ page ) != $ page ) {
17551755 wp_die ( 0 );
17561756 }
17571757
@@ -1900,13 +1900,13 @@ function wp_ajax_meta_box_order() {
19001900 $ order = isset ( $ _POST ['order ' ] ) ? (array ) $ _POST ['order ' ] : false ;
19011901 $ page_columns = isset ( $ _POST ['page_columns ' ] ) ? $ _POST ['page_columns ' ] : 'auto ' ;
19021902
1903- if ( $ page_columns != ' auto ' ) {
1903+ if ( ' auto ' !== $ page_columns ) {
19041904 $ page_columns = (int ) $ page_columns ;
19051905 }
19061906
19071907 $ page = isset ( $ _POST ['page ' ] ) ? $ _POST ['page ' ] : '' ;
19081908
1909- if ( $ page != sanitize_key ( $ page ) ) {
1909+ if ( sanitize_key ( $ page ) != $ page ) {
19101910 wp_die ( 0 );
19111911 }
19121912
@@ -2003,7 +2003,7 @@ function wp_ajax_inline_save() {
20032003 /* translators: %s: User's display name. */
20042004 $ msg_template = __ ( 'Saving is disabled: %s is currently editing this post. ' );
20052005
2006- if ( $ _POST [ ' post_type ' ] == ' page ' ) {
2006+ if ( ' page ' === $ _POST [ ' post_type ' ] ) {
20072007 /* translators: %s: User's display name. */
20082008 $ msg_template = __ ( 'Saving is disabled: %s is currently editing this page. ' );
20092009 }
@@ -2067,7 +2067,7 @@ function wp_ajax_inline_save() {
20672067
20682068 $ wp_list_table = _get_list_table ( 'WP_Posts_List_Table ' , array ( 'screen ' => $ _POST ['screen ' ] ) );
20692069
2070- $ mode = $ _POST [ ' post_view ' ] === ' excerpt ' ? 'excerpt ' : 'list ' ;
2070+ $ mode = ' excerpt ' === $ _POST [ ' post_view ' ] ? 'excerpt ' : 'list ' ;
20712071
20722072 $ level = 0 ;
20732073 if ( is_post_type_hierarchical ( $ wp_list_table ->screen ->post_type ) ) {
@@ -2639,7 +2639,7 @@ function wp_ajax_set_post_thumbnail() {
26392639 check_ajax_referer ( "set_post_thumbnail- $ post_ID " );
26402640 }
26412641
2642- if ( $ thumbnail_id == '-1 ' ) {
2642+ if ( '-1 ' == $ thumbnail_id ) {
26432643 if ( delete_post_thumbnail ( $ post_ID ) ) {
26442644 $ return = _wp_post_thumbnail_html ( null , $ post_ID );
26452645 $ json ? wp_send_json_success ( $ return ) : wp_die ( $ return );
@@ -2819,7 +2819,7 @@ function wp_ajax_wp_remove_post_lock() {
28192819
28202820 $ active_lock = array_map ( 'absint ' , explode ( ': ' , $ _POST ['active_post_lock ' ] ) );
28212821
2822- if ( $ active_lock [1 ] != get_current_user_id () ) {
2822+ if ( get_current_user_id () != $ active_lock [1 ] ) {
28232823 wp_die ( 0 );
28242824 }
28252825
@@ -2844,7 +2844,7 @@ function wp_ajax_wp_remove_post_lock() {
28442844function wp_ajax_dismiss_wp_pointer () {
28452845 $ pointer = $ _POST ['pointer ' ];
28462846
2847- if ( $ pointer != sanitize_key ( $ pointer ) ) {
2847+ if ( sanitize_key ( $ pointer ) != $ pointer ) {
28482848 wp_die ( 0 );
28492849 }
28502850
@@ -3022,7 +3022,7 @@ function wp_ajax_save_attachment() {
30223022
30233023 if ( isset ( $ changes ['alt ' ] ) ) {
30243024 $ alt = wp_unslash ( $ changes ['alt ' ] );
3025- if ( $ alt != get_post_meta ( $ id , '_wp_attachment_image_alt ' , true ) ) {
3025+ if ( get_post_meta ( $ id , '_wp_attachment_image_alt ' , true ) !== $ alt ) {
30263026 $ alt = wp_strip_all_tags ( $ alt , true );
30273027 update_post_meta ( $ id , '_wp_attachment_image_alt ' , wp_slash ( $ alt ) );
30283028 }
@@ -3816,7 +3816,7 @@ function wp_ajax_destroy_sessions() {
38163816
38173817 $ sessions = WP_Session_Tokens::get_instance ( $ user ->ID );
38183818
3819- if ( $ user -> ID === get_current_user_id () ) {
3819+ if ( get_current_user_id () === $ user -> ID ) {
38203820 $ sessions ->destroy_others ( wp_get_session_token () );
38213821 $ message = __ ( 'You are now logged out everywhere else. ' );
38223822 } else {
0 commit comments