Fix previous WPCS errors in script-loader.php triggered by [45456].

See #45346.

git-svn-id: https://develop.svn.wordpress.org/trunk@45457 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2019-05-28 03:31:55 +00:00
parent 2d02bb13d1
commit 5bcaac6cfd

View File

@ -754,8 +754,8 @@ function wp_tinymce_inline_scripts() {
$init_obj .= $key . ':' . $val . ',';
continue;
} elseif ( ! empty( $value ) && is_string( $value ) && (
( '{' == $value{0} && '}' == $value{strlen( $value ) - 1} ) ||
( '[' == $value{0} && ']' == $value{strlen( $value ) - 1} ) ||
( '{' === $value{0} && '}' === $value{strlen( $value ) - 1} ) ||
( '[' === $value{0} && ']' === $value{strlen( $value ) - 1} ) ||
preg_match( '/^\(?function ?\(/', $value ) ) ) {
$init_obj .= $key . ':' . $value . ',';
continue;
@ -844,8 +844,9 @@ function wp_scripts_get_suffix( $type = '' ) {
function wp_default_scripts( &$scripts ) {
$suffix = wp_scripts_get_suffix();
$dev_suffix = wp_scripts_get_suffix( 'dev' );
$guessurl = site_url();
if ( ! $guessurl = site_url() ) {
if ( ! $guessurl ) {
$guessed_url = true;
$guessurl = wp_guess_url();
}
@ -1883,7 +1884,9 @@ function wp_default_styles( &$styles ) {
define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
}
if ( ! $guessurl = site_url() ) {
$guessurl = site_url();
if ( ! $guessurl ) {
$guessurl = wp_guess_url();
}
@ -1907,11 +1910,11 @@ function wp_default_styles( &$styles ) {
*/
$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' );
if ( 'cyrillic' == $subset ) {
if ( 'cyrillic' === $subset ) {
$subsets .= ',cyrillic,cyrillic-ext';
} elseif ( 'greek' == $subset ) {
} elseif ( 'greek' === $subset ) {
$subsets .= ',greek,greek-ext';
} elseif ( 'vietnamese' == $subset ) {
} elseif ( 'vietnamese' === $subset ) {
$subsets .= ',vietnamese';
}
@ -2110,11 +2113,15 @@ function wp_default_styles( &$styles ) {
* @return array Reordered array, if needed.
*/
function wp_prototype_before_jquery( $js_array ) {
if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) {
$prototype = array_search( 'prototype', $js_array, true );
if ( false === $prototype ) {
return $js_array;
}
if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) {
$jquery = array_search( 'jquery', $js_array, true );
if ( false === $jquery ) {
return $js_array;
}
@ -2330,7 +2337,7 @@ function wp_style_loader_src( $src, $handle ) {
return preg_replace( '#^wp-admin/#', './', $src );
}
if ( 'colors' == $handle ) {
if ( 'colors' === $handle ) {
$color = get_user_option( 'admin_color' );
if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
@ -2450,8 +2457,9 @@ function _print_scripts() {
$zip = 'gzip';
}
if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
$concat = trim( $wp_scripts->concat, ', ' );
if ( $concat ) {
if ( ! empty( $wp_scripts->print_code ) ) {
echo "\n<script type='text/javascript'>\n";
echo "/* <![CDATA[ */\n"; // not needed in HTML 5
@ -2630,7 +2638,9 @@ function _print_styles() {
$zip = 'gzip';
}
if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
$concat = trim( $wp_styles->concat, ', ' );
if ( $concat ) {
$dir = $wp_styles->text_direction;
$ver = $wp_styles->default_version;
@ -2668,7 +2678,7 @@ function _print_styles() {
function script_concat_settings() {
global $concatenate_scripts, $compress_scripts, $compress_css;
$compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' == ini_get( 'output_handler' ) );
$compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) );
if ( ! isset( $concatenate_scripts ) ) {
$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;