1 <?php |
1 <?php |
2 |
2 |
3 /** |
3 /** |
4 * Disable error reporting |
4 * Disable error reporting |
5 * |
5 * |
6 * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging |
6 * Set this to error_reporting( -1 ) for debugging |
7 */ |
7 */ |
8 error_reporting(0); |
8 error_reporting(0); |
9 |
9 |
10 /** Set ABSPATH for execution */ |
10 /** Set ABSPATH for execution */ |
11 define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); |
11 define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); |
90 return ''; |
90 return ''; |
91 |
91 |
92 return @file_get_contents($path); |
92 return @file_get_contents($path); |
93 } |
93 } |
94 |
94 |
95 require(ABSPATH . '/wp-includes/script-loader.php'); |
95 require( ABSPATH . WPINC . '/script-loader.php' ); |
96 require(ABSPATH . '/wp-includes/version.php'); |
96 require( ABSPATH . WPINC . '/version.php' ); |
97 |
97 |
98 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] ); |
98 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] ); |
99 $load = array_unique( explode( ',', $load ) ); |
99 $load = array_unique( explode( ',', $load ) ); |
100 |
100 |
101 if ( empty($load) ) |
101 if ( empty($load) ) |
115 continue; |
115 continue; |
116 |
116 |
117 $style = $wp_styles->registered[$handle]; |
117 $style = $wp_styles->registered[$handle]; |
118 $path = ABSPATH . $style->src; |
118 $path = ABSPATH . $style->src; |
119 |
119 |
120 $content = get_file($path) . "\n"; |
120 if ( $rtl && ! empty( $style->extra['rtl'] ) ) { |
121 |
121 // All default styles have fully independent RTL files. |
122 if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) { |
122 $path = str_replace( '.min.css', '-rtl.min.css', $path ); |
123 $rtl_path = is_bool($style->extra['rtl']) ? str_replace( '.min.css', '-rtl.min.css', $path ) : ABSPATH . $style->extra['rtl']; |
|
124 $content .= get_file($rtl_path) . "\n"; |
|
125 } |
123 } |
126 |
124 |
127 if ( strpos( $style->src, '/wp-includes/css/' ) === 0 ) { |
125 $content = get_file( $path ) . "\n"; |
128 $content = str_replace( '../images/', '../wp-includes/images/', $content ); |
126 |
129 $out .= str_replace( '../js/tinymce/', '../wp-includes/js/tinymce/', $content ); |
127 if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) { |
|
128 $content = str_replace( '../images/', '../' . WPINC . '/images/', $content ); |
|
129 $content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content ); |
|
130 $content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content ); |
|
131 $out .= $content; |
130 } else { |
132 } else { |
131 $out .= str_replace( '../images/', 'images/', $content ); |
133 $out .= str_replace( '../images/', 'images/', $content ); |
132 } |
134 } |
133 } |
135 } |
134 |
136 |
135 header('Content-Type: text/css'); |
137 header('Content-Type: text/css; charset=UTF-8'); |
136 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); |
138 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); |
137 header("Cache-Control: public, max-age=$expires_offset"); |
139 header("Cache-Control: public, max-age=$expires_offset"); |
138 |
140 |
139 if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { |
141 if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { |
140 header('Vary: Accept-Encoding'); // Handle proxies |
142 header('Vary: Accept-Encoding'); // Handle proxies |