Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/wp-admin/admin-footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@
*/
do_action( "admin_footer-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

// get_site_option() won't exist when auto upgrading from <= 2.7.
if ( function_exists( 'get_site_option' )
&& false === get_site_option( 'can_compress_scripts' )
) {
compression_test();
}

?>

<div class="clear"></div></div><!-- wpwrap -->
Expand Down
64 changes: 3 additions & 61 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,69 +181,11 @@ function wp_ajax_ajax_tag_search() {
* Handles compression testing via AJAX.
*
* @since 3.1.0
* @deprecated 7.1.0 Script concatenation and compression via load-scripts.php are deprecated.
* The compression test is no longer needed.
*/
function wp_ajax_wp_compression_test() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}

if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) {
// Use `update_option()` on single site to mark the option for autoloading.
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 );
} else {
update_option( 'can_compress_scripts', 0, true );
}
wp_die( 0 );
}

if ( isset( $_GET['test'] ) ) {
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
header( 'Content-Type: application/javascript; charset=UTF-8' );
$force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP );
$test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."';

if ( '1' === $_GET['test'] ) {
echo $test_str;
wp_die();
} elseif ( '2' === $_GET['test'] ) {
if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
wp_die( -1 );
}

if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) {
header( 'Content-Encoding: deflate' );
$output = gzdeflate( $test_str, 1 );
} elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) {
header( 'Content-Encoding: gzip' );
$output = gzencode( $test_str, 1 );
} else {
wp_die( -1 );
}

echo $output;
wp_die();
} elseif ( 'no' === $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
// Use `update_option()` on single site to mark the option for autoloading.
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 0 );
} else {
update_option( 'can_compress_scripts', 0, true );
}
} elseif ( 'yes' === $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
// Use `update_option()` on single site to mark the option for autoloading.
if ( is_multisite() ) {
update_site_option( 'can_compress_scripts', 1 );
} else {
update_option( 'can_compress_scripts', 1, true );
}
}
}

_deprecated_function( __FUNCTION__, '7.1.0' );
wp_die( 0 );
}

Expand Down
92 changes: 77 additions & 15 deletions src/wp-admin/includes/noop.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,112 +2,174 @@
/**
* Noop functions for load-scripts.php and load-styles.php.
*
* These stubs allow the script/style loader classes to be bootstrapped
* without loading the full WordPress stack. Each stub returns a type-safe
* empty value that matches what the real function would return, preventing
* PHP 8 type errors when the return value is used downstream.
*
* @package WordPress
* @subpackage Administration
* @since 4.4.0
* @deprecated 7.1.0 Script/style concatenation via load-scripts.php and load-styles.php is deprecated.
*/

/**
* @ignore
* @return string
*/
function __() {}
function __() {
return '';
}

/**
* @ignore
* @return string
*/
function _x() {}
function _x() {
return '';
}

/**
* @ignore
* @return void
*/
function add_filter() {}

/**
* @ignore
* @return false
*/
function has_filter() {
return false;
}

/**
* @ignore
* @param string $text
* @return string
*/
function esc_attr() {}
function esc_attr( $text = '' ) {
return (string) $text;
}

/**
* @ignore
* @return mixed Returns the first argument passed, matching the real apply_filters() contract.
*/
function apply_filters() {}
function apply_filters() {
$args = func_get_args();
// Return the second argument (the value), mirroring the real apply_filters() behaviour.
return isset( $args[1] ) ? $args[1] : null;
}

/**
* @ignore
* @return false
*/
function get_option() {}
function get_option() {
return false;
}

/**
* @ignore
* @return false
*/
function is_lighttpd_before_150() {}
function is_lighttpd_before_150() {
return false;
}

/**
* @ignore
* @return void
*/
function add_action() {}

/**
* @ignore
* @return false
*/
function did_action() {}
function did_action() {
return false;
}

/**
* @ignore
* @return void
*/
function do_action_ref_array() {}

/**
* @ignore
* @return string
*/
function get_bloginfo() {}
function get_bloginfo() {
return '';
}

/**
* @ignore
* @return true
*/
function is_admin() {
return true;
}

/**
* @ignore
* @return string
*/
function site_url() {}
function site_url() {
return '';
}

/**
* @ignore
* @return string
*/
function admin_url() {}
function admin_url() {
return '';
}

/**
* @ignore
* @return string
*/
function home_url() {}
function home_url() {
return '';
}

/**
* @ignore
* @return string
*/
function includes_url() {}
function includes_url() {
return '';
}

/**
* @ignore
* @return string
*/
function wp_guess_url() {}
function wp_guess_url() {
return '';
}

/**
* Returns the contents of the given file path, or an empty string if the file
* does not exist or cannot be read.
*
* @param string $path Absolute filesystem path to the file.
* @return string File contents, or empty string on failure.
*/
function get_file( $path ) {

$path = realpath( $path );

if ( ! $path || ! @is_file( $path ) ) {
if ( ! $path || ! is_file( $path ) ) {
return '';
}

return @file_get_contents( $path );
$contents = file_get_contents( $path );

return false !== $contents ? $contents : '';
}
3 changes: 3 additions & 0 deletions src/wp-admin/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2497,8 +2497,11 @@ function get_media_states( $post ) {
* has to be deleted.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation and compression via load-scripts.php are deprecated.
* The compression test is no longer needed.
*/
function compression_test() {
_deprecated_function( __FUNCTION__, '7.1.0' );
?>
<script>
var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?>;
Expand Down
20 changes: 7 additions & 13 deletions src/wp-admin/load-scripts.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<?php

/*
* The error_reporting() function can be disabled in php.ini. On systems where that is the case,
* it's best to add a dummy function to the wp-config.php file, but as this call to the function
* is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
/**
* Concatenated script loader.
*
* @deprecated 7.1.0 Script concatenation is deprecated. Scripts are now served individually,
* which works efficiently with HTTP/2. This file remains for sites that have
* opted back in by defining CONCATENATE_SCRIPTS as true in wp-config.php.
* Support will be removed in a future release.
*/
if ( function_exists( 'error_reporting' ) ) {
/*
* Disable error reporting.
*
* Set this to error_reporting( -1 ) for debugging.
*/
error_reporting( 0 );
}

// Set ABSPATH for execution.
if ( ! defined( 'ABSPATH' ) ) {
Expand Down
20 changes: 7 additions & 13 deletions src/wp-admin/load-styles.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<?php

/*
* The error_reporting() function can be disabled in php.ini. On systems where that is the case,
* it's best to add a dummy function to the wp-config.php file, but as this call to the function
* is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
/**
* Concatenated stylesheet loader.
*
* @deprecated 7.1.0 Style concatenation is deprecated. Stylesheets are now served individually,
* which works efficiently with HTTP/2. This file remains for sites that have
* opted back in by defining CONCATENATE_SCRIPTS as true in wp-config.php.
* Support will be removed in a future release.
*/
if ( function_exists( 'error_reporting' ) ) {
/*
* Disable error reporting.
*
* Set this to error_reporting( -1 ) for debugging.
*/
error_reporting( 0 );
}

// Set ABSPATH for execution.
if ( ! defined( 'ABSPATH' ) ) {
Expand Down
8 changes: 8 additions & 0 deletions src/wp-includes/class-wp-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class WP_Scripts extends WP_Dependencies {
* Holds a list of script handles which will be concatenated.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation is deprecated. This property has no effect
* when CONCATENATE_SCRIPTS is not defined as true.
* @var string
*/
public $concat = '';
Expand All @@ -74,6 +76,8 @@ class WP_Scripts extends WP_Dependencies {
* Whether to perform concatenation.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation is deprecated. This property will always be
* false unless CONCATENATE_SCRIPTS is explicitly defined as true.
* @var bool
*/
public $do_concat = false;
Expand All @@ -83,6 +87,7 @@ class WP_Scripts extends WP_Dependencies {
* is enabled.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation is deprecated.
* @var string
*/
public $print_html = '';
Expand All @@ -91,6 +96,7 @@ class WP_Scripts extends WP_Dependencies {
* Holds inline code if concatenation is enabled.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation is deprecated.
* @var string
*/
public $print_code = '';
Expand All @@ -102,6 +108,7 @@ class WP_Scripts extends WP_Dependencies {
* Unused in core.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation is deprecated.
* @var string
*/
public $ext_handles = '';
Expand All @@ -113,6 +120,7 @@ class WP_Scripts extends WP_Dependencies {
* Unused in core.
*
* @since 2.8.0
* @deprecated 7.1.0 Script concatenation is deprecated.
* @var string
*/
public $ext_version = '';
Expand Down
Loading
Loading