PHP Class WP_Spider_Cache_UI

Since: 2.0.0
Show file Open project: stuttter/wp-spider-cache

Public Methods

Method Description
__construct ( ) The main constructor
admin_enqueue ( ) Enqueue assets
admin_menu ( ) Add the top-level admin menu
ajax_flush_group ( ) Delete all cache keys in a cache group
ajax_get_instance ( ) Attempt to output the server cache contents
ajax_get_item ( ) Attempt to get a cached item
ajax_remove_item ( ) Delete a single cache key in a specific group
clean_post ( integer $post_id ) Clean a post's cached URLs
clean_url ( string $url = '' ) : boolean Clear a cached URL
clear_group ( string $group = '' ) : integer Clear all of the items in a cache group
do_item ( string $key, string $group ) Output the contents of a cached item into a textarea
do_rows ( string $server = '' ) Output the cache server contents in a table
help ( ) Help text
init ( ) : WP_Spider_Cache_UI Initialize the protected singleton
load ( ) Check for actions
map_meta_cap ( array $caps = [], string $cap = '' ) Map manage_cache capability
notice ( ) Maybe output a notice to the user that action has taken place
page ( ) Output the WordPress admin page
retrieve_keys ( string $server, integer $port = 11211 ) : array Get all cache keys on a server
set_blog_ids ( ) Check for network activation and init to add menu item.

Private Methods

Method Description
bulk_actions ( ) : string Return the bulk actions dropdown
check_nonce ( string $nonce = '' ) Helper function to check nonce and avoid caching the request
do_row ( array $values = [], string $nonce = '' ) Output a table row based on values
get_admin_type ( ) : string Get the type of admin request this is
get_cache_key_links ( integer $blog_id, string $group = '', array $keys = [] ) Output contents of cache group keys
get_flush_group_link ( integer $blog_id, string $group, string $nonce ) Output a link used to flush an entire cache group
get_keymaps ( string $server = '' ) : array Get the map of cache groups $ keys
get_no_results_row ( ) : string Returns a table row used to show no results were found
get_refreshing_results_row ( ) : string Returns a table row used to show results are loading
get_servers ( ) : array Return list of servers, if function exists
maybe_clear_cache_group ( boolean $redirect = true ) Maybe clear a cache group, based on user request
maybe_clear_user_cache ( boolean $redirect = true ) Maybe clear a user's entire cache, based on user request
sanitize_key ( string $key = '' ) : string Sanitize a user submitted cache group or key value

Method Details

__construct() public method

The main constructor
Since: 2.0.0
public __construct ( )

admin_enqueue() public method

Enqueue assets
Since: 2.0.0
public admin_enqueue ( )

admin_menu() public method

Add the top-level admin menu
Since: 2.0.0
public admin_menu ( )

ajax_flush_group() public method

Delete all cache keys in a cache group
Since: 2.0.0
public ajax_flush_group ( )

ajax_get_instance() public method

Attempt to output the server cache contents
Since: 2.0.0
public ajax_get_instance ( )

ajax_get_item() public method

Attempt to get a cached item
Since: 2.0.0
public ajax_get_item ( )

ajax_remove_item() public method

Delete a single cache key in a specific group
Since: 2.0.0
public ajax_remove_item ( )

clean_post() public static method

Clean a post's cached URLs
Since: 2.3.0
public static clean_post ( integer $post_id )
$post_id integer

clean_url() public static method

Clear a cached URL
Since: 2.3.0
public static clean_url ( string $url = '' ) : boolean
$url string
return boolean

clear_group() public method

Clear all of the items in a cache group
Since: 2.0.0
public clear_group ( string $group = '' ) : integer
$group string
return integer

do_item() public method

Output the contents of a cached item into a textarea
Since: 2.0.0
public do_item ( string $key, string $group )
$key string
$group string

do_rows() public method

Output the cache server contents in a table
Since: 2.0.0
public do_rows ( string $server = '' )
$server string

help() public method

Help text
Since: 2.1.0
public help ( )

init() public static method

Initialize the protected singleton
Since: 2.2.0
public static init ( ) : WP_Spider_Cache_UI
return WP_Spider_Cache_UI

load() public method

Check for actions
Since: 2.0.0
public load ( )

map_meta_cap() public method

Map manage_cache capability
Since: 2.3.0
public map_meta_cap ( array $caps = [], string $cap = '' )
$caps array
$cap string

notice() public method

Maybe output a notice to the user that action has taken place
Since: 2.0.0
public notice ( )

page() public method

Output the WordPress admin page
Since: 2.0.0
public page ( )

retrieve_keys() public method

Get all cache keys on a server
Since: 2.0.0
public retrieve_keys ( string $server, integer $port = 11211 ) : array
$server string
$port integer
return array

set_blog_ids() public method

Check for network activation and init to add menu item.
Since: 2.2.0
public set_blog_ids ( )