本文整理汇总了PHP中wp_cache_clear_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_cache_clear_cache函数的具体用法?PHP wp_cache_clear_cache怎么用?PHP wp_cache_clear_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_cache_clear_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearall
static function clearall()
{
//Cache not available :(
if (!autoptimizeCache::cacheavail()) {
return false;
}
//Clean the cachedir
$scan = scandir(AUTOPTIMIZE_CACHE_DIR);
foreach ($scan as $file) {
if (!in_array($file, array('.', '..')) && strpos($file, 'autoptimize') !== false && is_file(AUTOPTIMIZE_CACHE_DIR . $file)) {
@unlink(AUTOPTIMIZE_CACHE_DIR . $file);
}
}
//Do we need to clean WP Super Cache's cache files?
if (function_exists('wp_cache_clear_cache')) {
//Newer WP-Super-Cache
//See http://ocaoimh.ie/wp-super-cache-developers/
wp_cache_clear_cache();
} elseif (file_exists(WP_CONTENT_DIR . '/wp-cache-config.php') && function_exists('prune_super_cache')) {
//Old WP-Super-Cache
global $cache_path;
prune_super_cache($cache_path . 'supercache/', true);
prune_super_cache($cache_path, true);
}
return true;
}
示例2: run
static function run()
{
error_log('pl5 - run() at ' . __CLASS__);
if (!function_exists('wp_cache_clear_cache')) {
return false;
}
wp_cache_clear_cache();
error_log('pl5 - cleared WP-Super-Cache caches.');
}
示例3: clear_cache
/**
* Clears the cache
*/
function clear_cache()
{
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
}
}
示例4: nrelate_flush_wpsc_cache
function nrelate_flush_wpsc_cache($msg = '')
{
// Flush Super Cache
// @cred: http://wordpress.org/extend/plugins/wordpress-seo/
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
$msg .= __(' & WP Super Cache flushed');
}
return $msg;
}
示例5: clear_cache
function clear_cache()
{
if (function_exists('wp_cache_clear_cache')) {
ob_end_clean();
wp_cache_clear_cache();
}
if (function_exists('w3tc_pgcache_flush')) {
ob_end_clean();
w3tc_pgcache_flush();
}
nocache_headers();
}
示例6: csmm_render_template
/**
* Required functions for the plugin.
*
* @link http://www.69signals.com
* @since 1.0
* @package Signals_Maintenance_Mode
*/
function csmm_render_template($options)
{
// Fix for W3 Total Cache plugin
if (function_exists('wp_cache_clear_cache')) {
ob_end_clean();
wp_cache_clear_cache();
}
// Fix for WP Super Cache plugin
if (function_exists('w3tc_pgcache_flush')) {
ob_end_clean();
w3tc_pgcache_flush();
}
/**
* Using the nocache_headers() to ensure that different nocache headers are sent to different browsers.
* We don't want any browser to cache the maintainance page.
* Also, output buffering is turned on.
*/
nocache_headers();
ob_start();
// Checking for options required for the plugin
if (empty($options['title'])) {
$options['title'] = __('Maintainance Mode', 'signals');
}
if (empty($options['input_text'])) {
$options['input_text'] = __('Enter your email address..', 'signals');
}
if (empty($options['button_text'])) {
$options['button_text'] = __('Subscribe', 'signals');
}
// Response message
if (empty($options['message_noemail'])) {
$options['message_noemail'] = __('Oops! Something went wrong.', 'signals');
}
if (empty($options['message_subscribed'])) {
$options['message_subscribed'] = __('You are already subscribed!', 'signals');
}
if (empty($options['message_wrong'])) {
$options['message_wrong'] = __('Oops! Something went wrong.', 'signals');
}
if (empty($options['message_done'])) {
$options['message_done'] = __('Thank you! We\'ll be in touch!', 'signals');
}
// Template file
if ('1' == $options['disable_settings']) {
require_once SIGNALS_CSMM_PATH . 'framework/public/views/blank.php';
} else {
require_once SIGNALS_CSMM_PATH . 'framework/public/views/html.php';
}
ob_flush();
exit;
}
示例7: clear_caching_plugins
/**
* Clears caches of content generated by caching plugins like WP Super Cache
*
* @mvc Model
*/
protected static function clear_caching_plugins()
{
// WP Super Cache
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
// W3 Total Cache
if (class_exists('W3_Plugin_TotalCacheAdmin')) {
$w3_total_cache = w3_instance('W3_Plugin_TotalCacheAdmin');
if (method_exists($w3_total_cache, 'flush_all')) {
$w3_total_cache->flush_all();
}
}
}
示例8: clear_pagecache
/**
* Clear full page cache
*/
public function clear_pagecache()
{
/**
* Clear full page cache from active plugin modules
*/
foreach ($this->active_modules as $module) {
$module->clear_pagecache();
}
/**
* Other cache clear methods
*/
if (function_exists('w3tc_pgca che_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
}
}
示例9: clear_caching_plugins
/**
* Clears caches of content generated by caching plugins like WP Super Cache
*
* @mvc Model
*/
public static function clear_caching_plugins()
{
// WP Super Cache
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
// W3 Total Cache
if (class_exists('W3_Plugin_TotalCacheAdmin')) {
$w3_total_cache = w3_instance('W3_Plugin_TotalCacheAdmin');
if (method_exists($w3_total_cache, 'flush_all')) {
$w3_total_cache->flush_all();
}
}
//Hyper Cache
if (class_exists('HyperCache')) {
$hyper_cache = HyperCache::$instance;
if (method_exists($hyper_cache, 'flush_all')) {
$hyper_cache->remove_dir($hyper_cache->get_folder() . '');
}
}
}
示例10: clear_caches
/**
* Clear caches.
*
* Clears popular WordPress caching mechanisms.
*
* @since 4.0.0
*
* @param bool $page [optional] true to clear page cache
*
* @return void
*/
public static function clear_caches($page = false)
{
//clear APC Cache
if (function_exists('apc_store')) {
apc_clear_cache();
//Let's clear APC (if it exists) when big stuff is saved.
}
//clear w3 total cache or wp super cache
if (function_exists('w3tc_pgcache_flush')) {
if (true == $page) {
w3tc_pgcache_flush();
w3tc_minify_flush();
}
w3tc_dbcache_flush();
w3tc_objectcache_flush();
} else {
if (function_exists('wp_cache_clear_cache') && true == $page) {
wp_cache_clear_cache();
}
}
}
示例11: flatsome_maintenance_mode_on_deactivation
function flatsome_maintenance_mode_on_deactivation()
{
if (!current_user_can('activate_plugins')) {
return;
}
$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
check_admin_referer("deactivate-plugin_{$plugin}");
// Clear Cachify Cache
if (has_action('cachify_flush_cache')) {
do_action('cachify_flush_cache');
}
// Clear Super Cache
if (function_exists('wp_cache_clear_cache')) {
ob_end_clean();
wp_cache_clear_cache();
}
// Clear W3 Total Cache
if (function_exists('w3tc_pgcache_flush')) {
ob_end_clean();
w3tc_pgcache_flush();
}
}
示例12: flush
/**
* Clear something from the cache
*
* @param array $args
* @param array $vars
*/
function flush($args = array(), $vars = array())
{
if (function_exists('wp_cache_clear_cache')) {
if (isset($vars['post_id'])) {
if (is_numeric($vars['post_id'])) {
wp_cache_post_change($vars['post_id']);
} else {
WP_CLI::error('This is not a valid post id.');
}
wp_cache_post_change($vars['post_id']);
} elseif (isset($vars['permalink'])) {
$id = url_to_postid($vars['permalink']);
if (is_numeric($id)) {
wp_cache_post_change($id);
} else {
WP_CLI::error('There is no post with this permalink.');
}
} else {
wp_cache_clear_cache();
}
} else {
WP_CLI::error('The WP Super Cache could not be found, is it installed?');
}
}
示例13: save_to_external_file
/**
* save_to_external_file function.
*
* @access public
* @param mixed $content
* @return void
*/
function save_to_external_file($content, $data)
{
if (!wp_mkdir_p($this->path_to)) {
$this->error[] = 'couldn\'t create filder ' . $this->path_to;
return 1;
// we can't make the folder
}
if (empty($content)) {
$this->unlink_files(true);
// delete all the files
$data['post_excerpt'] = null;
// don't link to any files
return $data;
}
do_action('CPT_to_file_save_to_file' . $this->post_type, $content);
// lets minify the javascript to save first to solve timing issues
$filtered_content = apply_filters('CPT_to_file_save_to_file_filter-' . $this->post_type, $content);
$timestamp = time();
if ($filtered_content) {
$this->filterd_file_name = 'custom-' . $this->file_type . '-' . $timestamp . '.min' . $this->file_extension;
$this->update_file($this->filterd_file_name, $filtered_content);
} else {
$this->error[] = 'Minified file wasn\'t created';
}
// update the regular file
$this->update_file($this->file_name, $content);
$data['post_excerpt'] = empty($this->filterd_file_name) ? $this->file_name : $this->filterd_file_name;
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
// lets delete the old minified files
$this->unlink_files();
return $data;
}
示例14: autoptimize_flush_pagecache
function autoptimize_flush_pagecache($nothing)
{
if (function_exists('wp_cache_clear_cache')) {
if (is_multisite()) {
$blog_id = get_current_blog_id();
wp_cache_clear_cache($blog_id);
} else {
wp_cache_clear_cache();
}
} else {
if (has_action('cachify_flush_cache')) {
do_action('cachify_flush_cache');
} else {
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
// w3 total cache
} else {
if (function_exists('hyper_cache_invalidate')) {
hyper_cache_invalidate();
// hypercache
} else {
if (function_exists('wp_fast_cache_bulk_delete_all')) {
wp_fast_cache_bulk_delete_all();
// wp fast cache
} else {
if (class_exists("WpFastestCache")) {
$wpfc = new WpFastestCache();
// wp fastest cache
$wpfc->deleteCache();
} else {
if (class_exists("c_ws_plugin__qcache_purging_routines")) {
c_ws_plugin__qcache_purging_routines::purge_cache_dir();
// quick cache
} else {
if (file_exists(WP_CONTENT_DIR . '/wp-cache-config.php') && function_exists('prune_super_cache')) {
// fallback for WP-Super-Cache
global $cache_path;
if (is_multisite()) {
$blog_id = get_current_blog_id();
prune_super_cache(get_supercache_dir($blog_id), true);
prune_super_cache($cache_path . 'blogs/', true);
} else {
prune_super_cache($cache_path . 'supercache/', true);
prune_super_cache($cache_path, true);
}
}
}
}
}
}
}
}
}
}
示例15: supernova_writer
function supernova_writer()
{
// @since Supernova 1.4.8 temporarily unavailable.
update_option('supernova_file_write_status', 'failed');
return false;
$test = get_option('supernova_test');
$file_status = get_option('supernova_file_write_status');
if ($test != 2) {
update_option('supernova_test', 1);
// To track the first attempt
}
if ($test == 1) {
if ($file_status == 'failed') {
update_option('supernova_test', 2);
return false;
//We wont try to write files after one attempt was failed and will stop right here.
}
}
// else go ahead.
if (!isset($_GET['settings-updated']) && !isset($_GET['_wpnonce'])) {
update_option('supernova_file_write_status', 'failed');
// @since Supernova 1.4.
} else {
// okay, let's see about getting credentials
$url = wp_nonce_url('themes.php?page=theme-options');
$method = '';
if (false === ($creds = request_filesystem_credentials($url, $method, false, false, null))) {
// if we get here, then we don't have credentials yet,
return true;
}
// now we have some credentials, try to get the wp_filesystem running
if (!WP_Filesystem($creds)) {
// our credentials were no good, ask the user for them again
request_filesystem_credentials($url, '', true, false, $_POST);
return true;
}
global $wp_filesystem;
$upload_dir = wp_upload_dir();
if (!is_dir(trailingslashit($upload_dir['basedir']) . 'supernova_directory')) {
if (!$wp_filesystem->mkdir(trailingslashit($upload_dir['basedir']) . 'supernova_directory')) {
update_option('supernova_file_write_status', 'failed');
// We will hook it normally if something goes wrong
echo "after here";
} else {
update_option('supernova_old_user_check', 'no');
}
}
$filename = trailingslashit($upload_dir['basedir']) . 'supernova_directory/custom-styles.css';
if (!$wp_filesystem->put_contents($filename, supernova_user_css(), FS_CHMOD_FILE)) {
update_option('supernova_file_write_status', 'failed');
} else {
update_option('supernova_old_user_check', 'no');
update_option('supernova_file_write_status', 'passed');
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
} elseif (function_exists('w3tc_minify_flush')) {
w3tc_minify_flush();
}
}
return true;
}
}