wp/wp-admin/load-scripts.php
author ymh <ymh.work@gmail.com>
Thu, 29 Sep 2022 08:06:27 +0200
changeset 20 7b1b88e27a20
parent 19 3d72ae0968f4
child 21 48c4eec2b7e6
permissions -rw-r--r--
Modified Readme
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
     3
/*
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
     4
 * Disable error reporting.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     6
 * Set this to error_reporting( -1 ) for debugging.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
     8
error_reporting( 0 );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    10
// Set ABSPATH for execution.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    11
if ( ! defined( 'ABSPATH' ) ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    12
	define( 'ABSPATH', dirname( __DIR__ ) . '/' );
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    13
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    15
define( 'WPINC', 'wp-includes' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    17
$protocol = $_SERVER['SERVER_PROTOCOL'];
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    18
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    19
	$protocol = 'HTTP/1.0';
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    20
}
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    21
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
$load = $_GET['load'];
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    23
if ( is_array( $load ) ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    24
	ksort( $load );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
	$load = implode( '', $load );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    26
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
$load = array_unique( explode( ',', $load ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    31
if ( empty( $load ) ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    32
	header( "$protocol 400 Bad Request" );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
	exit;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    34
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    36
require ABSPATH . 'wp-admin/includes/noop.php';
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    37
require ABSPATH . WPINC . '/script-loader.php';
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    38
require ABSPATH . WPINC . '/version.php';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    40
$expires_offset = 31536000; // 1 year.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    41
$out            = '';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
$wp_scripts = new WP_Scripts();
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    44
wp_default_scripts( $wp_scripts );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    45
wp_default_packages_vendor( $wp_scripts );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    46
wp_default_packages_scripts( $wp_scripts );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    48
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    49
	header( "$protocol 304 Not Modified" );
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    50
	exit;
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    51
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    52
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    53
foreach ( $load as $handle ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    54
	if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
		continue;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    56
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    58
	$path = ABSPATH . $wp_scripts->registered[ $handle ]->src;
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    59
	$out .= get_file( $path ) . "\n";
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    62
header( "Etag: $wp_version" );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    63
header( 'Content-Type: application/javascript; charset=UTF-8' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    64
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    65
header( "Cache-Control: public, max-age=$expires_offset" );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
echo $out;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
exit;