4 * Disable error reporting
6 * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
10 /** Set ABSPATH for execution */
11 define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
12 define( 'WPINC', 'wp-includes' );
33 function add_filter() {}
38 function esc_attr() {}
43 function apply_filters() {}
48 function get_option() {}
53 function is_lighttpd_before_150() {}
58 function add_action() {}
63 function do_action_ref_array() {}
68 function get_bloginfo() {}
73 function is_admin() {return true;}
78 function site_url() {}
83 function admin_url() {}
88 function wp_guess_url() {}
90 function get_file($path) {
92 if ( function_exists('realpath') )
93 $path = realpath($path);
95 if ( ! $path || ! @is_file($path) )
98 return @file_get_contents($path);
101 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
102 $load = explode(',', $load);
107 require(ABSPATH . WPINC . '/script-loader.php');
108 require(ABSPATH . WPINC . '/version.php');
110 $compress = ( isset($_GET['c']) && $_GET['c'] );
111 $force_gzip = ( $compress && 'gzip' == $_GET['c'] );
112 $expires_offset = 31536000;
115 $wp_scripts = new WP_Scripts();
116 wp_default_scripts($wp_scripts);
118 foreach( $load as $handle ) {
119 if ( !array_key_exists($handle, $wp_scripts->registered) )
122 $path = ABSPATH . $wp_scripts->registered[$handle]->src;
123 $out .= get_file($path) . "\n";
126 header('Content-Type: application/x-javascript; charset=UTF-8');
127 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
128 header("Cache-Control: public, max-age=$expires_offset");
130 if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
131 header('Vary: Accept-Encoding'); // Handle proxies
132 if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
133 header('Content-Encoding: deflate');
134 $out = gzdeflate( $out, 3 );
135 } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
136 header('Content-Encoding: gzip');
137 $out = gzencode( $out, 3 );