2009-01-14 15:18:51 +01:00
|
|
|
<?php
|
|
|
|
|
2009-04-20 20:18:39 +02:00
|
|
|
/**
|
2009-04-15 21:55:41 +02:00
|
|
|
* Disable error reporting
|
2009-04-20 20:18:39 +02:00
|
|
|
*
|
2014-07-07 18:42:16 +02:00
|
|
|
* Set this to error_reporting( -1 ) for debugging.
|
2009-04-15 21:55:41 +02:00
|
|
|
*/
|
2017-12-01 00:11:00 +01:00
|
|
|
error_reporting( 0 );
|
2009-04-15 21:55:41 +02:00
|
|
|
|
2009-01-14 15:18:51 +01:00
|
|
|
/** Set ABSPATH for execution */
|
2016-04-14 19:53:28 +02:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
2020-02-06 07:33:11 +01:00
|
|
|
define( 'ABSPATH', dirname( __DIR__ ) . '/' );
|
2016-04-14 19:53:28 +02:00
|
|
|
}
|
|
|
|
|
2009-04-05 05:32:49 +02:00
|
|
|
define( 'WPINC', 'wp-includes' );
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2019-08-04 00:17:57 +02:00
|
|
|
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
2021-11-10 00:07:01 +01:00
|
|
|
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
|
2019-08-04 00:17:57 +02:00
|
|
|
$protocol = 'HTTP/1.0';
|
|
|
|
}
|
|
|
|
|
2012-12-05 19:57:56 +01:00
|
|
|
$load = $_GET['load'];
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( is_array( $load ) ) {
|
2019-05-28 04:43:55 +02:00
|
|
|
ksort( $load );
|
2012-12-05 19:57:56 +01:00
|
|
|
$load = implode( '', $load );
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2012-12-05 19:57:56 +01:00
|
|
|
|
|
|
|
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
|
2013-07-29 19:57:04 +02:00
|
|
|
$load = array_unique( explode( ',', $load ) );
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( empty( $load ) ) {
|
2019-08-04 00:17:57 +02:00
|
|
|
header( "$protocol 400 Bad Request" );
|
2009-01-14 15:18:51 +01:00
|
|
|
exit;
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2020-02-06 07:33:11 +01:00
|
|
|
require ABSPATH . 'wp-admin/includes/noop.php';
|
|
|
|
require ABSPATH . WPINC . '/script-loader.php';
|
|
|
|
require ABSPATH . WPINC . '/version.php';
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2020-01-29 01:45:18 +01:00
|
|
|
$expires_offset = 31536000; // 1 year.
|
2017-12-01 00:11:00 +01:00
|
|
|
$out = '';
|
2009-01-14 15:18:51 +01:00
|
|
|
|
|
|
|
$wp_scripts = new WP_Scripts();
|
2017-12-01 00:11:00 +01:00
|
|
|
wp_default_scripts( $wp_scripts );
|
2018-12-17 04:15:20 +01:00
|
|
|
wp_default_packages_vendor( $wp_scripts );
|
|
|
|
wp_default_packages_scripts( $wp_scripts );
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2016-01-15 11:23:25 +01:00
|
|
|
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
|
|
|
|
header( "$protocol 304 Not Modified" );
|
2020-05-26 11:37:10 +02:00
|
|
|
exit;
|
2016-01-15 11:23:25 +01:00
|
|
|
}
|
|
|
|
|
2015-08-25 22:28:22 +02:00
|
|
|
foreach ( $load as $handle ) {
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) {
|
2009-01-14 15:18:51 +01:00
|
|
|
continue;
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$path = ABSPATH . $wp_scripts->registered[ $handle ]->src;
|
|
|
|
$out .= get_file( $path ) . "\n";
|
2009-01-14 15:18:51 +01:00
|
|
|
}
|
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
header( "Etag: $wp_version" );
|
|
|
|
header( 'Content-Type: application/javascript; charset=UTF-8' );
|
|
|
|
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
|
|
|
|
header( "Cache-Control: public, max-age=$expires_offset" );
|
2009-02-01 10:45:24 +01:00
|
|
|
|
2009-01-14 15:18:51 +01:00
|
|
|
echo $out;
|
|
|
|
exit;
|