本文整理汇总了PHP中wp_cache_clear_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_cache_clear_cache函数的具体用法?PHP wp_cache_clear_cache怎么用?PHP wp_cache_clear_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_cache_clear_cache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:SSRezhepa,项目名称:prodvizhenie.ru,代码行数:26,代码来源:autoptimizeCache.php
示例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.');
}
开发者ID:Pross,项目名称:pl-plugin-cache-clear,代码行数:9,代码来源:supercache.php
示例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();
}
}
}
开发者ID:BGCX067,项目名称:eyesimple-svn-to-git,代码行数:13,代码来源:class-admin.php
示例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;
}
开发者ID:jeanpage,项目名称:ca_learn,代码行数:10,代码来源:common.php
示例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();
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:12,代码来源:class-cspv4.php
示例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;
}
开发者ID:narendra-addweb,项目名称:MyImmoPix,代码行数:58,代码来源:functions.php
示例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();
}
}
}
开发者ID:jacobschweitzer,项目名称:email-certain-users,代码行数:19,代码来源:email-certain-users.php
示例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();
}
}
}
开发者ID:optimalisatie,项目名称:above-the-fold-optimization,代码行数:22,代码来源:plugins.class.php
示例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() . '');
}
}
}
开发者ID:proudchild,项目名称:sdmblog,代码行数:26,代码来源:wp-category-tag-cloud.php
示例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();
}
}
}
开发者ID:waynestedman,项目名称:commodore-new,代码行数:32,代码来源:class-itsec-lib.php
示例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();
}
}
开发者ID:bqevin,项目名称:wp-shopeasy,代码行数:22,代码来源:global.php
示例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?');
}
}
开发者ID:bytewang,项目名称:wp-cli,代码行数:30,代码来源:wp-super-cache.php
示例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;
}
开发者ID:ubc,项目名称:simpler-css,代码行数:41,代码来源:cpt-to-file.php
示例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);
}
}
}
}
}
}
}
}
}
}
开发者ID:junaidkbr,项目名称:autoptimize,代码行数:54,代码来源:autoptimize.php
示例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;
}
}
开发者ID:plusinterativa,项目名称:clientes,代码行数:62,代码来源:supernova.php
示例16: admin_header
/**
* Generates the header for admin pages
*
* @param string $title The title to show in the main heading.
* @param bool $form Whether or not the form should be included.
* @param string $option The long name of the option to use for the current page.
* @param string $optionshort The short name of the option to use for the current page.
* @param bool $contains_files Whether the form should allow for file uploads.
*/
function admin_header($title, $form = true, $option = 'yoast_wpseo_options', $optionshort = 'wpseo', $contains_files = false)
{
?>
<div class="wrap">
<?php
if (isset($_GET['updated']) && $_GET['updated'] == 'true' || isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') {
$msg = __('Settings updated', 'wordpress-seo');
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
$msg .= __(' & W3 Total Cache Page Cache flushed', 'wordpress-seo');
} else {
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
$msg .= __(' & WP Super Cache flushed', 'wordpress-seo');
}
}
// flush rewrite rules if XML sitemap settings have been updated.
if (isset($_GET['page']) && 'wpseo_xml' == $_GET['page']) {
flush_rewrite_rules();
}
echo '<div id="message" style="width:94%;" class="message updated"><p><strong>' . $msg . '.</strong></p></div>';
}
?>
<a href="http://yoast.com/">
<div id="yoast-icon"
style="background: url('<?php
echo WPSEO_URL;
?>
images/wordpress-SEO-32x32.png') no-repeat;"
class="icon32">
<br/>
</div>
</a>
<h2 id="wpseo-title"><?php
_e("Yoast WordPress SEO: ", 'wordpress-seo');
echo $title;
?>
</h2>
<div id="wpseo_content_top" class="postbox-container" style="width:75%;">
<div class="metabox-holder">
<div class="meta-box-sortables">
<?php
if ($form) {
echo '<form action="' . admin_url('options.php') . '" method="post" id="wpseo-conf"' . ($contains_files ? ' enctype="multipart/form-data"' : '') . '>';
settings_fields($option);
$this->currentoption = $optionshort;
}
}
开发者ID:Savantos,项目名称:cow-theme,代码行数:57,代码来源:class-config.php
示例17: upgrade
/**
* Checks if the plugin was recently updated and upgrades if necessary
* @author Ian Dunn <[email protected]>
*/
public function upgrade()
{
if (did_action('init') !== 1) {
return;
}
if (version_compare($this->options['dbVersion'], self::VERSION, '==')) {
return;
}
if (version_compare($this->options['dbVersion'], '1.1', '<')) {
// Populate new Address field from existing coordinate fields
$posts = get_posts(array('numberposts' => -1, 'post_type' => self::POST_TYPE));
if ($posts) {
foreach ($posts as $p) {
$address = get_post_meta($p->ID, self::PREFIX . 'address', true);
$latitude = get_post_meta($p->ID, self::PREFIX . 'latitude', true);
$longitude = get_post_meta($p->ID, self::PREFIX . 'longitude', true);
if (empty($address) && !empty($latitude) && !empty($longitude)) {
$address = $this->reverseGeocode($latitude, $longitude);
if ($address) {
update_post_meta($p->ID, self::PREFIX . 'address', $address);
}
}
}
}
}
if (version_compare($this->options['dbVersion'], '1.6', '<')) {
// Add new options
add_option(self::PREFIX . 'map-type', 'ROADMAP');
add_option(self::PREFIX . 'map-type-control', 'off');
add_option(self::PREFIX . 'map-navigation-control', 'DEFAULT');
// @todo - this isn't DRY, those default values appear in activate and settings->construct. should have single array to hold them all
}
if (version_compare($this->options['dbVersion'], '1.9', '<')) {
// Add new options
add_option(self::PREFIX . 'marker-clustering', '');
add_option(self::PREFIX . 'cluster-max-zoom', '7');
add_option(self::PREFIX . 'cluster-grid-size', '40');
add_option(self::PREFIX . 'cluster-style', 'default');
// @todo - this isn't DRY, those default values appear in activate and settings->construct. should have single array to hold them all
}
$this->options['dbVersion'] = self::VERSION;
$this->updatedOptions = true;
// Clear WP Super Cache and W3 Total Cache
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
if (class_exists('W3_Plugin_TotalCacheAdmin')) {
$w3TotalCache =& w3_instance('W3_Plugin_TotalCacheAdmin');
if (method_exists($w3TotalCache, 'flush_all')) {
$w3TotalCache->flush_all();
}
}
}
开发者ID:Wikipraca,项目名称:Wikipraca-WikiSquare,代码行数:57,代码来源:core.php
示例18: upgrade
/**
* Upgrade plugin
*
* @since 2.3.10
*/
public function upgrade()
{
if (!defined('WPABOVETHEFOLD_VERSION') || WPABOVETHEFOLD_VERSION !== get_site_option('wpabovethefold_version')) {
/**
* Clear cache on plugin update
*/
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
}
update_site_option('wpabovethefold_version', WPABOVETHEFOLD_VERSION);
}
}
开发者ID:ashenkar,项目名称:sanga,代码行数:21,代码来源:admin.class.php
示例19: add_action
//add_action( 'wp_enqueue_scripts', 'cf_frontend_enqueue_scripts' );
add_action('admin_menu', 'sf_menu');
//ini_rules();
/*EMAIL HTML FORMAT*/
add_filter('wp_mail_content_type', 'sf_set_content_type');
$args = array('public' => true, 'query_var' => 'socialfunnel', 'capability_type' => 'page', 'rewrite' => array('slug' => 'socialfunnel', 'with_front' => true));
register_post_type('socialfunnel', $args);
if (!is_admin()) {
add_filter('wp_redirect', 'sf_disable_redirect');
}
}
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
}
function sf_theme_setup()
{
add_theme_support('post-thumbnails');
add_image_size('popup-image', 200, 230, true);
add_image_size('feature-image', 280, 210, true);
}
function sf_custom_image_sizes_choose($sizes)
{
$custom_sizes = array('popup-image' => 'Popup Image', 'feature-image' => 'Feature Image');
return array_merge($sizes, $custom_sizes);
}
require_once 'wp-updates-plugin.php';
new WPUpdatesPluginUpdater_1116('http://wp-updates.com/api/2/plugin', plugin_basename(__FILE__));
开发者ID:aakashwt,项目名称:wp-plugin,代码行数:31,代码来源:social-funnel.php
示例20: qppr_try_to_clear_cache_plugins
/**
* Try to clear Cache files when certain plugins are present.
* Only happens after redirects or settings are saved or deleted.
*
* Expirimental to try to stop some caching plugins from holding the cached redirects.
* @since 5.1.2
*/
function qppr_try_to_clear_cache_plugins()
{
// make sure the function is present
if (!function_exists('is_plugin_active')) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
// WP Super Cache
if (is_plugin_active('wp-super-cache/wp-cache.php') && function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
// W3 Total Cache
if (is_plugin_active('w3-total-cache/w3-total-cache.php') && function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
}
// WP Fast Cache
if (is_plugin_active('wp-fastest-cache/wpFastestCache.php') && class_exists('WpFastestCache')) {
$newCache = new WpFastestCache();
$newCache->deleteCache();
}
}
开发者ID:kol4ak,项目名称:autoiservice,代码行数:27,代码来源:page_post_redirect_plugin.php
注:本文中的wp_cache_clear_cache函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论