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
|
|
|
*/
|
|
|
|
error_reporting(0);
|
|
|
|
|
2009-01-14 09:18:51 -05:00
|
|
|
/** Set ABSPATH for execution */
|
2009-04-04 23:32:49 -04:00
|
|
|
define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
|
|
|
|
define( 'WPINC', 'wp-includes' );
|
2009-01-14 09:18:51 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function __() {}
|
|
|
|
|
2009-03-12 23:53:39 -04:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function _x() {}
|
|
|
|
|
2009-01-14 09:18:51 -05:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function add_filter() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2009-05-05 15:43:53 -04:00
|
|
|
function esc_attr() {}
|
2009-01-14 09:18:51 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function apply_filters() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function get_option() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function is_lighttpd_before_150() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function add_action() {}
|
|
|
|
|
2012-06-26 01:33:19 -04:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function did_action() {}
|
|
|
|
|
2009-01-14 09:18:51 -05:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function do_action_ref_array() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function get_bloginfo() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function is_admin() {return true;}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function site_url() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function admin_url() {}
|
|
|
|
|
2010-05-04 13:08:28 -04:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function home_url() {}
|
|
|
|
|
2011-04-05 20:42:07 -04:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function includes_url() {}
|
|
|
|
|
2009-01-14 09:18:51 -05:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function wp_guess_url() {}
|
|
|
|
|
2011-12-14 18:02:42 -05:00
|
|
|
if ( ! function_exists( 'json_encode' ) ) :
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function json_encode() {}
|
|
|
|
endif;
|
|
|
|
|
2009-01-14 09:18:51 -05:00
|
|
|
function get_file($path) {
|
|
|
|
|
|
|
|
if ( function_exists('realpath') )
|
|
|
|
$path = realpath($path);
|
|
|
|
|
|
|
|
if ( ! $path || ! @is_file($path) )
|
|
|
|
return '';
|
|
|
|
|
|
|
|
return @file_get_contents($path);
|
|
|
|
}
|
|
|
|
|
2012-12-05 13:57:56 -05:00
|
|
|
$load = $_GET['load'];
|
|
|
|
if ( is_array( $load ) )
|
|
|
|
$load = implode( '', $load );
|
|
|
|
|
|
|
|
$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
|
|
|
|
|
|
|
if ( empty($load) )
|
|
|
|
exit;
|
|
|
|
|
2009-04-04 23:32:49 -04:00
|
|
|
require(ABSPATH . WPINC . '/script-loader.php');
|
|
|
|
require(ABSPATH . WPINC . '/version.php');
|
2009-01-14 09:18:51 -05:00
|
|
|
|
2009-01-26 07:59:10 -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
|
2009-01-14 09:18:51 -05:00
|
|
|
$out = '';
|
|
|
|
|
|
|
|
$wp_scripts = new WP_Scripts();
|
|
|
|
wp_default_scripts($wp_scripts);
|
|
|
|
|
|
|
|
foreach( $load as $handle ) {
|
|
|
|
if ( !array_key_exists($handle, $wp_scripts->registered) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
$path = ABSPATH . $wp_scripts->registered[$handle]->src;
|
|
|
|
$out .= get_file($path) . "\n";
|
|
|
|
}
|
|
|
|
|
2015-01-02 21:57:21 -05:00
|
|
|
header('Content-Type: application/javascript; charset=UTF-8');
|
2009-01-14 09:18:51 -05:00
|
|
|
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
|
|
|
|
2009-11-19 04:46:07 -05:00
|
|
|
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
|
2009-01-17 09:08:15 -05:00
|
|
|
header('Vary: Accept-Encoding'); // Handle proxies
|
2011-04-11 14:55:11 -04:00
|
|
|
if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
|
2009-01-26 07:59:10 -05:00
|
|
|
header('Content-Encoding: deflate');
|
|
|
|
$out = gzdeflate( $out, 3 );
|
2011-04-11 14:55:11 -04:00
|
|
|
} elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
|
2009-01-14 09:18:51 -05:00
|
|
|
header('Content-Encoding: gzip');
|
|
|
|
$out = gzencode( $out, 3 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $out;
|
|
|
|
exit;
|