Changeset 52086 for trunk/src/wp-admin/includes/ms.php
- Timestamp:
- 11/09/2021 11:04:41 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ms.php
r51855 r52086 21 21 } 22 22 23 if ( '0' != $file['error']) { // There's already an error.23 if ( $file['error'] > 0 ) { // There's already an error. 24 24 return $file; 25 25 } … … 46 46 } 47 47 48 if ( '0' != $file['error']&& ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) {48 if ( $file['error'] > 0 && ! isset( $_POST['html-upload'] ) && ! wp_doing_ajax() ) { 49 49 wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' ); 50 50 } … … 67 67 global $wpdb; 68 68 69 $blog_id = (int) $blog_id; 70 69 71 $switch = false; 70 if ( get_current_blog_id() != $blog_id ) {72 if ( get_current_blog_id() !== $blog_id ) { 71 73 $switch = true; 72 74 switch_to_blog( $blog_id ); … … 83 85 84 86 // Don't destroy the initial, main, or root blog. 85 if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_network->path && $blog->domain == $current_network->domain ) ) ) { 87 if ( $drop 88 && ( 1 === $blog_id || is_main_site( $blog_id ) 89 || ( $blog->path === $current_network->path && $blog->domain === $current_network->domain ) ) 90 ) { 86 91 $drop = false; 87 92 } … … 703 708 } 704 709 705 if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {710 if ( (int) get_site_option( 'wpmu_upgrade_site' ) !== $wp_db_version ) { 706 711 echo "<div class='update-nag notice notice-warning inline'>" . sprintf( 707 712 /* translators: %s: URL to Upgrade Network screen. */ … … 743 748 $post_name = $data['post_name']; 744 749 $c = 0; 750 745 751 while ( $c < 10 && get_id_from_blogname( $post_name ) ) { 746 752 $post_name .= mt_rand( 1, 10 ); 747 $c ++; 748 } 749 if ( $post_name != $data['post_name'] ) { 753 $c++; 754 } 755 756 if ( $post_name !== $data['post_name'] ) { 750 757 $data['post_name'] = $post_name; 751 758 } 759 752 760 return $data; 753 761 } … … 770 778 <?php 771 779 $all_blogs = get_blogs_of_user( get_current_user_id() ); 772 $primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );780 $primary_blog = (int) get_user_meta( get_current_user_id(), 'primary_blog', true ); 773 781 if ( count( $all_blogs ) > 1 ) { 774 782 $found = false; … … 777 785 <?php 778 786 foreach ( (array) $all_blogs as $blog ) { 779 if ( $ primary_blog == $blog->userblog_id) {787 if ( $blog->userblog_id === $primary_blog ) { 780 788 $found = true; 781 789 } … … 791 799 update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); 792 800 } 793 } elseif ( count( $all_blogs ) == 1) {801 } elseif ( 1 === count( $all_blogs ) ) { 794 802 $blog = reset( $all_blogs ); 795 803 echo esc_url( get_home_url( $blog->userblog_id ) ); 796 if ( $ primary_blog != $blog->userblog_id) { // Set the primary blog again if it's out of sync with blog list.804 if ( $blog->userblog_id !== $primary_blog ) { // Set the primary blog again if it's out of sync with blog list. 797 805 update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id ); 798 806 } … … 819 827 */ 820 828 function can_edit_network( $network_id ) { 821 if ( get_current_network_id() == $network_id ) {829 if ( get_current_network_id() === (int) $network_id ) { 822 830 $result = true; 823 831 } else { … … 879 887 $allusers = (array) $_POST['allusers']; 880 888 foreach ( $allusers as $user_id ) { 881 if ( '' !== $user_id && '0' != $user_id ) {889 if ( '' !== $user_id && '0' !== $user_id ) { 882 890 $delete_user = get_userdata( $user_id ); 883 891
Note: See TracChangeset
for help on using the changeset viewer.