Coding Standards: Use strict comparison in wp-admin/includes/class-wp-ms-sites-list-table.php
.
Includes minor code layout fixes for better readability. Follow-up to [12603], [32630], [32755], [46441]. Props mujuonly, audrasjb, jankyz, krupalpanchal, SergeyBiryukov. Fixes #58139. Built from https://develop.svn.wordpress.org/trunk@55656 git-svn-id: http://core.svn.wordpress.org/trunk@55168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c34fad6c8b
commit
cc03c195c1
@ -109,12 +109,17 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
if ( empty( $s ) ) {
|
if ( empty( $s ) ) {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
} elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) ||
|
} elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s )
|
||||||
preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
|
|| preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s )
|
||||||
preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
|
|| preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s )
|
||||||
preg_match( '/^[0-9]{1,3}\.$/', $s ) ) {
|
|| preg_match( '/^[0-9]{1,3}\.$/', $s )
|
||||||
|
) {
|
||||||
// IPv4 address.
|
// IPv4 address.
|
||||||
$sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) );
|
$sql = $wpdb->prepare(
|
||||||
|
"SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s",
|
||||||
|
$wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' )
|
||||||
|
);
|
||||||
|
|
||||||
$reg_blog_ids = $wpdb->get_col( $sql );
|
$reg_blog_ids = $wpdb->get_col( $sql );
|
||||||
|
|
||||||
if ( $reg_blog_ids ) {
|
if ( $reg_blog_ids ) {
|
||||||
@ -262,7 +267,11 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
foreach ( $statuses as $status => $label_count ) {
|
foreach ( $statuses as $status => $label_count ) {
|
||||||
if ( (int) $counts[ $status ] > 0 ) {
|
if ( (int) $counts[ $status ] > 0 ) {
|
||||||
$label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) );
|
$label = sprintf(
|
||||||
|
translate_nooped_plural( $label_count, $counts[ $status ] ),
|
||||||
|
number_format_i18n( $counts[ $status ] )
|
||||||
|
);
|
||||||
|
|
||||||
$full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url );
|
$full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url );
|
||||||
|
|
||||||
$view_links[ $status ] = array(
|
$view_links[ $status ] = array(
|
||||||
@ -408,7 +417,8 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
printf( __( 'Select %s' ), $blogname );
|
printf( __( 'Select %s' ), $blogname );
|
||||||
?>
|
?>
|
||||||
</label>
|
</label>
|
||||||
<input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ); ?>" />
|
<input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]"
|
||||||
|
value="<?php echo esc_attr( $blog['blog_id'] ); ?>" />
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
}
|
}
|
||||||
@ -440,8 +450,15 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<strong>
|
<strong>
|
||||||
<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname; ?></a>
|
<?php
|
||||||
<?php $this->site_states( $blog ); ?>
|
printf(
|
||||||
|
'<a href="%1$s" class="edit">%2$s</a>',
|
||||||
|
esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ),
|
||||||
|
$blogname
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->site_states( $blog );
|
||||||
|
?>
|
||||||
</strong>
|
</strong>
|
||||||
<?php
|
<?php
|
||||||
if ( 'list' !== $mode ) {
|
if ( 'list' !== $mode ) {
|
||||||
@ -476,7 +493,11 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
$date = __( 'Y/m/d g:i:s a' );
|
$date = __( 'Y/m/d g:i:s a' );
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
|
if ( '0000-00-00 00:00:00' === $blog['last_updated'] ) {
|
||||||
|
_e( 'Never' );
|
||||||
|
} else {
|
||||||
|
echo mysql2date( $date, $blog['last_updated'] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -527,7 +548,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%1$s">%2$s</a>',
|
||||||
esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ),
|
esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ),
|
||||||
number_format_i18n( $user_count )
|
number_format_i18n( $user_count )
|
||||||
);
|
);
|
||||||
@ -586,7 +607,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
reset( $this->status_list );
|
reset( $this->status_list );
|
||||||
|
|
||||||
foreach ( $this->status_list as $status => $col ) {
|
foreach ( $this->status_list as $status => $col ) {
|
||||||
if ( 1 == $blog[ $status ] ) {
|
if ( '1' === $blog[ $status ] ) {
|
||||||
$class = " class='{$col[0]}'";
|
$class = " class='{$col[0]}'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,7 +641,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
$site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
|
$site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
|
||||||
foreach ( $this->status_list as $status => $col ) {
|
foreach ( $this->status_list as $status => $col ) {
|
||||||
if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) {
|
if ( '1' === $_site->{$status} && $site_status !== $status ) {
|
||||||
$site_states[ $col[0] ] = $col[1];
|
$site_states[ $col[0] ] = $col[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -699,33 +720,110 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
|||||||
'visit' => '',
|
'visit' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
$actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>';
|
$actions['edit'] = sprintf(
|
||||||
$actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>';
|
'<a href="%1$s">%2$s</a>',
|
||||||
if ( get_network()->site_id != $blog['blog_id'] ) {
|
esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ),
|
||||||
if ( '1' == $blog['deleted'] ) {
|
__( 'Edit' )
|
||||||
$actions['activate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>';
|
);
|
||||||
|
|
||||||
|
$actions['backend'] = sprintf(
|
||||||
|
'<a href="%1$s" class="edit">%2$s</a>',
|
||||||
|
esc_url( get_admin_url( $blog['blog_id'] ) ),
|
||||||
|
__( 'Dashboard' )
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( get_network()->site_id !== (int) $blog['blog_id'] ) {
|
||||||
|
if ( '1' === $blog['deleted'] ) {
|
||||||
|
$actions['activate'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ),
|
||||||
|
'activateblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
__( 'Activate' )
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
|
$actions['deactivate'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ),
|
||||||
|
'deactivateblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
__( 'Deactivate' )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '1' == $blog['archived'] ) {
|
if ( '1' === $blog['archived'] ) {
|
||||||
$actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>';
|
$actions['unarchive'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ),
|
||||||
|
'unarchiveblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
__( 'Unarchive' )
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>';
|
$actions['archive'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ),
|
||||||
|
'archiveblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
_x( 'Archive', 'verb; site' )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '1' == $blog['spam'] ) {
|
if ( '1' === $blog['spam'] ) {
|
||||||
$actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>';
|
$actions['unspam'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ),
|
||||||
|
'unspamblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
_x( 'Not Spam', 'site' )
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>';
|
$actions['spam'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ),
|
||||||
|
'spamblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
_x( 'Spam', 'site' )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
|
if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
|
||||||
$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a>';
|
$actions['delete'] = sprintf(
|
||||||
|
'<a href="%1$s">%2$s</a>',
|
||||||
|
esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ),
|
||||||
|
'deleteblog_' . $blog['blog_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
|
__( 'Delete' )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>';
|
$actions['visit'] = sprintf(
|
||||||
|
'<a href="%1$s" rel="bookmark">%2$s</a>',
|
||||||
|
esc_url( get_home_url( $blog['blog_id'], '/' ) ),
|
||||||
|
__( 'Visit' )
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the action links displayed for each site in the Sites list table.
|
* Filters the action links displayed for each site in the Sites list table.
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-55655';
|
$wp_version = '6.3-alpha-55656';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user