admin-toolbar.php
6 years ago
admin.php
6 years ago
cache.php
6 years ago
cdn.php
7 years ago
cli.php
6 years ago
column.php
7 years ago
css-utilities.php
6 years ago
index.html
11 years ago
js-utilities.php
6 years ago
nonce-timeout.php
8 years ago
preload.php
6 years ago
wp-polls.php
9 years ago
column.php
37 lines
| 1 | <?php |
| 2 | class WpFastestCacheColumn{ |
| 3 | public function __construct(){} |
| 4 | |
| 5 | public function add(){ |
| 6 | add_filter('manage_posts_columns', array($this, 'wpfc_clear_column_head')); |
| 7 | add_action('manage_posts_custom_column', array($this, 'wpfc_clear_column_content'), 10, 2); |
| 8 | add_filter('manage_pages_columns', array($this, 'wpfc_clear_column_head')); |
| 9 | add_action('manage_pages_custom_column', array($this, 'wpfc_clear_column_content'), 10, 2); |
| 10 | add_action('admin_enqueue_scripts', array($this, 'load_js')); |
| 11 | add_action('wp_ajax_wpfc_clear_cache_column', array($this, "clear_cache_column")); |
| 12 | } |
| 13 | |
| 14 | public function clear_cache_column(){ |
| 15 | $GLOBALS["wp_fastest_cache"]->singleDeleteCache(false, esc_sql($_GET["id"])); |
| 16 | |
| 17 | die(json_encode(array("success" => true))); |
| 18 | } |
| 19 | |
| 20 | public function load_js(){ |
| 21 | wp_enqueue_script("wpfc-column", plugins_url("wp-fastest-cache/js/column.js"), array(), time(), true); |
| 22 | } |
| 23 | |
| 24 | public function wpfc_clear_column_head($defaults) { |
| 25 | $defaults['wpfc_column_clear_cache'] = 'Cache'; |
| 26 | return $defaults; |
| 27 | } |
| 28 | |
| 29 | public function wpfc_clear_column_content($column_name, $post_ID) { |
| 30 | if($column_name == "wpfc_column_clear_cache"){ |
| 31 | echo '<button wpfc-clear-column="'.$post_ID.'" class="button wpfc-clear-column-action"> |
| 32 | <span>Clear</span> |
| 33 | </button>'; |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | ?> |