2009-01-14 15:18:51 +01:00
|
|
|
<?php
|
|
|
|
|
2009-04-20 20:18:39 +02:00
|
|
|
/**
|
2009-04-15 21:55:41 +02:00
|
|
|
* Disable error reporting
|
2009-04-20 20:18:39 +02:00
|
|
|
*
|
2014-07-03 21:57:14 +02:00
|
|
|
* Set this to error_reporting( -1 ) for debugging
|
2009-04-15 21:55:41 +02:00
|
|
|
*/
|
|
|
|
error_reporting(0);
|
|
|
|
|
2009-01-14 15:18:51 +01:00
|
|
|
/** Set ABSPATH for execution */
|
2009-04-05 05:32:49 +02:00
|
|
|
define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
|
|
|
|
define( 'WPINC', 'wp-includes' );
|
2009-01-14 15:18:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function __() {}
|
|
|
|
|
2009-03-13 04:53:39 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function _x() {}
|
|
|
|
|
2009-01-14 15:18:51 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function add_filter() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2009-05-05 21:43:53 +02:00
|
|
|
function esc_attr() {}
|
2009-01-14 15:18:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function apply_filters() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function get_option() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function is_lighttpd_before_150() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function add_action() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function do_action_ref_array() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function get_bloginfo() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function is_admin() {return true;}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function site_url() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function admin_url() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
function wp_guess_url() {}
|
|
|
|
|
|
|
|
function get_file($path) {
|
|
|
|
|
|
|
|
if ( function_exists('realpath') )
|
|
|
|
$path = realpath($path);
|
|
|
|
|
|
|
|
if ( ! $path || ! @is_file($path) )
|
|
|
|
return '';
|
|
|
|
|
|
|
|
return @file_get_contents($path);
|
|
|
|
}
|
|
|
|
|
2014-06-30 00:21:15 +02:00
|
|
|
require( ABSPATH . WPINC . '/script-loader.php' );
|
|
|
|
require( ABSPATH . WPINC . '/version.php' );
|
2009-01-14 15:18:51 +01:00
|
|
|
|
2009-02-01 10:45:24 +01:00
|
|
|
$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
|
2013-07-29 19:57:04 +02:00
|
|
|
$load = array_unique( explode( ',', $load ) );
|
2009-01-14 15:18:51 +01:00
|
|
|
|
|
|
|
if ( empty($load) )
|
|
|
|
exit;
|
|
|
|
|
2009-01-26 13:59:10 +01:00
|
|
|
$compress = ( isset($_GET['c']) && $_GET['c'] );
|
|
|
|
$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
|
|
|
|
$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
|
2012-11-10 19:13:09 +01:00
|
|
|
$expires_offset = 31536000; // 1 year
|
2009-01-14 15:18:51 +01:00
|
|
|
$out = '';
|
|
|
|
|
|
|
|
$wp_styles = new WP_Styles();
|
|
|
|
wp_default_styles($wp_styles);
|
|
|
|
|
|
|
|
foreach( $load as $handle ) {
|
|
|
|
if ( !array_key_exists($handle, $wp_styles->registered) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
$style = $wp_styles->registered[$handle];
|
|
|
|
$path = ABSPATH . $style->src;
|
|
|
|
|
2013-11-13 06:10:10 +01:00
|
|
|
if ( $rtl && ! empty( $style->extra['rtl'] ) ) {
|
|
|
|
// All default styles have fully independent RTL files.
|
|
|
|
$path = str_replace( '.min.css', '-rtl.min.css', $path );
|
2009-01-14 15:18:51 +01:00
|
|
|
}
|
|
|
|
|
2013-11-13 06:10:10 +01:00
|
|
|
$content = get_file( $path ) . "\n";
|
|
|
|
|
2014-06-30 00:21:15 +02:00
|
|
|
if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) {
|
|
|
|
$content = str_replace( '../images/', '../' . WPINC . '/images/', $content );
|
|
|
|
$content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content );
|
|
|
|
$content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content );
|
2013-11-26 02:47:10 +01:00
|
|
|
$out .= $content;
|
2011-08-04 01:56:21 +02:00
|
|
|
} else {
|
2011-07-25 02:36:06 +02:00
|
|
|
$out .= str_replace( '../images/', 'images/', $content );
|
2011-08-04 01:56:21 +02:00
|
|
|
}
|
2009-01-14 15:18:51 +01:00
|
|
|
}
|
|
|
|
|
2014-02-25 02:28:15 +01:00
|
|
|
header('Content-Type: text/css; charset=UTF-8');
|
2009-01-14 15:18:51 +01:00
|
|
|
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
|
|
|
|
header("Cache-Control: public, max-age=$expires_offset");
|
2009-02-01 10:45:24 +01:00
|
|
|
|
2009-11-19 10:46:07 +01:00
|
|
|
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
|
2009-01-17 15:08:15 +01:00
|
|
|
header('Vary: Accept-Encoding'); // Handle proxies
|
2011-04-11 20:55:11 +02:00
|
|
|
if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
|
2009-01-26 13:59:10 +01:00
|
|
|
header('Content-Encoding: deflate');
|
|
|
|
$out = gzdeflate( $out, 3 );
|
2011-04-11 20:55:11 +02:00
|
|
|
} elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
|
2009-01-14 15:18:51 +01:00
|
|
|
header('Content-Encoding: gzip');
|
|
|
|
$out = gzencode( $out, 3 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $out;
|
|
|
|
exit;
|