Edit File by line
/home/barbar84/www/wp-admin
File: load-scripts.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Disable error reporting
[3] Fix | Delete
*
[4] Fix | Delete
* Set this to error_reporting( -1 ) for debugging.
[5] Fix | Delete
*/
[6] Fix | Delete
error_reporting( 0 );
[7] Fix | Delete
[8] Fix | Delete
/** Set ABSPATH for execution */
[9] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[10] Fix | Delete
define( 'ABSPATH', dirname( __DIR__ ) . '/' );
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
define( 'WPINC', 'wp-includes' );
[14] Fix | Delete
[15] Fix | Delete
$protocol = $_SERVER['SERVER_PROTOCOL'];
[16] Fix | Delete
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
[17] Fix | Delete
$protocol = 'HTTP/1.0';
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
$load = $_GET['load'];
[21] Fix | Delete
if ( is_array( $load ) ) {
[22] Fix | Delete
ksort( $load );
[23] Fix | Delete
$load = implode( '', $load );
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
[27] Fix | Delete
$load = array_unique( explode( ',', $load ) );
[28] Fix | Delete
[29] Fix | Delete
if ( empty( $load ) ) {
[30] Fix | Delete
header( "$protocol 400 Bad Request" );
[31] Fix | Delete
exit;
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
require ABSPATH . 'wp-admin/includes/noop.php';
[35] Fix | Delete
require ABSPATH . WPINC . '/script-loader.php';
[36] Fix | Delete
require ABSPATH . WPINC . '/version.php';
[37] Fix | Delete
[38] Fix | Delete
$expires_offset = 31536000; // 1 year.
[39] Fix | Delete
$out = '';
[40] Fix | Delete
[41] Fix | Delete
$wp_scripts = new WP_Scripts();
[42] Fix | Delete
wp_default_scripts( $wp_scripts );
[43] Fix | Delete
wp_default_packages_vendor( $wp_scripts );
[44] Fix | Delete
wp_default_packages_scripts( $wp_scripts );
[45] Fix | Delete
[46] Fix | Delete
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
[47] Fix | Delete
header( "$protocol 304 Not Modified" );
[48] Fix | Delete
exit;
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
foreach ( $load as $handle ) {
[52] Fix | Delete
if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) {
[53] Fix | Delete
continue;
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
$path = ABSPATH . $wp_scripts->registered[ $handle ]->src;
[57] Fix | Delete
$out .= get_file( $path ) . "\n";
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
header( "Etag: $wp_version" );
[61] Fix | Delete
header( 'Content-Type: application/javascript; charset=UTF-8' );
[62] Fix | Delete
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
[63] Fix | Delete
header( "Cache-Control: public, max-age=$expires_offset" );
[64] Fix | Delete
[65] Fix | Delete
echo $out;
[66] Fix | Delete
exit;
[67] Fix | Delete
[68] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function