@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | // WP CLI |
52 | 52 | if ( defined( 'WP_CLI' ) && WP_CLI ) { |
53 | - require_once AUTOPTIMIZE_PLUGIN_DIR . 'classes/autoptimizeCLI.php'; |
|
53 | + require_once AUTOPTIMIZE_PLUGIN_DIR . 'classes/autoptimizeCLI.php'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Initialize the cache at least once |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | $ao_noptimize = true; |
138 | 138 | } |
139 | 139 | |
140 | - // if setting says not to optimize logged in user and user is logged in |
|
141 | - if ( get_option('autoptimize_optimize_logged','on') !== 'on' && is_user_logged_in() && current_user_can('edit_posts') ) { |
|
142 | - $ao_noptimize = true; |
|
143 | - } |
|
144 | - |
|
145 | - // if setting says not to optimize cart/ checkout |
|
146 | - if ( get_option('autoptimize_optimize_checkout','on') !== 'on' ) { |
|
147 | - // checking for woocommerce, easy digital downloads and wp ecommerce |
|
148 | - foreach ( array("is_checkout","is_cart","edd_is_checkout","wpsc_is_cart","wpsc_is_checkout") as $shopCond ) { |
|
149 | - if ( function_exists($shopCond) && $shopCond() ) { |
|
150 | - $ao_noptimize = true; |
|
151 | - break; |
|
152 | - } |
|
153 | - } |
|
154 | - } |
|
140 | + // if setting says not to optimize logged in user and user is logged in |
|
141 | + if ( get_option('autoptimize_optimize_logged','on') !== 'on' && is_user_logged_in() && current_user_can('edit_posts') ) { |
|
142 | + $ao_noptimize = true; |
|
143 | + } |
|
144 | + |
|
145 | + // if setting says not to optimize cart/ checkout |
|
146 | + if ( get_option('autoptimize_optimize_checkout','on') !== 'on' ) { |
|
147 | + // checking for woocommerce, easy digital downloads and wp ecommerce |
|
148 | + foreach ( array("is_checkout","is_cart","edd_is_checkout","wpsc_is_cart","wpsc_is_checkout") as $shopCond ) { |
|
149 | + if ( function_exists($shopCond) && $shopCond() ) { |
|
150 | + $ao_noptimize = true; |
|
151 | + break; |
|
152 | + } |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | 156 | // filter you can use to block autoptimization on your own terms |
157 | 157 | $ao_noptimize = (bool) apply_filters( 'autoptimize_filter_noptimize', $ao_noptimize ); |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
4 | - exit; |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class autoptimizeCLI extends WP_CLI_Command { |
8 | 8 | |
9 | - /** |
|
10 | - * Clears the cache. |
|
11 | - * |
|
12 | - * @subcommand clear |
|
13 | - */ |
|
14 | - public function clear( $args, $args_assoc ) { |
|
15 | - WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) ); |
|
16 | - autoptimizeCache::clearall(); |
|
17 | - WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) ); |
|
18 | - } |
|
9 | + /** |
|
10 | + * Clears the cache. |
|
11 | + * |
|
12 | + * @subcommand clear |
|
13 | + */ |
|
14 | + public function clear( $args, $args_assoc ) { |
|
15 | + WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) ); |
|
16 | + autoptimizeCache::clearall(); |
|
17 | + WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) ); |
|
18 | + } |
|
19 | 19 | |
20 | 20 | } |
21 | 21 |