Edit File by line
/home/barbar84/www/wp-admin
File: load-styles.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
require ABSPATH . 'wp-admin/includes/noop.php';
[16] Fix | Delete
require ABSPATH . WPINC . '/script-loader.php';
[17] Fix | Delete
require ABSPATH . WPINC . '/version.php';
[18] Fix | Delete
[19] Fix | Delete
$protocol = $_SERVER['SERVER_PROTOCOL'];
[20] Fix | Delete
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
[21] Fix | Delete
$protocol = 'HTTP/1.0';
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
$load = $_GET['load'];
[25] Fix | Delete
if ( is_array( $load ) ) {
[26] Fix | Delete
ksort( $load );
[27] Fix | Delete
$load = implode( '', $load );
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
[31] Fix | Delete
$load = array_unique( explode( ',', $load ) );
[32] Fix | Delete
[33] Fix | Delete
if ( empty( $load ) ) {
[34] Fix | Delete
header( "$protocol 400 Bad Request" );
[35] Fix | Delete
exit;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$rtl = ( isset( $_GET['dir'] ) && 'rtl' === $_GET['dir'] );
[39] Fix | Delete
$expires_offset = 31536000; // 1 year.
[40] Fix | Delete
$out = '';
[41] Fix | Delete
[42] Fix | Delete
$wp_styles = new WP_Styles();
[43] Fix | Delete
wp_default_styles( $wp_styles );
[44] Fix | Delete
[45] Fix | Delete
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
[46] Fix | Delete
header( "$protocol 304 Not Modified" );
[47] Fix | Delete
exit;
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
foreach ( $load as $handle ) {
[51] Fix | Delete
if ( ! array_key_exists( $handle, $wp_styles->registered ) ) {
[52] Fix | Delete
continue;
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
$style = $wp_styles->registered[ $handle ];
[56] Fix | Delete
[57] Fix | Delete
if ( empty( $style->src ) ) {
[58] Fix | Delete
continue;
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
$path = ABSPATH . $style->src;
[62] Fix | Delete
[63] Fix | Delete
if ( $rtl && ! empty( $style->extra['rtl'] ) ) {
[64] Fix | Delete
// All default styles have fully independent RTL files.
[65] Fix | Delete
$path = str_replace( '.min.css', '-rtl.min.css', $path );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
$content = get_file( $path ) . "\n";
[69] Fix | Delete
[70] Fix | Delete
if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) {
[71] Fix | Delete
$content = str_replace( '../images/', '../' . WPINC . '/images/', $content );
[72] Fix | Delete
$content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content );
[73] Fix | Delete
$content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content );
[74] Fix | Delete
$out .= $content;
[75] Fix | Delete
} else {
[76] Fix | Delete
$out .= str_replace( '../images/', 'images/', $content );
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
header( "Etag: $wp_version" );
[81] Fix | Delete
header( 'Content-Type: text/css; charset=UTF-8' );
[82] Fix | Delete
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
[83] Fix | Delete
header( "Cache-Control: public, max-age=$expires_offset" );
[84] Fix | Delete
[85] Fix | Delete
echo $out;
[86] Fix | Delete
exit;
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function