Make can_compress_scripts a site option. Add site option wrappers for WP.

git-svn-id: http://svn.automattic.com/wordpress/trunk@10593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-02-18 23:38:11 +00:00
parent 4073f2b153
commit 4290916159
4 changed files with 20 additions and 6 deletions

View File

@ -69,7 +69,7 @@ case 'wp-compression-test' :
die('-1'); die('-1');
if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) { if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
update_option('can_compress_scripts', 0); update_site_option('can_compress_scripts', 0);
die('0'); die('0');
} }
@ -98,9 +98,9 @@ case 'wp-compression-test' :
echo $out; echo $out;
die; die;
} elseif ( 'no' == $_GET['test'] ) { } elseif ( 'no' == $_GET['test'] ) {
update_option('can_compress_scripts', 0); update_site_option('can_compress_scripts', 0);
} elseif ( 'yes' == $_GET['test'] ) { } elseif ( 'yes' == $_GET['test'] ) {
update_option('can_compress_scripts', 1); update_site_option('can_compress_scripts', 1);
} }
} }

View File

@ -27,7 +27,7 @@ do_action('admin_footer', '');
do_action('admin_print_footer_scripts'); do_action('admin_print_footer_scripts');
do_action("admin_footer-$hook_suffix"); do_action("admin_footer-$hook_suffix");
if ( false === get_option('can_compress_scripts') ) if ( false === get_site_option('can_compress_scripts') )
compression_test(); compression_test();
?> ?>

View File

@ -2981,5 +2981,19 @@ function wp_clone( $object ) {
return $can_clone ? clone( $object ) : $object; return $can_clone ? clone( $object ) : $object;
} }
function get_site_option( $key, $default = false, $use_cache = true ) {
return get_option($key, $default);
}
// expects $key, $value not to be SQL escaped
function add_site_option( $key, $value ) {
return add_option($key, $value);
}
// expects $key, $value not to be SQL escaped
function update_site_option( $key, $value ) {
return update_option($key, $value);
}
?> ?>

View File

@ -686,13 +686,13 @@ function script_concat_settings() {
if ( ! isset($compress_scripts) ) { if ( ! isset($compress_scripts) ) {
$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
if ( $compress_scripts && ( ! get_option('can_compress_scripts') || $compressed_output ) ) if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
$compress_scripts = false; $compress_scripts = false;
} }
if ( ! isset($compress_css) ) { if ( ! isset($compress_css) ) {
$compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;
if ( $compress_css && ( ! get_option('can_compress_scripts') || $compressed_output ) ) if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
$compress_css = false; $compress_css = false;
} }
} }