author | Anthony Ly <anthonyly.com@gmail.com> |
Tue, 12 Mar 2013 18:21:39 +0100 | |
changeset 206 | 919b4ddb13fa |
parent 204 | 09a1c134465b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
||
3 |
/** |
|
4 |
* Disable error reporting |
|
5 |
* |
|
6 |
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging |
|
7 |
*/ |
|
8 |
error_reporting(0); |
|
9 |
||
10 |
/** Set ABSPATH for execution */ |
|
11 |
define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); |
|
12 |
define( 'WPINC', 'wp-includes' ); |
|
13 |
||
14 |
/** |
|
15 |
* @ignore |
|
16 |
*/ |
|
17 |
function __() {} |
|
18 |
||
19 |
/** |
|
20 |
* @ignore |
|
21 |
*/ |
|
22 |
function _x() {} |
|
23 |
||
24 |
/** |
|
25 |
* @ignore |
|
26 |
*/ |
|
27 |
function add_filter() {} |
|
28 |
||
29 |
/** |
|
30 |
* @ignore |
|
31 |
*/ |
|
32 |
function esc_attr() {} |
|
33 |
||
34 |
/** |
|
35 |
* @ignore |
|
36 |
*/ |
|
37 |
function apply_filters() {} |
|
38 |
||
39 |
/** |
|
40 |
* @ignore |
|
41 |
*/ |
|
42 |
function get_option() {} |
|
43 |
||
44 |
/** |
|
45 |
* @ignore |
|
46 |
*/ |
|
47 |
function is_lighttpd_before_150() {} |
|
48 |
||
49 |
/** |
|
50 |
* @ignore |
|
51 |
*/ |
|
52 |
function add_action() {} |
|
53 |
||
54 |
/** |
|
55 |
* @ignore |
|
56 |
*/ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
57 |
function did_action() {} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
58 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
59 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
60 |
* @ignore |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
61 |
*/ |
136 | 62 |
function do_action_ref_array() {} |
63 |
||
64 |
/** |
|
65 |
* @ignore |
|
66 |
*/ |
|
67 |
function get_bloginfo() {} |
|
68 |
||
69 |
/** |
|
70 |
* @ignore |
|
71 |
*/ |
|
72 |
function is_admin() {return true;} |
|
73 |
||
74 |
/** |
|
75 |
* @ignore |
|
76 |
*/ |
|
77 |
function site_url() {} |
|
78 |
||
79 |
/** |
|
80 |
* @ignore |
|
81 |
*/ |
|
82 |
function admin_url() {} |
|
83 |
||
84 |
/** |
|
85 |
* @ignore |
|
86 |
*/ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
87 |
function home_url() {} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
88 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
89 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
90 |
* @ignore |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
91 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
92 |
function includes_url() {} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
93 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
94 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
95 |
* @ignore |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
96 |
*/ |
136 | 97 |
function wp_guess_url() {} |
98 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
99 |
if ( ! function_exists( 'json_encode' ) ) : |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
100 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
101 |
* @ignore |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
102 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
103 |
function json_encode() {} |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
104 |
endif; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
105 |
|
136 | 106 |
function get_file($path) { |
107 |
||
108 |
if ( function_exists('realpath') ) |
|
109 |
$path = realpath($path); |
|
110 |
||
111 |
if ( ! $path || ! @is_file($path) ) |
|
112 |
return ''; |
|
113 |
||
114 |
return @file_get_contents($path); |
|
115 |
} |
|
116 |
||
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
117 |
$load = $_GET['load']; |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
118 |
if ( is_array( $load ) ) |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
119 |
$load = implode( '', $load ); |
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
120 |
|
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
121 |
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load ); |
136 | 122 |
$load = explode(',', $load); |
123 |
||
124 |
if ( empty($load) ) |
|
125 |
exit; |
|
126 |
||
127 |
require(ABSPATH . WPINC . '/script-loader.php'); |
|
128 |
require(ABSPATH . WPINC . '/version.php'); |
|
129 |
||
130 |
$compress = ( isset($_GET['c']) && $_GET['c'] ); |
|
131 |
$force_gzip = ( $compress && 'gzip' == $_GET['c'] ); |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
132 |
$expires_offset = 31536000; // 1 year |
136 | 133 |
$out = ''; |
134 |
||
135 |
$wp_scripts = new WP_Scripts(); |
|
136 |
wp_default_scripts($wp_scripts); |
|
137 |
||
138 |
foreach( $load as $handle ) { |
|
139 |
if ( !array_key_exists($handle, $wp_scripts->registered) ) |
|
140 |
continue; |
|
141 |
||
142 |
$path = ABSPATH . $wp_scripts->registered[$handle]->src; |
|
143 |
$out .= get_file($path) . "\n"; |
|
144 |
} |
|
145 |
||
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"); |
|
149 |
||
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 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
152 |
if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { |
136 | 153 |
header('Content-Encoding: deflate'); |
154 |
$out = gzdeflate( $out, 3 ); |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
155 |
} elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) { |
136 | 156 |
header('Content-Encoding: gzip'); |
157 |
$out = gzencode( $out, 3 ); |
|
158 |
} |
|
159 |
} |
|
160 |
||
161 |
echo $out; |
|
162 |
exit; |