author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
||
19 | 3 |
/* |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
4 |
* The error_reporting() function can be disabled in php.ini. On systems where that is the case, |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
5 |
* it's best to add a dummy function to the wp-config.php file, but as this call to the function |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
6 |
* is run prior to wp-config.php loading, it is wrapped in a function_exists() check. |
0 | 7 |
*/ |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
8 |
if ( function_exists( 'error_reporting' ) ) { |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
9 |
/* |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
10 |
* Disable error reporting. |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
11 |
* |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
12 |
* Set this to error_reporting( -1 ) for debugging. |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
13 |
*/ |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
14 |
error_reporting( 0 ); |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
15 |
} |
0 | 16 |
|
19 | 17 |
// Set ABSPATH for execution. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
18 |
if ( ! defined( 'ABSPATH' ) ) { |
16 | 19 |
define( 'ABSPATH', dirname( __DIR__ ) . '/' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
} |
0 | 21 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
define( 'WPINC', 'wp-includes' ); |
0 | 23 |
|
16 | 24 |
$protocol = $_SERVER['SERVER_PROTOCOL']; |
19 | 25 |
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) { |
16 | 26 |
$protocol = 'HTTP/1.0'; |
27 |
} |
|
28 |
||
0 | 29 |
$load = $_GET['load']; |
9 | 30 |
if ( is_array( $load ) ) { |
16 | 31 |
ksort( $load ); |
0 | 32 |
$load = implode( '', $load ); |
9 | 33 |
} |
0 | 34 |
|
35 |
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load ); |
|
36 |
$load = array_unique( explode( ',', $load ) ); |
|
37 |
||
9 | 38 |
if ( empty( $load ) ) { |
16 | 39 |
header( "$protocol 400 Bad Request" ); |
0 | 40 |
exit; |
9 | 41 |
} |
0 | 42 |
|
16 | 43 |
require ABSPATH . 'wp-admin/includes/noop.php'; |
44 |
require ABSPATH . WPINC . '/script-loader.php'; |
|
45 |
require ABSPATH . WPINC . '/version.php'; |
|
0 | 46 |
|
16 | 47 |
$expires_offset = 31536000; // 1 year. |
9 | 48 |
$out = ''; |
0 | 49 |
|
50 |
$wp_scripts = new WP_Scripts(); |
|
9 | 51 |
wp_default_scripts( $wp_scripts ); |
52 |
wp_default_packages_vendor( $wp_scripts ); |
|
53 |
wp_default_packages_scripts( $wp_scripts ); |
|
0 | 54 |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
55 |
$etag = $wp_scripts->get_etag( $load ); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
56 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
57 |
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $etag ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
58 |
header( "$protocol 304 Not Modified" ); |
16 | 59 |
exit; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
60 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
62 |
foreach ( $load as $handle ) { |
9 | 63 |
if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) { |
0 | 64 |
continue; |
9 | 65 |
} |
0 | 66 |
|
9 | 67 |
$path = ABSPATH . $wp_scripts->registered[ $handle ]->src; |
68 |
$out .= get_file( $path ) . "\n"; |
|
0 | 69 |
} |
70 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
71 |
header( "Etag: $etag" ); |
9 | 72 |
header( 'Content-Type: application/javascript; charset=UTF-8' ); |
73 |
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' ); |
|
74 |
header( "Cache-Control: public, max-age=$expires_offset" ); |
|
0 | 75 |
|
76 |
echo $out; |
|
77 |
exit; |