Code Modernization: Comments: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654 Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886 Follow-up to [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props costdev, westonruter. See #58874, #63430. Built from https://develop.svn.wordpress.org/trunk@61434 git-svn-id: http://core.svn.wordpress.org/trunk@60746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -337,7 +337,7 @@ if ( isset( $_REQUEST['approved'] )
|
||||
}
|
||||
|
||||
if ( $spammed > 0 ) {
|
||||
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
|
||||
$ids = $_REQUEST['ids'] ?? 0;
|
||||
|
||||
$messages[] = sprintf(
|
||||
/* translators: %s: Number of comments. */
|
||||
@@ -359,7 +359,7 @@ if ( isset( $_REQUEST['approved'] )
|
||||
}
|
||||
|
||||
if ( $trashed > 0 ) {
|
||||
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
|
||||
$ids = $_REQUEST['ids'] ?? 0;
|
||||
|
||||
$messages[] = sprintf(
|
||||
/* translators: %s: Number of comments. */
|
||||
|
||||
@@ -49,7 +49,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
'plural' => 'comments',
|
||||
'singular' => 'comment',
|
||||
'ajax' => true,
|
||||
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
|
||||
'screen' => $args['screen'] ?? null,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
||||
}
|
||||
|
||||
$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
|
||||
$comment_status = $_REQUEST['comment_status'] ?? 'all';
|
||||
|
||||
if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) {
|
||||
$comment_status = 'all';
|
||||
@@ -144,7 +144,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'status' => isset( $status_map[ $comment_status ] ) ? $status_map[ $comment_status ] : $comment_status,
|
||||
'status' => $status_map[ $comment_status ] ?? $comment_status,
|
||||
'search' => $search,
|
||||
'user_id' => $user_id,
|
||||
'offset' => $start,
|
||||
|
||||
@@ -2215,7 +2215,7 @@ function wp_filter_comment( $commentdata ) {
|
||||
*
|
||||
* @param string $comment_agent The comment author's browser user agent.
|
||||
*/
|
||||
$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
|
||||
$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( $commentdata['comment_agent'] ?? '' ) );
|
||||
/** This filter is documented in wp-includes/comment.php */
|
||||
$commentdata['comment_author'] = apply_filters( 'pre_comment_author_name', $commentdata['comment_author'] );
|
||||
/**
|
||||
@@ -2333,7 +2333,7 @@ function wp_new_comment( $commentdata, $wp_error = false ) {
|
||||
}
|
||||
|
||||
if ( ! isset( $commentdata['comment_agent'] ) ) {
|
||||
$commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
||||
$commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2632,7 +2632,7 @@ function wp_update_comment( $commentarr, $wp_error = false ) {
|
||||
|
||||
$filter_comment = false;
|
||||
if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
|
||||
$filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
|
||||
$filter_comment = ! user_can( $comment['user_id'] ?? 0, 'unfiltered_html' );
|
||||
}
|
||||
|
||||
if ( $filter_comment ) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-alpha-61433';
|
||||
$wp_version = '7.0-alpha-61434';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user