mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890. Includes minor code layout fixes for better readability. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+18
-10
@@ -1156,7 +1156,7 @@ function has_header_image() {
|
||||
function get_header_image() {
|
||||
$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
|
||||
|
||||
if ( 'remove-header' == $url ) {
|
||||
if ( 'remove-header' === $url ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1265,10 +1265,10 @@ function _get_random_header_data() {
|
||||
$header_image_mod = get_theme_mod( 'header_image', '' );
|
||||
$headers = array();
|
||||
|
||||
if ( 'random-uploaded-image' == $header_image_mod ) {
|
||||
if ( 'random-uploaded-image' === $header_image_mod ) {
|
||||
$headers = get_uploaded_header_images();
|
||||
} elseif ( ! empty( $_wp_default_headers ) ) {
|
||||
if ( 'random-default-image' == $header_image_mod ) {
|
||||
if ( 'random-default-image' === $header_image_mod ) {
|
||||
$headers = $_wp_default_headers;
|
||||
} else {
|
||||
if ( current_theme_supports( 'custom-header', 'random-default' ) ) {
|
||||
@@ -1286,6 +1286,7 @@ function _get_random_header_data() {
|
||||
$_wp_random_header->url = sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() );
|
||||
$_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );
|
||||
}
|
||||
|
||||
return $_wp_random_header;
|
||||
}
|
||||
|
||||
@@ -1298,9 +1299,11 @@ function _get_random_header_data() {
|
||||
*/
|
||||
function get_random_header_image() {
|
||||
$random_image = _get_random_header_data();
|
||||
|
||||
if ( empty( $random_image->url ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $random_image->url;
|
||||
}
|
||||
|
||||
@@ -1319,14 +1322,17 @@ function get_random_header_image() {
|
||||
function is_random_header_image( $type = 'any' ) {
|
||||
$header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
|
||||
|
||||
if ( 'any' == $type ) {
|
||||
if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) ) {
|
||||
if ( 'any' === $type ) {
|
||||
if ( 'random-default-image' === $header_image_mod
|
||||
|| 'random-uploaded-image' === $header_image_mod
|
||||
|| ( '' !== get_random_header_image() && empty( $header_image_mod ) )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ( "random-$type-image" == $header_image_mod ) {
|
||||
if ( "random-$type-image" === $header_image_mod ) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1341,6 +1347,7 @@ function is_random_header_image( $type = 'any' ) {
|
||||
*/
|
||||
function header_image() {
|
||||
$image = get_header_image();
|
||||
|
||||
if ( $image ) {
|
||||
echo esc_url( $image );
|
||||
}
|
||||
@@ -1536,6 +1543,7 @@ function get_header_video_url() {
|
||||
*/
|
||||
function the_header_video_url() {
|
||||
$video = get_header_video_url();
|
||||
|
||||
if ( $video ) {
|
||||
echo esc_url( $video );
|
||||
}
|
||||
@@ -2903,7 +2911,7 @@ function _remove_theme_support( $feature ) {
|
||||
function current_theme_supports( $feature, ...$args ) {
|
||||
global $_wp_theme_features;
|
||||
|
||||
if ( 'custom-header-uploads' == $feature ) {
|
||||
if ( 'custom-header-uploads' === $feature ) {
|
||||
return current_theme_supports( 'custom-header', 'uploads' );
|
||||
}
|
||||
|
||||
@@ -3074,11 +3082,11 @@ function check_theme_switched() {
|
||||
*/
|
||||
function _wp_customize_include() {
|
||||
|
||||
$is_customize_admin_page = ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) );
|
||||
$is_customize_admin_page = ( is_admin() && 'customize.php' === basename( $_SERVER['PHP_SELF'] ) );
|
||||
$should_include = (
|
||||
$is_customize_admin_page
|
||||
||
|
||||
( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] )
|
||||
( isset( $_REQUEST['wp_customize'] ) && 'on' === $_REQUEST['wp_customize'] )
|
||||
||
|
||||
( ! empty( $_GET['customize_changeset_uuid'] ) || ! empty( $_POST['customize_changeset_uuid'] ) )
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user