mirror of
https://github.com/WordPress/WordPress.git
synced 2026-06-19 07:37:07 +00:00
Code Modernization: Formatting: 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 [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403]. Props costdev, westonruter. See #58874, #63430. Built from https://develop.svn.wordpress.org/trunk@61436 git-svn-id: http://core.svn.wordpress.org/trunk@60748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2642,8 +2642,8 @@ function force_balance_tags( $text ) {
|
||||
$tag_name = $regex[2];
|
||||
$tag = strtolower( $tag_name );
|
||||
$is_single_tag = in_array( $tag, $single_tags, true );
|
||||
$pre_attribute_ws = isset( $regex[4] ) ? $regex[4] : '';
|
||||
$attributes = trim( isset( $regex[5] ) ? $regex[5] : $regex[3] );
|
||||
$pre_attribute_ws = $regex[4] ?? '';
|
||||
$attributes = trim( $regex[5] ?? $regex[3] );
|
||||
$has_self_closer = str_ends_with( $attributes, '/' );
|
||||
|
||||
$newtext .= $tagqueue;
|
||||
@@ -5283,10 +5283,10 @@ function wp_sprintf( $pattern, ...$args ) {
|
||||
// Find numbered arguments or take the next one in order.
|
||||
if ( preg_match( '/^%(\d+)\$/', $fragment, $matches ) ) {
|
||||
$index = $matches[1] - 1; // 0-based array vs 1-based sprintf() arguments.
|
||||
$arg = isset( $args[ $index ] ) ? $args[ $index ] : '';
|
||||
$arg = $args[ $index ] ?? '';
|
||||
$fragment = str_replace( "%{$matches[1]}$", '%', $fragment );
|
||||
} else {
|
||||
$arg = isset( $args[ $arg_index ] ) ? $args[ $arg_index ] : '';
|
||||
$arg = $args[ $arg_index ] ?? '';
|
||||
++$arg_index;
|
||||
}
|
||||
|
||||
|
||||
@@ -3033,7 +3033,7 @@ function _wp_kses_allow_pdf_objects( $url ) {
|
||||
// If the URL host matches the current site's media URL, it's safe.
|
||||
$upload_info = wp_upload_dir( null, false );
|
||||
$parsed_url = wp_parse_url( $upload_info['url'] );
|
||||
$upload_host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : '';
|
||||
$upload_host = $parsed_url['host'] ?? '';
|
||||
$upload_port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : '';
|
||||
|
||||
if ( str_starts_with( $url, "http://$upload_host$upload_port/" )
|
||||
|
||||
@@ -429,7 +429,7 @@ function do_shortcode_tag( $m ) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
$content = isset( $m[5] ) ? $m[5] : null;
|
||||
$content = $m[5] ?? null;
|
||||
|
||||
$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-alpha-61435';
|
||||
$wp_version = '7.0-alpha-61436';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user