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' );
27 function add_filter() {}
32 function esc_attr() {}
37 function apply_filters() {}
42 function get_option() {}
47 function is_lighttpd_before_150() {}
52 function add_action() {}
57 function did_action() {}
62 function do_action_ref_array() {}
67 function get_bloginfo() {}
72 function is_admin() {return true;}
77 function site_url() {}
82 function admin_url() {}
87 function home_url() {}
92 function includes_url() {}
97 function wp_guess_url() {}
99 if ( ! function_exists( 'json_encode' ) ) :
103 function json_encode() {}
106 function get_file($path) {
108 if ( function_exists('realpath') )
109 $path = realpath($path);
111 if ( ! $path || ! @is_file($path) )
114 return @file_get_contents($path);
117 $load = $_GET['load'];
118 if ( is_array( $load ) )
119 $load = implode( '', $load );
121 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
122 $load = array_unique( explode( ',', $load ) );
127 require(ABSPATH . WPINC . '/script-loader.php');
128 require(ABSPATH . WPINC . '/version.php');
130 $compress = ( isset($_GET['c']) && $_GET['c'] );
131 $force_gzip = ( $compress && 'gzip' == $_GET['c'] );
132 $expires_offset = 31536000; // 1 year
135 $wp_scripts = new WP_Scripts();
136 wp_default_scripts($wp_scripts);
138 foreach( $load as $handle ) {
139 if ( !array_key_exists($handle, $wp_scripts->registered) )
142 $path = ABSPATH . $wp_scripts->registered[$handle]->src;
143 $out .= get_file($path) . "\n";
146 header('Content-Type: application/x-javascript; charset=UTF-8');
147 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
148 header("Cache-Control: public, max-age=$expires_offset");
150 if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
151 header('Vary: Accept-Encoding'); // Handle proxies
152 if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
153 header('Content-Encoding: deflate');
154 $out = gzdeflate( $out, 3 );
155 } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
156 header('Content-Encoding: gzip');
157 $out = gzencode( $out, 3 );