wpsc_delete_cache_scripts()
No Hooks.
Return
null
. Nothing (null).
Usage
wpsc_delete_cache_scripts();
wpsc_delete_cache_scripts() wpsc delete cache scripts code WPSCache 1.12.4
function wpsc_delete_cache_scripts() { if ( ! is_user_logged_in() ) { return; } if ( is_plugin_active( 'amp/amp.php' ) || ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) ) { wp_cache_debug( 'AMP detected. Not loading Delete Cache button JavaScript.' ); return; } $path_to_home = rtrim( (string) parse_url( get_option( 'home' ), PHP_URL_PATH ), '/' ); wp_enqueue_script( 'delete-cache-button', plugins_url( '/delete-cache-button.js', __FILE__ ), array('jquery'), '1.0', 1 ); if ( ( is_singular() || is_archive() || is_front_page() || is_search() ) && current_user_can( 'delete_others_posts' ) ) { $site_regex = preg_quote( $path_to_home, '`' ); $req_uri = preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER[ 'REQUEST_URI' ] ); $path_to_home = preg_replace( '`^' . $site_regex . '`', '', $req_uri ); $admin = 0; } else { $admin = 1; } if ( $path_to_home === '' ) { $path_to_home = '/'; } $nonce = wp_create_nonce( 'delete-cache-' . $path_to_home . '_' . $admin ); wp_localize_script( 'delete-cache-button', 'wpsc_ajax', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'path' => $path_to_home, 'admin' => $admin, 'nonce' => $nonce ) ); }