Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- remove_action('admin_bar_menu', array('Swift_Performance', 'toolbar_items'),100);
- add_action('admin_bar_menu', function ($admin_bar){
- if (!defined('SWIFT_PERFORMANCE_PLUGIN_NAME')){
- return;
- }
- if (current_user_can('manage_options')){
- $current_page = site_url(str_replace(site_url(), '', 'http'.(isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
- list($current_page_nq,) = explode('?',$current_page);
- $admin_bar->add_menu(array(
- 'id' => 'swift-performance',
- 'title' => SWIFT_PERFORMANCE_PLUGIN_NAME,
- 'href' => '#'
- ));
- if(Swift_Performance::check_option('enable-caching', 1)){
- $admin_bar->add_menu(array(
- 'id' => 'clear-swift-cache',
- 'parent' => 'swift-performance',
- 'title' => esc_html__('Clear All Cache', 'swift-performance'),
- 'href' => esc_url(wp_nonce_url(add_query_arg('swift-performance-action', 'clear-all-cache', $current_page), 'clear-swift-cache')),
- ));
- if (!is_admin() && Swift_Performance_Cache::is_cached($current_page_nq)){
- $admin_bar->add_menu(array(
- 'id' => 'swift-cache-single',
- 'parent' => 'swift-performance',
- 'title' => esc_html__('Clear Page Cache', 'swift-performance'),
- 'href' => esc_url(wp_nonce_url(add_query_arg(array('swift-performance-action' => 'clear-page-cache', 'permalink' => urlencode($current_page_nq)), $current_page), 'clear-swift-cache')),
- ));
- $admin_bar->add_menu(array(
- 'id' => 'swift-view-cached',
- 'parent' => 'swift-performance',
- 'title' => esc_html__('View Cached', 'swift-performance'),
- 'href' => esc_url(add_query_arg('force-cached', '1', $current_page_nq)),
- ));
- }
- }
- }
- },100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement