@@ -3,24 +3,24 @@ discard block |
||
3 | 3 | Classlessly add a "more tools" tab to promote (future) AO addons and/ or affiliate services |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
6 | +if (!defined('ABSPATH')) exit; // Exit if accessed directly |
|
7 | 7 | |
8 | 8 | add_action('admin_init', 'ao_partner_tabs_preinit'); |
9 | 9 | function ao_partner_tabs_preinit() { |
10 | - if (apply_filters('autoptimize_filter_show_partner_tabs',true)) { |
|
11 | - add_filter('autoptimize_filter_settingsscreen_tabs','ao_add_partner_tabs'); |
|
10 | + if (apply_filters('autoptimize_filter_show_partner_tabs', true)) { |
|
11 | + add_filter('autoptimize_filter_settingsscreen_tabs', 'ao_add_partner_tabs'); |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | 15 | function ao_add_partner_tabs($in) { |
16 | - $in=array_merge($in,array('ao_partners' => __('Optimize More!','autoptimize'))); |
|
16 | + $in = array_merge($in, array('ao_partners' => __('Optimize More!', 'autoptimize'))); |
|
17 | 17 | return $in; |
18 | 18 | } |
19 | 19 | |
20 | -add_action('admin_menu','ao_partners_init'); |
|
20 | +add_action('admin_menu', 'ao_partners_init'); |
|
21 | 21 | function ao_partners_init() { |
22 | - if (apply_filters('autoptimize_filter_show_partner_tabs',true)) { |
|
23 | - $hook=add_submenu_page(NULL,'AO partner','AO partner','manage_options','ao_partners','ao_partners'); |
|
22 | + if (apply_filters('autoptimize_filter_show_partner_tabs', true)) { |
|
23 | + $hook = add_submenu_page(NULL, 'AO partner', 'AO partner', 'manage_options', 'ao_partners', 'ao_partners'); |
|
24 | 24 | // register_settings here as well if needed |
25 | 25 | } |
26 | 26 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | } |
72 | 72 | </style> |
73 | 73 | <div class="wrap"> |
74 | - <h1><?php _e('Autoptimize Settings','autoptimize'); ?></h1> |
|
74 | + <h1><?php _e('Autoptimize Settings', 'autoptimize'); ?></h1> |
|
75 | 75 | <?php echo autoptimizeConfig::ao_admin_tabs(); ?> |
76 | 76 | <?php |
77 | - echo '<h2>'. __("These Autoptimize power-ups and related services will improve your site's performance even more!",'autoptimize') . '</h2>'; |
|
77 | + echo '<h2>'.__("These Autoptimize power-ups and related services will improve your site's performance even more!", 'autoptimize').'</h2>'; |
|
78 | 78 | ?> |
79 | 79 | <div> |
80 | 80 | <?php getAOPartnerFeed(); ?> |
@@ -84,32 +84,32 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | function getAOPartnerFeed() { |
87 | - $noFeedText=__( 'Have a look at <a href="http://optimizingmatters.com/">optimizingmatters.com</a> for Autoptimize power-ups!', 'autoptimize' ); |
|
87 | + $noFeedText = __('Have a look at <a href="http://optimizingmatters.com/">optimizingmatters.com</a> for Autoptimize power-ups!', 'autoptimize'); |
|
88 | 88 | |
89 | - if (apply_filters('autoptimize_settingsscreen_remotehttp',true)) { |
|
90 | - $rss = fetch_feed( "http://feeds.feedburner.com/OptimizingMattersDownloads" ); |
|
89 | + if (apply_filters('autoptimize_settingsscreen_remotehttp', true)) { |
|
90 | + $rss = fetch_feed("http://feeds.feedburner.com/OptimizingMattersDownloads"); |
|
91 | 91 | $maxitems = 0; |
92 | 92 | |
93 | - if ( ! is_wp_error( $rss ) ) { |
|
94 | - $maxitems = $rss->get_item_quantity( 20 ); |
|
95 | - $rss_items = $rss->get_items( 0, $maxitems ); |
|
93 | + if (!is_wp_error($rss)) { |
|
94 | + $maxitems = $rss->get_item_quantity(20); |
|
95 | + $rss_items = $rss->get_items(0, $maxitems); |
|
96 | 96 | } ?> |
97 | 97 | <ul> |
98 | 98 | <?php |
99 | - if ( $maxitems == 0 ) { |
|
99 | + if ($maxitems == 0) { |
|
100 | 100 | echo $noFeedText; |
101 | 101 | } else { |
102 | - foreach ( $rss_items as $item ) : |
|
103 | - $itemURL = esc_url( $item->get_permalink() ); ?> |
|
102 | + foreach ($rss_items as $item) : |
|
103 | + $itemURL = esc_url($item->get_permalink()); ?> |
|
104 | 104 | <li class="itemDetail"> |
105 | - <h3 class="itemTitle"><a href="<?php echo $itemURL; ?>" target="_blank"><?php echo esc_html( $item->get_title() ); ?></a></h3> |
|
105 | + <h3 class="itemTitle"><a href="<?php echo $itemURL; ?>" target="_blank"><?php echo esc_html($item->get_title()); ?></a></h3> |
|
106 | 106 | <?php |
107 | - if (($enclosure = $item->get_enclosure()) && (strpos($enclosure->get_type(),"image")!==false) ) { |
|
108 | - $itemImgURL=esc_url($enclosure->get_link()); |
|
107 | + if (($enclosure = $item->get_enclosure()) && (strpos($enclosure->get_type(), "image") !== false)) { |
|
108 | + $itemImgURL = esc_url($enclosure->get_link()); |
|
109 | 109 | echo "<div class=\"itemImage\"><a href=\"".$itemURL."\" target=\"_blank\"><img src=\"".$itemImgURL."\"/></a></div>"; |
110 | 110 | } |
111 | 111 | ?> |
112 | - <div class="itemDescription"><?php echo wp_kses_post($item -> get_description() ); ?></div> |
|
112 | + <div class="itemDescription"><?php echo wp_kses_post($item -> get_description()); ?></div> |
|
113 | 113 | <div class="itemButtonRow"><div class="itemButton button-secondary"><a href="<?php echo $itemURL; ?>" target="_blank">More info</a></div></div> |
114 | 114 | </li> |
115 | 115 | <?php endforeach; ?> |
@@ -3,7 +3,10 @@ |
||
3 | 3 | Classlessly add a "more tools" tab to promote (future) AO addons and/ or affiliate services |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
6 | +if ( ! defined( 'ABSPATH' ) ) { |
|
7 | + exit; |
|
8 | +} |
|
9 | +// Exit if accessed directly |
|
7 | 10 | |
8 | 11 | add_action('admin_init', 'ao_partner_tabs_preinit'); |
9 | 12 | function ao_partner_tabs_preinit() { |
@@ -2,55 +2,55 @@ |
||
2 | 2 | // flush as many page cache plugin's caches as possible |
3 | 3 | // hyper cache and gator cache hook into AO, so we don't need to :-) |
4 | 4 | |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
5 | +if (!defined('ABSPATH')) exit; // Exit if accessed directly |
|
6 | 6 | |
7 | 7 | function autoptimize_flush_pagecache() { |
8 | - if(function_exists('wp_cache_clear_cache')) { |
|
8 | + if (function_exists('wp_cache_clear_cache')) { |
|
9 | 9 | if (is_multisite()) { |
10 | 10 | $blog_id = get_current_blog_id(); |
11 | 11 | wp_cache_clear_cache($blog_id); |
12 | 12 | } else { |
13 | 13 | wp_cache_clear_cache(); |
14 | 14 | } |
15 | - } else if ( has_action('cachify_flush_cache') ) { |
|
15 | + } else if (has_action('cachify_flush_cache')) { |
|
16 | 16 | do_action('cachify_flush_cache'); |
17 | - } else if ( function_exists('w3tc_pgcache_flush') ) { |
|
17 | + } else if (function_exists('w3tc_pgcache_flush')) { |
|
18 | 18 | w3tc_pgcache_flush(); |
19 | - } else if ( function_exists('wp_fast_cache_bulk_delete_all') ) { |
|
19 | + } else if (function_exists('wp_fast_cache_bulk_delete_all')) { |
|
20 | 20 | wp_fast_cache_bulk_delete_all(); // still to retest |
21 | 21 | } else if (class_exists("WpFastestCache")) { |
22 | 22 | $wpfc = new WpFastestCache(); |
23 | 23 | $wpfc -> deleteCache(); |
24 | - } else if ( class_exists("c_ws_plugin__qcache_purging_routines") ) { |
|
24 | + } else if (class_exists("c_ws_plugin__qcache_purging_routines")) { |
|
25 | 25 | c_ws_plugin__qcache_purging_routines::purge_cache_dir(); // quick cache, still to retest |
26 | - } else if ( class_exists("zencache") ) { |
|
26 | + } else if (class_exists("zencache")) { |
|
27 | 27 | zencache::clear(); |
28 | - } else if ( class_exists("comet_cache") ) { |
|
28 | + } else if (class_exists("comet_cache")) { |
|
29 | 29 | comet_cache::clear(); |
30 | - } else if ( class_exists("WpeCommon") ) { |
|
31 | - if ( apply_filters('autoptimize_flush_wpengine_aggressive', false) ) { |
|
32 | - if ( method_exists( "WpeCommon", "purge_memcached" ) ) { |
|
30 | + } else if (class_exists("WpeCommon")) { |
|
31 | + if (apply_filters('autoptimize_flush_wpengine_aggressive', false)) { |
|
32 | + if (method_exists("WpeCommon", "purge_memcached")) { |
|
33 | 33 | WpeCommon::purge_memcached(); |
34 | 34 | } |
35 | - if ( method_exists( "WpeCommon", "clear_maxcdn_cache" ) ) { |
|
35 | + if (method_exists("WpeCommon", "clear_maxcdn_cache")) { |
|
36 | 36 | WpeCommon::clear_maxcdn_cache(); |
37 | 37 | } |
38 | 38 | } |
39 | - if ( method_exists( "WpeCommon", "purge_varnish_cache" ) ) { |
|
39 | + if (method_exists("WpeCommon", "purge_varnish_cache")) { |
|
40 | 40 | WpeCommon::purge_varnish_cache(); |
41 | 41 | } |
42 | - } else if ( function_exists('sg_cachepress_purge_cache') ) { |
|
42 | + } else if (function_exists('sg_cachepress_purge_cache')) { |
|
43 | 43 | sg_cachepress_purge_cache(); |
44 | - } else if(file_exists(WP_CONTENT_DIR.'/wp-cache-config.php') && function_exists('prune_super_cache')){ |
|
44 | + } else if (file_exists(WP_CONTENT_DIR.'/wp-cache-config.php') && function_exists('prune_super_cache')) { |
|
45 | 45 | // fallback for WP-Super-Cache |
46 | 46 | global $cache_path; |
47 | 47 | if (is_multisite()) { |
48 | 48 | $blog_id = get_current_blog_id(); |
49 | - prune_super_cache( get_supercache_dir( $blog_id ), true ); |
|
50 | - prune_super_cache( $cache_path . 'blogs/', true ); |
|
49 | + prune_super_cache(get_supercache_dir($blog_id), true); |
|
50 | + prune_super_cache($cache_path.'blogs/', true); |
|
51 | 51 | } else { |
52 | - prune_super_cache($cache_path.'supercache/',true); |
|
53 | - prune_super_cache($cache_path,true); |
|
52 | + prune_super_cache($cache_path.'supercache/', true); |
|
53 | + prune_super_cache($cache_path, true); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | 57 | \ No newline at end of file |
@@ -2,7 +2,10 @@ |
||
2 | 2 | // flush as many page cache plugin's caches as possible |
3 | 3 | // hyper cache and gator cache hook into AO, so we don't need to :-) |
4 | 4 | |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
5 | +if ( ! defined( 'ABSPATH' ) ) { |
|
6 | + exit; |
|
7 | +} |
|
8 | +// Exit if accessed directly |
|
6 | 9 | |
7 | 10 | function autoptimize_flush_pagecache() { |
8 | 11 | if(function_exists('wp_cache_clear_cache')) { |
@@ -88,13 +88,13 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | function ao_css_speedup_cleanup($cssin) { |
91 | - // speedupper results in aggregated CSS not being minified, so the filestart-marker AO adds when aggregating need to be removed |
|
92 | - return trim(str_replace(array('/*FILESTART*/','/*FILESTART2*/'),'',$cssin)); |
|
91 | + // speedupper results in aggregated CSS not being minified, so the filestart-marker AO adds when aggregating need to be removed |
|
92 | + return trim(str_replace(array('/*FILESTART*/','/*FILESTART2*/'),'',$cssin)); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | function ao_js_speedup_cleanup($jsin) { |
96 | - // cleanup |
|
97 | - return trim($jsin); |
|
96 | + // cleanup |
|
97 | + return trim($jsin); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | add_filter('autoptimize_css_individual_style','ao_css_snippetcacher',10,2); |
@@ -4,64 +4,64 @@ discard block |
||
4 | 4 | * new in Autoptimize 2.2 |
5 | 5 | */ |
6 | 6 | |
7 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
7 | +if (!defined('ABSPATH')) exit; // Exit if accessed directly |
|
8 | 8 | |
9 | -function ao_js_snippetcacher($jsin,$jsfilename) { |
|
9 | +function ao_js_snippetcacher($jsin, $jsfilename) { |
|
10 | 10 | $md5hash = "snippet_".md5($jsin); |
11 | - $ccheck = new autoptimizeCache($md5hash,'js'); |
|
12 | - if($ccheck->check()) { |
|
11 | + $ccheck = new autoptimizeCache($md5hash, 'js'); |
|
12 | + if ($ccheck->check()) { |
|
13 | 13 | $scriptsrc = $ccheck->retrieve(); |
14 | 14 | } else { |
15 | - if ( (strpos($jsfilename,"min.js") === false) && ( strpos($jsfilename,"js/jquery/jquery.js") === false ) && ( str_replace(apply_filters('autoptimize_filter_js_consider_minified',false), '', $jsfilename) === $jsfilename ) ) { |
|
16 | - if(class_exists('JSMin')) { |
|
15 | + if ((strpos($jsfilename, "min.js") === false) && (strpos($jsfilename, "js/jquery/jquery.js") === false) && (str_replace(apply_filters('autoptimize_filter_js_consider_minified', false), '', $jsfilename) === $jsfilename)) { |
|
16 | + if (class_exists('JSMin')) { |
|
17 | 17 | $tmp_jscode = trim(JSMin::minify($jsin)); |
18 | 18 | if (!empty($tmp_jscode)) { |
19 | 19 | $scriptsrc = $tmp_jscode; |
20 | 20 | unset($tmp_jscode); |
21 | 21 | } else { |
22 | - $scriptsrc=$jsin; |
|
22 | + $scriptsrc = $jsin; |
|
23 | 23 | } |
24 | 24 | } else { |
25 | - $scriptsrc=$jsin; |
|
25 | + $scriptsrc = $jsin; |
|
26 | 26 | } |
27 | 27 | } else { |
28 | 28 | // do some housekeeping here to remove comments & linebreaks and stuff |
29 | - $scriptsrc=preg_replace("#^\s*\/\/.*$#Um","",$jsin); |
|
30 | - $scriptsrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$scriptsrc); |
|
31 | - $scriptsrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc); |
|
29 | + $scriptsrc = preg_replace("#^\s*\/\/.*$#Um", "", $jsin); |
|
30 | + $scriptsrc = preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us", "", $scriptsrc); |
|
31 | + $scriptsrc = preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc); |
|
32 | 32 | |
33 | - if ((substr($scriptsrc,-1,1)!==";")&&(substr($scriptsrc,-1,1)!=="}")) { |
|
34 | - $scriptsrc.=";"; |
|
33 | + if ((substr($scriptsrc, -1, 1) !== ";") && (substr($scriptsrc, -1, 1) !== "}")) { |
|
34 | + $scriptsrc .= ";"; |
|
35 | 35 | } |
36 | 36 | } |
37 | - if ( !empty($jsfilename) && str_replace( apply_filters('autoptimize_filter_js_speedup_cache',false), '', $jsfilename ) === $jsfilename ) { |
|
37 | + if (!empty($jsfilename) && str_replace(apply_filters('autoptimize_filter_js_speedup_cache', false), '', $jsfilename) === $jsfilename) { |
|
38 | 38 | // don't cache inline CSS or if filter says no |
39 | - $ccheck->cache($scriptsrc,'text/javascript'); |
|
39 | + $ccheck->cache($scriptsrc, 'text/javascript'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | unset($ccheck); |
43 | 43 | |
44 | - if (get_option("autoptimize_js_trycatch")==="on") { |
|
45 | - $scriptsrc="try{".$scriptsrc."}catch(e){}"; |
|
44 | + if (get_option("autoptimize_js_trycatch") === "on") { |
|
45 | + $scriptsrc = "try{".$scriptsrc."}catch(e){}"; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return $scriptsrc; |
49 | 49 | } |
50 | 50 | |
51 | -function ao_css_snippetcacher($cssin,$cssfilename) { |
|
51 | +function ao_css_snippetcacher($cssin, $cssfilename) { |
|
52 | 52 | $md5hash = "snippet_".md5($cssin); |
53 | - $ccheck = new autoptimizeCache($md5hash,'css'); |
|
54 | - if($ccheck->check()) { |
|
53 | + $ccheck = new autoptimizeCache($md5hash, 'css'); |
|
54 | + if ($ccheck->check()) { |
|
55 | 55 | $stylesrc = $ccheck->retrieve(); |
56 | 56 | } else { |
57 | - if ( ( strpos($cssfilename,"min.css") === false ) && ( str_replace( apply_filters('autoptimize_filter_css_consider_minified',false), '', $cssfilename ) === $cssfilename ) ) { |
|
57 | + if ((strpos($cssfilename, "min.css") === false) && (str_replace(apply_filters('autoptimize_filter_css_consider_minified', false), '', $cssfilename) === $cssfilename)) { |
|
58 | 58 | if (class_exists('Minify_CSS_Compressor')) { |
59 | 59 | $tmp_code = trim(Minify_CSS_Compressor::process($cssin)); |
60 | - } else if(class_exists('CSSmin')) { |
|
60 | + } else if (class_exists('CSSmin')) { |
|
61 | 61 | $cssmin = new CSSmin(); |
62 | - if (method_exists($cssmin,"run")) { |
|
62 | + if (method_exists($cssmin, "run")) { |
|
63 | 63 | $tmp_code = trim($cssmin->run($cssin)); |
64 | - } elseif (@is_callable(array($cssmin,"minify"))) { |
|
64 | + } elseif (@is_callable(array($cssmin, "minify"))) { |
|
65 | 65 | $tmp_code = trim(CssMin::minify($cssin)); |
66 | 66 | } |
67 | 67 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | } |
75 | 75 | } else { |
76 | 76 | // .min.css -> no heavy-lifting, just some cleanup |
77 | - $stylesrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$cssin); |
|
78 | - $stylesrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc); |
|
79 | - $stylesrc=autoptimizeStyles::fixurls($cssfilename,$stylesrc); |
|
77 | + $stylesrc = preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us", "", $cssin); |
|
78 | + $stylesrc = preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $stylesrc); |
|
79 | + $stylesrc = autoptimizeStyles::fixurls($cssfilename, $stylesrc); |
|
80 | 80 | } |
81 | - if ( !empty($cssfilename) && ( str_replace( apply_filters('autoptimize_filter_css_speedup_cache',false), '', $cssfilename ) === $cssfilename ) ) { |
|
81 | + if (!empty($cssfilename) && (str_replace(apply_filters('autoptimize_filter_css_speedup_cache', false), '', $cssfilename) === $cssfilename)) { |
|
82 | 82 | // only cache CSS if not inline and allowed by filter |
83 | - $ccheck->cache($stylesrc,'text/css'); |
|
83 | + $ccheck->cache($stylesrc, 'text/css'); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | unset($ccheck); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | function ao_css_speedup_cleanup($cssin) { |
91 | 91 | // speedupper results in aggregated CSS not being minified, so the filestart-marker AO adds when aggregating need to be removed |
92 | - return trim(str_replace(array('/*FILESTART*/','/*FILESTART2*/'),'',$cssin)); |
|
92 | + return trim(str_replace(array('/*FILESTART*/', '/*FILESTART2*/'), '', $cssin)); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | function ao_js_speedup_cleanup($jsin) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return trim($jsin); |
98 | 98 | } |
99 | 99 | |
100 | -add_filter('autoptimize_css_individual_style','ao_css_snippetcacher',10,2); |
|
101 | -add_filter('autoptimize_js_individual_script','ao_js_snippetcacher',10,2); |
|
102 | -add_filter('autoptimize_css_after_minify','ao_css_speedup_cleanup',10,1); |
|
103 | -add_filter('autoptimize_js_after_minify','ao_js_speedup_cleanup',10,1); |
|
100 | +add_filter('autoptimize_css_individual_style', 'ao_css_snippetcacher', 10, 2); |
|
101 | +add_filter('autoptimize_js_individual_script', 'ao_js_snippetcacher', 10, 2); |
|
102 | +add_filter('autoptimize_css_after_minify', 'ao_css_speedup_cleanup', 10, 1); |
|
103 | +add_filter('autoptimize_js_after_minify', 'ao_js_speedup_cleanup', 10, 1); |
@@ -4,7 +4,10 @@ |
||
4 | 4 | * new in Autoptimize 2.2 |
5 | 5 | */ |
6 | 6 | |
7 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
8 | + exit; |
|
9 | +} |
|
10 | +// Exit if accessed directly |
|
8 | 11 | |
9 | 12 | function ao_js_snippetcacher($jsin,$jsfilename) { |
10 | 13 | $md5hash = "snippet_".md5($jsin); |
@@ -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 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @subcommand clear |
13 | 13 | */ |
14 | - public function clear( $args, $args_assoc ) { |
|
15 | - WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) ); |
|
14 | + public function clear($args, $args_assoc) { |
|
15 | + WP_CLI::line(esc_html__('Flushing the cache...', 'autoptimize')); |
|
16 | 16 | autoptimizeCache::clearall(); |
17 | - WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) ); |
|
17 | + WP_CLI::success(esc_html__('Cache flushed.', 'autoptimize')); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } |
21 | 21 | |
22 | -WP_CLI::add_command( 'autoptimize', 'autoptimizeCLI' ); |
|
22 | +WP_CLI::add_command('autoptimize', 'autoptimizeCLI'); |