PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | minify/class-wp-optimize-minify.php +6 -6 4.6.1 → 4.7.0 View file →
@@ -96,11 +96,9 @@
96 96 * @param array $menu_items
97 97 * @return array
98 98 */
99 99 public function admin_bar_menu($menu_items) {
100 - $wpo_minify_options = wp_optimize_minify_config()->get();
101 -
102 - if (!$wpo_minify_options['enabled'] || !WP_Optimize()->current_user_can('manage_options') || !($wpo_minify_options['enable_css'] || $wpo_minify_options['enable_js'])) return $menu_items;
100 + if (!$this->enabled || !$this->can_purge_cache()) return $menu_items;
103 101
104 102 $act_url = WP_Optimize_Utils::get_url_without_cache_purge_params();
105 103 $cache_path = WP_Optimize_Minify_Cache_Functions::cache_path();
106 104 $cache_size_info = '<h4>'.__('Minify cache', 'wp-optimize').'</h4><span><span class="label">'.__('Cache size:', 'wp-optimize').'</span> <span class="stats">'.esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats($cache_path['cachedir'])).'</span></span>';
@@ -126,20 +124,22 @@
126 124 /**
127 125 * Check if purge single page action sent and purge cache.
128 126 */
129 127 public function handle_purge_minify_cache() {
130 - $wpo_minify_options = wp_optimize_minify_config()->get();
131 - if (!$wpo_minify_options['enabled'] || !WP_Optimize()->current_user_can('manage_options')) return;
128 + if (!$this->enabled || !$this->can_purge_cache()) return;
132 129
133 130 $is_cache_purged = TeamUpdraft\WP_Optimize\Includes\Fragments\fetch_superglobal('get', 'wpo_minify_cache_purged');
134 131 if (null !== $is_cache_purged) {
135 132 if (is_admin()) {
133 + $admin_notices_hook = is_network_admin() ? 'network_admin_notices' : 'admin_notices';
136 134 $notice_function = 'notice_purge_minify_cache_' . ('false' === $is_cache_purged ? 'failure' : 'success');
137 - add_action('admin_notices', array($this, $notice_function));
135 + add_action($admin_notices_hook, array($this, $notice_function));
136 + add_action('admin_head', array('WP_Optimize_Utils', 'script_to_remove_cache_purge_params_from_url'));
138 137 return;
139 138 } else {
140 139 $message = 'false' === $is_cache_purged ? __('Failed to purge the minify cache.', 'wp-optimize') : __('Minify cache purged', 'wp-optimize');
141 140 printf('<script>window.onload = function() {alert("%s");}</script>', esc_js($message));
141 + WP_Optimize_Utils::script_to_remove_cache_purge_params_from_url();
142 142 return;
143 143 }
144 144 }
145 145