Changeset 2205471
- Timestamp:
- 12/03/2019 07:08:14 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
clear-opcache/trunk/clear_op_cache_plugin.php
r2196791 r2205471 84 84 } 85 85 add_filter('upgrader_pre_install', 'bc_cocp_clear_caches', 10, 2); 86 add_filter('upgrader_process_complete', 'bc_cocp_clear_caches', 10, 2); 86 87 87 88 function bc_cocp_add_flush_opcache_button($admin_bar){ … … 115 116 if ($enabled) { 116 117 bc_cocp_clear_caches(); 117 wp_redirect("/wp-admin?opcache_cleared=true"); 118 } else { 119 wp_redirect("/wp-admin?opcache_cleared=false"); 118 // wp_redirect("/wp-admin?opcache_cleared=true"); 119 $location = add_query_arg('opcache_cleared', 'true', $_SERVER['HTTP_REFERER']); 120 wp_safe_redirect($location); 121 } else { 122 // wp_redirect("/wp-admin?opcache_cleared=false"); 123 $location = add_query_arg('opcache_cleared', 'false', $_SERVER['HTTP_REFERER']); 124 wp_safe_redirect($location); 120 125 } 121 126 } … … 203 208 <?php 204 209 } 205 ?> 210 211 function bc_cocp_plugin_activation() { 212 update_option('bc_cocp_plugin_activated', true); 213 update_option('bc_cocp_plugin_notice_shown', false); 214 } 215 register_activation_hook(__FILE__, 'bc_cocp_plugin_activation'); 216 217 function bc_cocp_plugin_deactivation() { 218 update_option('bc_cocp_plugin_activated', true); 219 } 220 register_deactivation_hook(__FILE__, 'bc_cocp_plugin_deactivation'); 221 222 function bc_cocp_plugin_notices() { 223 $shown = get_option('bc_cocp_plugin_notice_shown'); 224 225 if (!$shown) { 226 echo "<div class='updated'><h2>Clear OPcache is installed, and ready to go.</h2><p>You can now flush your OPcache with the <b>Flush OPcache</b> button above and view settings in the <i>Settings</i>><b>OPcache</b> page to the left.</p></div>"; 227 update_option('bc_cocp_plugin_notice_shown', true); 228 } 229 } 230 add_action('admin_notices', 'bc_cocp_plugin_notices');
Note: See TracChangeset
for help on using the changeset viewer.