本文整理汇总了PHP中w3tc_pgcache_flush函数的典型用法代码示例。如果您正苦于以下问题:PHP w3tc_pgcache_flush函数的具体用法?PHP w3tc_pgcache_flush怎么用?PHP w3tc_pgcache_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3tc_pgcache_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ccfm_clear_cache_for_me
/**
* Clear the caches!
*/
function ccfm_clear_cache_for_me($source)
{
global $wp_fastest_cache;
do_action('ccfm_clear_cache_for_me_before', $source);
// if W3 Total Cache is being used, clear the cache
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clean_cache')) {
global $file_prefix, $supercachedir;
if (empty($supercachedir) && function_exists('get_supercache_dir')) {
$supercachedir = get_supercache_dir();
}
wp_cache_clean_cache($file_prefix);
} else {
if (class_exists('WpeCommon')) {
//be extra careful, just in case 3rd party changes things on us
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::purge_memcached();
}
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::clear_maxcdn_cache();
}
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::purge_varnish_cache();
}
} else {
if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
$wp_fastest_cache->deleteCache();
}
}
}
}
do_action('ccfm_clear_cache_for_me', $source);
}
示例2: flush
/**
* Clear something from the cache
*
* @param array $args
* @param array $vars
*/
function flush($args = array(), $vars = array())
{
if (function_exists('w3tc_pgcache_flush')) {
$args = array_unique($args);
do {
$cache_type = array_shift($args);
switch ($cache_type) {
case 'db':
case 'database':
if (w3tc_dbcache_flush()) {
WP_CLI::success('The object cache is flushed successfully.');
} else {
WP_CLI::error('Flushing the object cache failed.');
}
break;
case 'minify':
if (w3tc_minify_flush()) {
WP_CLI::success('The object cache is flushed successfully.');
} else {
WP_CLI::error('Flushing the object cache failed.');
}
break;
case 'object':
if (w3tc_objectcache_flush()) {
WP_CLI::success('The object cache is flushed successfully.');
} else {
WP_CLI::error('Flushing the object cache failed.');
}
break;
case 'post':
default:
if (isset($vars['post_id'])) {
if (is_numeric($vars['post_id'])) {
w3tc_pgcache_flush_post($vars['post_id']);
} else {
WP_CLI::error('This is not a valid post id.');
}
w3tc_pgcache_flush_post($vars['post_id']);
} elseif (isset($vars['permalink'])) {
$id = url_to_postid($vars['permalink']);
if (is_numeric($id)) {
w3tc_pgcache_flush_post($id);
} else {
WP_CLI::error('There is no post with this permalink.');
}
} else {
if (isset($flushed_page_cache) && $flushed_page_cache) {
break;
}
$flushed_page_cache = true;
w3tc_pgcache_flush();
}
}
} while (!empty($args));
} else {
WP_CLI::error('The W3 Total Cache could not be found, is it installed?');
}
}
示例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_w3tc_cache
/**
* Clean third party plugins cache
*
* Since v0.50.0
*/
function nrelate_flush_w3tc_cache($msg = '')
{
// Flush Total Cache
// @cred: http://wordpress.org/extend/plugins/wordpress-seo/
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
$msg .= __(' & W3 Total Cache Page Cache flushed');
}
return $msg;
}
示例5: mt_clear_cache
public static function mt_clear_cache()
{
global $file_prefix;
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
}
if (function_exists('wp_cache_clean_cache')) {
wp_cache_clean_cache($file_prefix, true);
}
}
示例6: 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();
}
示例7: 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;
}
示例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_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();
}
}
}
示例10: 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();
}
}
示例11: _flush_caching_plugins_caches
/**
* Flush the caches of the plugins W3 Total Cache, WP Super Cache, Cachify, and Quick Cache.
*
* @since 1.0.0
*/
public function _flush_caching_plugins_caches()
{
/**
* Filter whether the caches of common caching plugins shall be flushed.
*
* @since 1.0.0
*
* @param bool $flush Whether caches of caching plugins shall be flushed. Default true.
*/
if (!apply_filters('tablepress_flush_caching_plugins_caches', true)) {
return;
}
// W3 Total Cache
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
}
// WP Super Cache
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
// Cachify
do_action('cachify_flush_cache');
// Quick Cache
if (isset($GLOBALS['quick_cache']) && method_exists($GLOBALS['quick_cache'], 'clear_cache')) {
$GLOBALS['quick_cache']->clear_cache();
}
// WP Fastest Cache
if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')) {
$GLOBALS['wp_fastest_cache']->deleteCache();
}
}
示例12: load_form_page
public function load_form_page()
{
wp_enqueue_script('postbox');
$upload_dir = wp_upload_dir();
// returns assoc array with path info
$user_opts = $this->p->addons['util']['user']->get_options();
if (!empty($_GET['action'])) {
if (empty($_GET[NGFB_NONCE])) {
$this->p->debug->log('Nonce token validation query field missing.');
} elseif (!wp_verify_nonce($_GET[NGFB_NONCE], $this->get_nonce())) {
$this->p->notice->err(__('Nonce token validation failed for plugin action (action ignored).', NGFB_TEXTDOM));
} else {
switch ($_GET['action']) {
case 'check_for_updates':
if (!empty($this->p->options['plugin_' . $this->p->cf['lca'] . '_tid'])) {
$this->readme_info = array();
$this->p->update->check_for_updates(null, true);
}
break;
case 'clear_all_cache':
$deleted_cache = $this->p->util->delete_expired_file_cache(true);
$deleted_transient = $this->p->util->delete_expired_transients(true);
wp_cache_flush();
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} elseif (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
$this->p->notice->inf(__('Cached files, WP object cache, transient cache, and any additional caches, ' . 'like APC, Memcache, Xcache, W3TC, Super Cache, etc. have all been cleared.', NGFB_TEXTDOM));
break;
case 'clear_metabox_prefs':
NgfbUser::delete_metabox_prefs(get_current_user_id());
break;
case 'change_display_options':
if (isset($this->p->cf['form']['display_options'][$_GET['display_options']])) {
$this->p->options['plugin_display'] = $_GET['display_options'];
}
$this->p->opt->save_options(NGFB_OPTIONS_NAME, $this->p->options);
break;
}
}
}
// the plugin information metabox on all settings pages needs this
$this->p->admin->set_readme_info($this->feed_cache_expire());
// add child metaboxes first, since they contain the default reset_metabox_prefs()
$this->p->admin->submenu[$this->menu_id]->add_meta_boxes();
if (empty($this->p->options['plugin_' . $this->p->cf['lca'] . '_tid']) || !$this->p->check->aop()) {
add_meta_box($this->pagehook . '_purchase', __('Pro Version', NGFB_TEXTDOM), array(&$this, 'show_metabox_purchase'), $this->pagehook, 'side');
add_filter('postbox_classes_' . $this->pagehook . '_' . $this->pagehook . '_purchase', array(&$this, 'add_class_postbox_highlight_side'));
$this->p->addons['util']['user']->reset_metabox_prefs($this->pagehook, array('purchase'), null, 'side', true);
}
add_meta_box($this->pagehook . '_help', __('Help and Support', NGFB_TEXTDOM), array(&$this, 'show_metabox_help'), $this->pagehook, 'side');
add_meta_box($this->pagehook . '_info', __('Version Information', NGFB_TEXTDOM), array(&$this, 'show_metabox_info'), $this->pagehook, 'side');
add_meta_box($this->pagehook . '_status_gpl', __('Standard Features', NGFB_TEXTDOM), array(&$this, 'show_metabox_status_gpl'), $this->pagehook, 'side');
add_meta_box($this->pagehook . '_status_pro', __('Pro Features', NGFB_TEXTDOM), array(&$this, 'show_metabox_status_pro'), $this->pagehook, 'side');
}
示例13: 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();
}
}
示例14: 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;
}
}
示例15: save_settings
function save_settings()
{
$options = get_option($this->optionname);
if (isset($_REQUEST['reset']) && $_REQUEST['reset'] == "true" && isset($_REQUEST['plugin']) && $_REQUEST['plugin'] == 'google-analytics-for-wordpress') {
$options = $this->set_defaults();
$options['msg'] = "<div class=\"updated\"><p>" . __('Google Analytics settings reset.') . "</p></div>\n";
} elseif (isset($_POST['submit']) && isset($_POST['plugin']) && $_POST['plugin'] == 'google-analytics-for-wordpress') {
if (!current_user_can('manage_options')) {
die(__('You cannot edit the Google Analytics for WordPress options.'));
}
check_admin_referer('analyticspp-config');
foreach (array('uastring', 'dlextensions', 'domainorurl', 'position', 'domain', 'customcode', 'ga_token', 'extraseurl', 'gajsurl', 'gfsubmiteventpv', 'trackprefix', 'ignore_userlevel', 'internallink', 'internallinklabel', 'primarycrossdomain', 'othercrossdomains') as $option_name) {
if (isset($_POST[$option_name])) {
$options[$option_name] = $_POST[$option_name];
} else {
$options[$option_name] = '';
}
}
foreach (array('extrase', 'trackoutbound', 'admintracking', 'trackadsense', 'allowanchor', 'allowlinker', 'allowhash', 'rsslinktagging', 'advancedsettings', 'trackregistration', 'theme_updated', 'cv_loggedin', 'cv_authorname', 'cv_category', 'cv_all_categories', 'cv_tags', 'cv_year', 'cv_post_type', 'outboundpageview', 'downloadspageview', 'trackcrossdomain', 'gajslocalhosting', 'manual_uastring', 'taggfsubmit', 'wpec_tracking', 'shopp_tracking', 'anonymizeip', 'trackcommentform', 'debug', 'firebuglite', 'yoast_tracking') as $option_name) {
if (isset($_POST[$option_name]) && $_POST[$option_name] == 'on') {
$options[$option_name] = true;
} else {
$options[$option_name] = false;
}
}
if (isset($_POST['manual_uastring']) && isset($_POST['uastring_man'])) {
$options['uastring'] = $_POST['uastring_man'];
}
if ($options['trackcrossdomain']) {
if (!$options['allowlinker']) {
$options['allowlinker'] = true;
}
if (empty($options['primarycrossdomain'])) {
$origin = GA_Filter::ga_get_domain($_SERVER["HTTP_HOST"]);
$options['primarycrossdomain'] = $origin["domain"];
}
}
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
}
if (function_exists('w3tc_dbcache_flush')) {
w3tc_dbcache_flush();
}
if (function_exists('w3tc_minify_flush')) {
w3tc_minify_flush();
}
if (function_exists('w3tc_objectcache_flush')) {
w3tc_objectcache_flush();
}
if (function_exists('wp_cache_clear_cache')) {
wp_cache_clear_cache();
}
$options['msg'] = "<div id=\"updatemessage\" class=\"updated fade\"><p>Google Analytics <strong>settings updated</strong>.</p></div>\n";
$options['msg'] .= "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>";
}
update_option($this->optionname, $options);
}