From 42909161595f34cac359a7e518a9c7b57b38d739 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 18 Feb 2009 23:38:11 +0000 Subject: [PATCH] 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 --- wp-admin/admin-ajax.php | 6 +++--- wp-admin/admin-footer.php | 2 +- wp-includes/functions.php | 14 ++++++++++++++ wp-includes/script-loader.php | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 8f1f768844..41100c6c3f 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -69,7 +69,7 @@ case 'wp-compression-test' : die('-1'); 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'); } @@ -98,9 +98,9 @@ case 'wp-compression-test' : echo $out; die; } elseif ( 'no' == $_GET['test'] ) { - update_option('can_compress_scripts', 0); + update_site_option('can_compress_scripts', 0); } elseif ( 'yes' == $_GET['test'] ) { - update_option('can_compress_scripts', 1); + update_site_option('can_compress_scripts', 1); } } diff --git a/wp-admin/admin-footer.php b/wp-admin/admin-footer.php index a9eedcb879..a368beb7b6 100644 --- a/wp-admin/admin-footer.php +++ b/wp-admin/admin-footer.php @@ -27,7 +27,7 @@ do_action('admin_footer', ''); do_action('admin_print_footer_scripts'); do_action("admin_footer-$hook_suffix"); -if ( false === get_option('can_compress_scripts') ) +if ( false === get_site_option('can_compress_scripts') ) compression_test(); ?> diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 92bd7b0a24..62d85810f1 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2981,5 +2981,19 @@ function wp_clone( $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); +} + ?> diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index b0c44b95d6..ba04ea71ae 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -686,13 +686,13 @@ function script_concat_settings() { if ( ! isset($compress_scripts) ) { $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; } if ( ! isset($compress_css) ) { $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; } }