source: trunk/www.guidonia.net/wp/wp-admin/load-scripts.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 2.5 KB
Line 
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 */
8error_reporting(0);
9
10/** Set ABSPATH for execution */
11define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
12define( 'WPINC', 'wp-includes' );
13
14/**
15 * @ignore
16 */
17function __() {}
18
19/**
20 * @ignore
21 */
22function _c() {}
23
24/**
25 * @ignore
26 */
27function _x() {}
28
29
30/**
31 * @ignore
32 */
33function add_filter() {}
34
35/**
36 * @ignore
37 */
38function esc_attr() {}
39
40/**
41 * @ignore
42 */
43function apply_filters() {}
44
45/**
46 * @ignore
47 */
48function get_option() {}
49
50/**
51 * @ignore
52 */
53function is_lighttpd_before_150() {}
54
55/**
56 * @ignore
57 */
58function add_action() {}
59
60/**
61 * @ignore
62 */
63function do_action_ref_array() {}
64
65/**
66 * @ignore
67 */
68function get_bloginfo() {}
69
70/**
71 * @ignore
72 */
73function is_admin() {return true;}
74
75/**
76 * @ignore
77 */
78function site_url() {}
79
80/**
81 * @ignore
82 */
83function admin_url() {}
84
85/**
86 * @ignore
87 */
88function wp_guess_url() {}
89
90function get_file($path) {
91
92 if ( function_exists('realpath') )
93 $path = realpath($path);
94
95 if ( ! $path || ! @is_file($path) )
96 return '';
97
98 return @file_get_contents($path);
99}
100
101$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
102$load = explode(',', $load);
103
104if ( empty($load) )
105 exit;
106
107require(ABSPATH . WPINC . '/script-loader.php');
108require(ABSPATH . WPINC . '/version.php');
109
110$compress = ( isset($_GET['c']) && $_GET['c'] );
111$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
112$expires_offset = 31536000;
113$out = '';
114
115$wp_scripts = new WP_Scripts();
116wp_default_scripts($wp_scripts);
117
118foreach( $load as $handle ) {
119 if ( !array_key_exists($handle, $wp_scripts->registered) )
120 continue;
121
122 $path = ABSPATH . $wp_scripts->registered[$handle]->src;
123 $out .= get_file($path) . "\n";
124}
125
126header('Content-Type: application/x-javascript; charset=UTF-8');
127header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
128header("Cache-Control: public, max-age=$expires_offset");
129
130if ( $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 );
138 }
139}
140
141echo $out;
142exit;
Note: See TracBrowser for help on using the repository browser.