Coding Standards: Reorder conditionals in `is_random_header_image()`.

This aims to slightly improve performance by checking the faster `empty()` language construct first and potentially avoiding an unnecessary function call. Additionally, this better matches a similar conditional a few lines below.

Follow-up to [17757], [17770].

Props Cybr.
See #59650.
Built from https://develop.svn.wordpress.org/trunk@57139


git-svn-id: http://core.svn.wordpress.org/trunk@56650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-11-27 09:17:21 +00:00
parent 08d9937eb4
commit 2542aabe50
2 changed files with 5 additions and 3 deletions

View File

@ -1437,14 +1437,16 @@ function is_random_header_image( $type = 'any' ) {
if ( 'any' === $type ) { if ( 'any' === $type ) {
if ( 'random-default-image' === $header_image_mod if ( 'random-default-image' === $header_image_mod
|| 'random-uploaded-image' === $header_image_mod || 'random-uploaded-image' === $header_image_mod
|| ( '' !== get_random_header_image() && empty( $header_image_mod ) ) || ( empty( $header_image_mod ) && '' !== get_random_header_image() )
) { ) {
return true; return true;
} }
} else { } else {
if ( "random-$type-image" === $header_image_mod ) { if ( "random-$type-image" === $header_image_mod ) {
return true; return true;
} elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) { } elseif ( 'default' === $type
&& empty( $header_image_mod ) && '' !== get_random_header_image()
) {
return true; return true;
} }
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57138'; $wp_version = '6.5-alpha-57139';
/** /**
* 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.