Code Modernization: Script Loader: 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 [61436], [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@61442 git-svn-id: http://core.svn.wordpress.org/trunk@60754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -450,7 +450,7 @@ class WP_Scripts extends WP_Dependencies {
|
||||
}
|
||||
|
||||
// Determine fetchpriority.
|
||||
$original_fetchpriority = isset( $obj->extra['fetchpriority'] ) ? $obj->extra['fetchpriority'] : null;
|
||||
$original_fetchpriority = $obj->extra['fetchpriority'] ?? null;
|
||||
if ( null === $original_fetchpriority || ! $this->is_valid_fetchpriority( $original_fetchpriority ) ) {
|
||||
$original_fetchpriority = 'auto';
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ class WP_Styles extends WP_Dependencies {
|
||||
}
|
||||
|
||||
$rel = isset( $obj->extra['alt'] ) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
|
||||
$title = isset( $obj->extra['title'] ) ? $obj->extra['title'] : '';
|
||||
$title = $obj->extra['title'] ?? '';
|
||||
|
||||
$tag = sprintf(
|
||||
"<link rel='%s' id='%s-css'%s href='%s' media='%s' />\n",
|
||||
@@ -230,7 +230,7 @@ class WP_Styles extends WP_Dependencies {
|
||||
|
||||
if ( 'rtl' === $this->text_direction && isset( $obj->extra['rtl'] ) && $obj->extra['rtl'] ) {
|
||||
if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) {
|
||||
$suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
|
||||
$suffix = $obj->extra['suffix'] ?? '';
|
||||
$rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $src, $ver, "$handle-rtl" ) );
|
||||
} else {
|
||||
$rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
|
||||
|
||||
22
wp-includes/css/dist/index.php
vendored
22
wp-includes/css/dist/index.php
vendored
@@ -7,11 +7,6 @@
|
||||
*/
|
||||
|
||||
return array(
|
||||
array(
|
||||
'handle' => 'wp-preferences',
|
||||
'path' => 'preferences/style',
|
||||
'dependencies' => array('wp-components'),
|
||||
),
|
||||
array(
|
||||
'handle' => 'wp-nux',
|
||||
'path' => 'nux/style',
|
||||
@@ -23,8 +18,8 @@ return array(
|
||||
'dependencies' => array('wp-components'),
|
||||
),
|
||||
array(
|
||||
'handle' => 'wp-commands',
|
||||
'path' => 'commands/style',
|
||||
'handle' => 'wp-preferences',
|
||||
'path' => 'preferences/style',
|
||||
'dependencies' => array('wp-components'),
|
||||
),
|
||||
array(
|
||||
@@ -33,13 +28,18 @@ return array(
|
||||
'dependencies' => array('wp-block-editor', 'wp-components'),
|
||||
),
|
||||
array(
|
||||
'handle' => 'wp-widgets',
|
||||
'path' => 'widgets/style',
|
||||
'handle' => 'wp-patterns',
|
||||
'path' => 'patterns/style',
|
||||
'dependencies' => array('wp-block-editor', 'wp-components'),
|
||||
),
|
||||
array(
|
||||
'handle' => 'wp-patterns',
|
||||
'path' => 'patterns/style',
|
||||
'handle' => 'wp-commands',
|
||||
'path' => 'commands/style',
|
||||
'dependencies' => array('wp-components'),
|
||||
),
|
||||
array(
|
||||
'handle' => 'wp-widgets',
|
||||
'path' => 'widgets/style',
|
||||
'dependencies' => array('wp-block-editor', 'wp-components'),
|
||||
),
|
||||
array(
|
||||
|
||||
@@ -283,7 +283,7 @@ function wp_add_global_styles_for_blocks() {
|
||||
|
||||
if ( $can_use_cached ) {
|
||||
// Use the block name as the key for cached CSS data. Otherwise, use a hash of the metadata.
|
||||
$cache_node_key = isset( $metadata['name'] ) ? $metadata['name'] : md5( wp_json_encode( $metadata ) );
|
||||
$cache_node_key = $metadata['name'] ?? md5( wp_json_encode( $metadata ) );
|
||||
|
||||
if ( isset( $cached['blocks'][ $cache_node_key ] ) ) {
|
||||
$block_css = $cached['blocks'][ $cache_node_key ];
|
||||
|
||||
30
wp-includes/js/dist/script-modules/index.php
vendored
30
wp-includes/js/dist/script-modules/index.php
vendored
@@ -7,11 +7,26 @@
|
||||
*/
|
||||
|
||||
return array(
|
||||
array(
|
||||
'id' => '@wordpress/interactivity-router',
|
||||
'path' => 'interactivity-router/index',
|
||||
'asset' => 'interactivity-router/index.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/interactivity-router/full-page',
|
||||
'path' => 'interactivity-router/full-page',
|
||||
'asset' => 'interactivity-router/full-page.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/interactivity',
|
||||
'path' => 'interactivity/index',
|
||||
'asset' => 'interactivity/index.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/abilities',
|
||||
'path' => 'abilities/index',
|
||||
'asset' => 'abilities/index.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/latex-to-mathml',
|
||||
'path' => 'latex-to-mathml/index',
|
||||
@@ -22,16 +37,6 @@ return array(
|
||||
'path' => 'latex-to-mathml/loader',
|
||||
'asset' => 'latex-to-mathml/loader.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/interactivity-router',
|
||||
'path' => 'interactivity-router/index',
|
||||
'asset' => 'interactivity-router/index.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/interactivity-router/full-page',
|
||||
'path' => 'interactivity-router/full-page',
|
||||
'asset' => 'interactivity-router/full-page.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/a11y',
|
||||
'path' => 'a11y/index',
|
||||
@@ -42,11 +47,6 @@ return array(
|
||||
'path' => 'core-abilities/index',
|
||||
'asset' => 'core-abilities/index.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/abilities',
|
||||
'path' => 'abilities/index',
|
||||
'asset' => 'abilities/index.min.asset.php',
|
||||
),
|
||||
array(
|
||||
'id' => '@wordpress/route',
|
||||
'path' => 'route/index',
|
||||
|
||||
@@ -1984,7 +1984,7 @@ function wp_localize_community_events() {
|
||||
|
||||
$user_id = get_current_user_id();
|
||||
$saved_location = get_user_option( 'community-events-location', $user_id );
|
||||
$saved_ip_address = isset( $saved_location['ip'] ) ? $saved_location['ip'] : false;
|
||||
$saved_ip_address = $saved_location['ip'] ?? false;
|
||||
$current_ip_address = WP_Community_Events::get_unsafe_client_ip();
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-alpha-61441';
|
||||
$wp_version = '7.0-alpha-61442';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user