From eaadfde9506df3d06b97a75e37a34806b544fc49 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 25 Jun 2015 02:29:31 +0000 Subject: [PATCH] Define `SCRIPT_DEBUG` early on every load, similarly to `WP_DEBUG`. Remove `defined( 'SCRIPT_DEBUG' )` checks. Fixes #32333. Built from https://develop.svn.wordpress.org/trunk@32935 git-svn-id: http://core.svn.wordpress.org/trunk@32906 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-editor.php | 4 ++-- wp-includes/default-constants.php | 12 ++++++++++++ wp-includes/formatting.php | 3 +-- wp-includes/general-template.php | 2 +- wp-includes/version.php | 2 +- wp-settings.php | 2 +- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 707cc9258e..f782e8428d 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -542,7 +542,7 @@ final class _WP_Editors { self::$first_init['external_plugins'] = wp_json_encode( $mce_external_plugins ); } - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + $suffix = SCRIPT_DEBUG ? '' : '.min'; $version = 'ver=' . $wp_version; $dashicons = includes_url( "css/dashicons$suffix.css?$version" ); @@ -1134,7 +1134,7 @@ final class _WP_Editors { 'language' => self::$mce_locale ); - $suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min'; + $suffix = SCRIPT_DEBUG ? '' : '.min'; /** * Fires immediately before the TinyMCE settings are printed. diff --git a/wp-includes/default-constants.php b/wp-includes/default-constants.php index 7dce9ac95f..f265e31a51 100644 --- a/wp-includes/default-constants.php +++ b/wp-includes/default-constants.php @@ -71,6 +71,18 @@ function wp_initial_constants() { if ( !defined('WP_CACHE') ) define('WP_CACHE', false); + // Add define('SCRIPT_DEBUG', true); to wp-config.php to enable loading of non-minified, + // non-concatenated scripts and stylesheets. + if ( ! defined( 'SCRIPT_DEBUG' ) ) { + if ( ! empty( $GLOBALS['wp_version'] ) ) { + $develop_src = false !== strpos( $GLOBALS['wp_version'], '-src' ); + } else { + $develop_src = false; + } + + define( 'SCRIPT_DEBUG', $develop_src ); + } + /** * Private */ diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index d60b68da1c..68f0db511c 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -4255,9 +4255,8 @@ function print_emoji_detection_script() { ); $version = 'ver=' . $wp_version; - $develop_src = false !== strpos( $wp_version, '-src' ); - if ( $develop_src || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) { + if ( SCRIPT_DEBUG ) { $settings['source'] = array( /** This filter is documented in wp-includes/class.wp-scripts.php */ 'wpemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji.js?$version" ), 'wpemoji' ), diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 4948130f6d..3c3f88f02c 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2841,7 +2841,7 @@ function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = arra */ function register_admin_color_schemes() { $suffix = is_rtl() ? '-rtl' : ''; - $suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + $suffix .= SCRIPT_DEBUG ? '' : '.min'; wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ), false, diff --git a/wp-includes/version.php b/wp-includes/version.php index 0844436da8..8def4882c0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32934'; +$wp_version = '4.3-alpha-32935'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-settings.php b/wp-settings.php index f90ff11c10..e8e114a0ae 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -29,7 +29,7 @@ require( ABSPATH . WPINC . '/default-constants.php' ); global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version; require( ABSPATH . WPINC . '/version.php' ); -// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE. +// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE. wp_initial_constants(); // Check for the required PHP version and for the MySQL extension or a database drop-in.