2009-01-14 09:18:51 -05:00
|
|
|
<?php
|
|
|
|
|
2009-04-20 14:18:39 -04:00
|
|
|
/**
|
2009-04-15 15:55:41 -04:00
|
|
|
* Disable error reporting
|
2009-04-20 14:18:39 -04:00
|
|
|
*
|
2014-07-07 12:42:16 -04:00
|
|
|
* Set this to error_reporting( -1 ) for debugging.
|
2009-04-15 15:55:41 -04:00
|
|
|
*/
|
2017-11-30 18:11:00 -05:00
|
|
|
error_reporting( 0 );
|
2009-04-15 15:55:41 -04:00
|
|
|
|
2009-01-14 09:18:51 -05:00
|
|
|
/** Set ABSPATH for execution */
|
2016-04-14 13:53:28 -04:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
|
|
|
|
}
|
|
|
|
|
2009-04-04 23:32:49 -04:00
|
|
|
define( 'WPINC', 'wp-includes' );
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2012-12-05 13:57:56 -05:00
|
|
|
$load = $_GET['load'];
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( is_array( $load ) ) {
|
2012-12-05 13:57:56 -05:00
|
|
|
$load = implode( '', $load );
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2012-12-05 13:57:56 -05:00
|
|
|
|
|
|
|
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
|
2013-07-29 13:57:04 -04:00
|
|
|
$load = array_unique( explode( ',', $load ) );
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( empty( $load ) ) {
|
2009-01-14 09:18:51 -05:00
|
|
|
exit;
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2015-09-11 01:04:23 -04:00
|
|
|
require( ABSPATH . 'wp-admin/includes/noop.php' );
|
|
|
|
require( ABSPATH . WPINC . '/script-loader.php' );
|
|
|
|
require( ABSPATH . WPINC . '/version.php' );
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$compress = ( isset( $_GET['c'] ) && $_GET['c'] );
|
|
|
|
$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
|
2012-11-10 13:13:09 -05:00
|
|
|
$expires_offset = 31536000; // 1 year
|
2017-11-30 18:11:00 -05:00
|
|
|
$out = '';
|
2009-01-14 09:18:51 -05:00
|
|
|
|
|
|
|
$wp_scripts = new WP_Scripts();
|
2017-11-30 18:11:00 -05:00
|
|
|
wp_default_scripts( $wp_scripts );
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2016-01-15 05:23:25 -05:00
|
|
|
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
|
|
|
|
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
|
|
|
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
|
|
|
|
$protocol = 'HTTP/1.0';
|
|
|
|
}
|
|
|
|
header( "$protocol 304 Not Modified" );
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2015-08-25 16:28:22 -04:00
|
|
|
foreach ( $load as $handle ) {
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! array_key_exists( $handle, $wp_scripts->registered ) ) {
|
2009-01-14 09:18:51 -05:00
|
|
|
continue;
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$path = ABSPATH . $wp_scripts->registered[ $handle ]->src;
|
|
|
|
$out .= get_file( $path ) . "\n";
|
2009-01-14 09:18:51 -05:00
|
|
|
}
|
|
|
|
|
2017-11-30 18:11:00 -05: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 04:45:24 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( $compress && ! ini_get( 'zlib.output_compression' ) && 'ob_gzhandler' != ini_get( 'output_handler' ) && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
|
|
|
|
header( 'Vary: Accept-Encoding' ); // Handle proxies
|
|
|
|
if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) {
|
|
|
|
header( 'Content-Encoding: deflate' );
|
2009-01-26 07:59:10 -05:00
|
|
|
$out = gzdeflate( $out, 3 );
|
2017-11-30 18:11:00 -05:00
|
|
|
} elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) {
|
|
|
|
header( 'Content-Encoding: gzip' );
|
2009-01-14 09:18:51 -05:00
|
|
|
$out = gzencode( $out, 3 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $out;
|
|
|
|
exit;
|