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); }
/** * 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?'); } }
/** * 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); }
/** * 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(); } } }
/** * 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; }
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); } }
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(); }
/** * 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; }
/** * 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(); } } }
/** * 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(); } } }
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(); } }
/** * 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(); } }
/** * 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(); } }
/** * 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; } }
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'); }
public function clearCache() { if (SAM_WPSC) { global $blog_cache_dir, $wp_cache_object_cache; if ($wp_cache_object_cache) { reset_oc_version(); } else { prune_super_cache($blog_cache_dir, true); prune_super_cache(get_supercache_dir(), true); } return __('Cache of WP Super Cache plugin is flushed.', SAM_DOMAIN); } elseif (SAM_W3TC) { if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } if (function_exists('w3tc_dbcache_flush')) { w3tc_dbcache_flush(); } return __('Cache of W3 Total Cache plugin is flushed.', SAM_DOMAIN); } else { return ''; } }
/** * Save config, can't decline save process. (difference from action_save) * * Do some actions on config keys update * Used in several places such as: * * 1. common config save * 2. import settings * * @param W3_Config $current_config * @param W3_Config $new_config * @param W3_ConfigAdmin $new_config_admin * @return bool * @throws Exception */ function w3_config_save($current_config, $new_config, $new_config_admin) { $master_config = $new_config->is_master() ? $new_config : new W3_Config(true); if ($master_config->get_integer('common.instance_id', 0) == 0) { $master_config->set('common.instance_id', mt_rand()); if (!$new_config->is_master()) { $master_config->save(); } } $old_config = new W3_Config(); $browsercache_dependencies = array(); if ($new_config->get_boolean('browsercache.enabled')) { $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.cssjs.replace', 'browsercache.html.replace', 'browsercache.other.replace')); if ($new_config->get_boolean('browsercache.cssjs.replace')) { $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.cssjs.compression', 'browsercache.cssjs.expires', 'browsercache.cssjs.lifetime', 'browsercache.cssjs.cache.control', 'browsercache.cssjs.cache.policy', 'browsercache.cssjs.etag', 'browsercache.cssjs.w3tc')); } if ($new_config->get_boolean('browsercache.html.replace')) { $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.html.compression', 'browsercache.html.expires', 'browsercache.html.lifetime', 'browsercache.html.cache.control', 'browsercache.html.cache.policy', 'browsercache.html.etag', 'browsercache.html.w3tc')); } if ($new_config->get_boolean('browsercache.other.replace')) { $browsercache_dependencies = array_merge($browsercache_dependencies, array('browsercache.other.compression', 'browsercache.other.expires', 'browsercache.other.lifetime', 'browsercache.other.cache.control', 'browsercache.other.cache.policy', 'browsercache.other.etag', 'browsercache.other.w3tc')); } } /** * Show need empty page cache notification */ if ($new_config->get_boolean('pgcache.enabled')) { $pgcache_dependencies = array_merge($browsercache_dependencies, array('pgcache.debug', 'dbcache.enabled', 'objectcache.enabled', 'minify.enabled', 'mobile.enabled', 'referrer.enabled')); if ($new_config->get_boolean('dbcache.enabled')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('dbcache.debug')); } if ($new_config->get_boolean('objectcache.enabled')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('objectcache.debug')); } if ($new_config->get_boolean('minify.enabled')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('minify.auto', 'minify.debug', 'minify.rewrite', 'minify.html.enable', 'minify.html.engine', 'minify.html.inline.css', 'minify.html.inline.js', 'minify.html.strip.crlf', 'minify.html.comments.ignore', 'minify.css.enable', 'minify.css.engine', 'minify.css.groups', 'minify.js.enable', 'minify.js.engine', 'minify.js.groups', 'minify.htmltidy.options.clean', 'minify.htmltidy.options.hide-comments', 'minify.htmltidy.options.wrap', 'minify.reject.logged', 'minify.reject.ua', 'minify.reject.uri')); } /** * @var W3_ModuleStatus $modules */ $modules = w3_instance('W3_ModuleStatus'); if ($modules->is_running('cdn')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('cdn.enabled', 'cdn.debug', 'cdn.engine', 'cdn.uploads.enable', 'cdn.includes.enable', 'cdn.includes.files', 'cdn.theme.enable', 'cdn.theme.files', 'cdn.minify.enable', 'cdn.custom.enable', 'cdn.custom.files', 'cdn.ftp.domain', 'cdn.ftp.ssl', 'cdn.s3.cname', 'cdn.s3.ssl', 'cdn.cf.cname', 'cdn.cf.ssl', 'cdn.cf2.cname', 'cdn.cf2.ssl', 'cdn.rscf.cname', 'cdn.rscf.ssl', 'cdn.azure.cname', 'cdn.azure.ssl', 'cdn.mirror.domain', 'cdn.mirror.ssl', 'cdn.netdna.domain', 'cdn.netdna.ssl', 'cdn.cotendo.domain', 'cdn.cotendo.ssl', 'cdn.edgecast.domain', 'cdn.edgecast.ssl', 'cdn.att.domain', 'cdn.att.ssl', 'cdn.reject.logged_roles', 'cdn.reject.roles', 'cdn.reject.ua', 'cdn.reject.uri', 'cdn.reject.files')); } elseif ($old_config->get_boolean('cdn.enabled') && !$new_config->get_boolean('cdn.enabled')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('cdn.enabled')); } if ($new_config->get_boolean('mobile.enabled')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('mobile.rgroups')); } if ($new_config->get_boolean('referrer.enabled')) { $pgcache_dependencies = array_merge($pgcache_dependencies, array('referrer.rgroups')); } if ($new_config->get_boolean('browsercache.enabled') && $new_config->get_string('pgcache.engine') == 'file_generic') { $pgcache_dependencies = array_merge($pgcache_dependencies, array('browsercache.html.last_modified', 'browsercache.other.last_modified')); } $old_pgcache_dependencies_values = array(); $new_pgcache_dependencies_values = array(); foreach ($pgcache_dependencies as $pgcache_dependency) { $old_pgcache_dependencies_values[] = $old_config->get($pgcache_dependency); $new_pgcache_dependencies_values[] = $new_config->get($pgcache_dependency); } if (serialize($old_pgcache_dependencies_values) != serialize($new_pgcache_dependencies_values)) { $new_config->set('notes.need_empty_pgcache', true); } } /** * Show need empty minify notification */ if ($current_config->get_boolean('minify.enabled') && $new_config->get_boolean('minify.enabled') && ($new_config->get_boolean('minify.css.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.css.groups'))) || $new_config->get_boolean('minify.js.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.js.groups'))))) { $minify_dependencies = array_merge($browsercache_dependencies, array('minify.auto', 'minify.debug', 'minify.options', 'minify.symlinks', 'minify.css.enable', 'minify.js.enable')); if ($new_config->get_boolean('minify.css.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.css.groups')))) { $minify_dependencies = array_merge($minify_dependencies, array('minify.css.engine', 'minify.css.combine', 'minify.css.strip.comments', 'minify.css.strip.crlf', 'minify.css.imports', 'minify.css.groups', 'minify.yuicss.path.java', 'minify.yuicss.path.jar', 'minify.yuicss.options.line-break', 'minify.csstidy.options.remove_bslash', 'minify.csstidy.options.compress_colors', 'minify.csstidy.options.compress_font-weight', 'minify.csstidy.options.lowercase_s', 'minify.csstidy.options.optimise_shorthands', 'minify.csstidy.options.remove_last_;', 'minify.csstidy.options.case_properties', 'minify.csstidy.options.sort_properties', 'minify.csstidy.options.sort_selectors', 'minify.csstidy.options.merge_selectors', 'minify.csstidy.options.discard_invalid_properties', 'minify.csstidy.options.css_level', 'minify.csstidy.options.preserve_css', 'minify.csstidy.options.timestamp', 'minify.csstidy.options.template')); } if ($new_config->get_boolean('minify.js.enable') && ($new_config->get_boolean('minify.auto') || count($new_config->get_array('minify.js.groups')))) { $minify_dependencies = array_merge($minify_dependencies, array('minify.js.engine', 'minify.js.combine.header', 'minify.js.combine.body', 'minify.js.combine.footer', 'minify.js.strip.comments', 'minify.js.strip.crlf', 'minify.js.groups', 'minify.yuijs.path.java', 'minify.yuijs.path.jar', 'minify.yuijs.options.line-break', 'minify.yuijs.options.nomunge', 'minify.yuijs.options.preserve-semi', 'minify.yuijs.options.disable-optimizations', 'minify.ccjs.path.java', 'minify.ccjs.path.jar', 'minify.ccjs.options.compilation_level', 'minify.ccjs.options.formatting')); } /** * @var W3_ModuleStatus $modules */ $modules = w3_instance('W3_ModuleStatus'); if ($modules->is_running('cdn')) { $minify_dependencies = array_merge($minify_dependencies, array('cdn.engine', 'cdn.enabled')); } elseif ($old_config->get_boolean('cdn.enabled') && !$new_config->get_boolean('cdn.enabled')) { $minify_dependencies = array_merge($minify_dependencies, array('cdn.enabled')); } $old_minify_dependencies_values = array(); $new_minify_dependencies_values = array(); foreach ($minify_dependencies as $minify_dependency) { $old_minify_dependencies_values[] = $old_config->get($minify_dependency); $new_minify_dependencies_values[] = $new_config->get($minify_dependency); } if (serialize($old_minify_dependencies_values) != serialize($new_minify_dependencies_values)) { $new_config->set('notes.need_empty_minify', true); } } if ($new_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($new_config->get_string('cdn.engine'))) { /** * Show notification when CDN enabled */ if (!$old_config->get_boolean('cdn.enabled')) { $new_config->set('notes.cdn_upload', true); } /** * Show notification when Browser Cache settings changes */ $cdn_dependencies = array('browsercache.enabled'); if ($new_config->get_boolean('cdn.enabled')) { $cdn_dependencies = array('browsercache.cssjs.compression', 'browsercache.cssjs.expires', 'browsercache.cssjs.lifetime', 'browsercache.cssjs.cache.control', 'browsercache.cssjs.cache.policy', 'browsercache.cssjs.etag', 'browsercache.cssjs.w3tc', 'browsercache.html.compression', 'browsercache.html.expires', 'browsercache.html.lifetime', 'browsercache.html.cache.control', 'browsercache.html.cache.policy', 'browsercache.html.etag', 'browsercache.html.w3tc', 'browsercache.other.compression', 'browsercache.other.expires', 'browsercache.other.lifetime', 'browsercache.other.cache.control', 'browsercache.other.cache.policy', 'browsercache.other.etag', 'browsercache.other.w3tc'); } $old_cdn_dependencies_values = array(); $new_cdn_dependencies_values = array(); foreach ($cdn_dependencies as $cdn_dependency) { $old_cdn_dependencies_values[] = $old_config->get($cdn_dependency); $new_cdn_dependencies_values[] = $new_config->get($cdn_dependency); } if (serialize($old_cdn_dependencies_values) != serialize($new_cdn_dependencies_values)) { $new_config->set('notes.cdn_reupload', true); } } /** * Show need empty object cache notification */ if ($current_config->get_boolean('objectcache.enabled')) { $objectcache_dependencies = array('objectcache.groups.global', 'objectcache.groups.nonpersistent'); $old_objectcache_dependencies_values = array(); $new_objectcache_dependencies_values = array(); foreach ($objectcache_dependencies as $objectcache_dependency) { $old_objectcache_dependencies_values[] = $old_config->get($objectcache_dependency); $new_objectcache_dependencies_values[] = $new_config->get($objectcache_dependency); } if (serialize($old_objectcache_dependencies_values) != serialize($new_objectcache_dependencies_values)) { $new_config->set('notes.need_empty_objectcache', true); } } if ($current_config->get_boolean('newrelic.enabled')) { if ($current_config->get_boolean('pgcache.enabled')) { if (w3_is_network() && $current_config->get_boolean('common.force_master')) { $new_config->set('pgcache.late_init', true); } } } do_action('w3tc_saved_options', $new_config, $new_config_admin); /** * Save config */ try { $new_config_admin->save(); $new_config->save(); } catch (Exception $ex) { // try to fix environment, it potentially can be fixed silently // dont show error here, it will be called again later // in admin_notices try { $environment = w3_instance('W3_AdminEnvironment'); $environment->fix_in_wpadmin($new_config); } catch (Exception $ex) { } // retry save process and complain now on failure try { $new_config_admin->save(); $new_config->save(); } catch (Exception $ex) { throw new Exception('<strong>Can\'t change configuration</strong>: ' . $ex->getMessage()); } } $w3_plugin_cdn = w3_instance('W3_Plugin_CdnAdmin'); /** * Empty caches on engine change or cache enable/disable */ if ($old_config->get_string('pgcache.engine') != $new_config->get_string('pgcache.engine') || $old_config->get_string('pgcache.enabled') != $new_config->get_string('pgcache.enabled')) { w3tc_pgcache_flush(); } if ($old_config->get_string('dbcache.engine') != $new_config->get_string('dbcache.engine') || $old_config->get_string('dbcache.enabled') != $new_config->get_string('dbcache.enabled')) { w3tc_dbcache_flush(); } if ($old_config->get_string('objectcache.engine') != $new_config->get_string('objectcache.engine') || $old_config->get_string('objectcache.enabled') != $new_config->get_string('objectcache.enabled')) { w3tc_objectcache_flush(); } if ($old_config->get_string('minify.engine') != $new_config->get_string('minify.engine') || $old_config->get_string('minify.enabled') != $new_config->get_string('minify.enabled')) { w3tc_minify_flush(); } /** * Update CloudFront CNAMEs */ $update_cf_cnames = false; if ($new_config->get_boolean('cdn.enabled') && in_array($new_config->get_string('cdn.engine'), array('cf', 'cf2'))) { if ($new_config->get_string('cdn.engine') == 'cf') { $old_cnames = $old_config->get_array('cdn.cf.cname'); $new_cnames = $new_config->get_array('cdn.cf.cname'); } else { $old_cnames = $old_config->get_array('cdn.cf2.cname'); $new_cnames = $new_config->get_array('cdn.cf2.cname'); } if (count($old_cnames) != count($new_cnames) || count(array_diff($old_cnames, $new_cnames))) { $update_cf_cnames = true; } } /** * Refresh config */ $current_config->load(); /** * React to config changes */ $environment = w3_instance('W3_AdminEnvironment'); $environment->fix_on_event($new_config, 'config_change', $old_config); /** * Update support us option */ w3_instance('W3_AdminLinks')->link_update($current_config); /** * Auto upload minify files to CDN */ if ($new_config->get_boolean('minify.enabled') && $new_config->get_boolean('minify.upload') && $new_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($new_config->get_string('cdn.engine'))) { w3_cdn_upload_minify(); } /** * Auto upload browsercache files to CDN */ if ($new_config->get_boolean('cdn.enabled') && $new_config->get_string('cdn.engine') == 'ftp') { w3_cdn_delete_browsercache($current_config); w3_cdn_upload_browsercache($current_config); } /** * Update CloudFront CNAMEs */ if ($update_cf_cnames) { $error = null; $w3_plugin_cdn->update_cnames($error); } return true; }
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); } } } } } } } } } }
/** * 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); } }
private function clear_cache_plugins() { /* Not implemented yet - still testing */ /*** * Automatically clears page caches after plugin install or upgrade * Called from upgrade_check() * Added 1.9.6.2 ***/ global $wpss_cache_check, $wp_fastest_cache; if (empty($wpss_cache_check)) { $wpss_cache_check = rs_wpss_check_cache_status(); } if ($wpss_cache_check['cache_check_status'] === 'ACTIVE') { if (rs_wpss_is_plugin_active('w3-total-cache/w3-total-cache.php') && function_exists('w3tc_pgcache_flush')) { /* W3 Total Cache */ w3tc_pgcache_flush(); } if (rs_wpss_is_plugin_active('wp-super-cache/wp-cache.php') && function_exists('wp_cache_clean_cache')) { /* WP Super Cache */ global $file_prefix; wp_cache_clean_cache($file_prefix); } if (rs_wpss_is_plugin_active('wp-fastest-cache/wpFastestCache.php') && !empty($wp_fastest_cache) && method_exists('WpFastestCache', 'deleteCache')) { /* WP Fastest Cache */ $wp_fastest_cache->deleteCache(); } if (class_exists('WPE_API', FALSE) && class_exists('WpeCommon')) { /* WP Engine Hosting */ if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); } if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { WpeCommon::clear_maxcdn_cache(); } if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); } } } }
public function w3tc_flush($flushAll = false) { if ($flushAll) { if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } if (function_exists('w3tc_dbcache_flush')) { w3tc_dbcache_flush(); } } if (function_exists('w3tc_objectcache_flush')) { w3tc_objectcache_flush(); } }
function wppa_clear_cache($force = false) { global $cache_path; // If wp-super-cache is on board, clear cache if (function_exists('prune_super_cache')) { prune_super_cache($cache_path . 'supercache/', true); prune_super_cache($cache_path, true); } // W3 Total cache if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } // SG_CachePress /* if ( class_exists( 'SG_CachePress_Supercacher' ) ) { $c = new SG_CachePress_Supercacher(); @ $c->purge_cache(); } */ // Quick cache if (isset($GLOBALS['quick_cache'])) { $GLOBALS['quick_cache']->clear_cache(); } // At a setup or update operation // Manually remove the content of wp-content/cache/ if ($force) { if (is_dir(WPPA_CONTENT_PATH . '/cache/')) { wppa_tree_empty(WPPA_CONTENT_PATH . '/cache'); } } }
// @ini_set( 'max_execution_time', '300' ); add_filter('social_funnel_development_mode', '__return_true'); add_action('admin_enqueue_scripts', 'sf_backend_enqueue_scripts'); //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);
protected function flushCaches() { if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } }
public static function emptyCache() { if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } if (function_exists('wp_cache_clear_cache')) { wp_cache_clear_cache(); } }
public static function clear_cache() { // W3 Total Cache plugin if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } // WP Super Cache if (function_exists('wp_cache_clear_cache')) { wp_cache_clear_cache(); } // Hyper Cache if (function_exists('hyper_cache_invalidate')) { hyper_cache_invalidate(); } // Quick Cache if (function_exists('auto_clear_cache')) { auto_clear_cache(); } }
function admin_header($title, $expl = true, $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'); if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); $msg .= __(' & W3 Total Cache Page Cache flushed'); } else { if (function_exists('wp_cache_clear_cache() ')) { wp_cache_clear_cache(); $msg .= __(' & WP Super Cache flushed'); } } // 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><?php _e("Yoast WordPress SEO: " . $title, 'yoast-wpseo'); ?> </h2> <div class="postbox-container" style="width:70%;"> <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; // Set some of the ignore booleans here to prevent unsetting. echo $this->hidden('ignore_blog_public_warning'); echo $this->hidden('ignore_page_comments'); echo $this->hidden('ignore_permalink'); echo $this->hidden('ms_defaults_set'); } if ($expl) { $this->postbox('pluginsettings', __('Plugin Settings', 'yoast-wpseo'), $this->checkbox('disableexplanation', __('Hide verbose explanations of settings', 'yoast-wpseo'))); } }
/** * On deactivation, flush the rewrite rules so XML sitemaps stop working. */ function wpseo_deactivate() { wpseo_flush_rules(); // Clear cache so the changes are obvious. if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } else { if (function_exists('wp_cache_clear_cache')) { wp_cache_clear_cache(); } } }
/** * Clear cache from: * - W3TC, * - WordPress Total Cache * - WPEngine * - Varnish */ public function clear_cache() { /** * 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; wp_cache_clean_cache($file_prefix); } else { if (class_exists('WpeCommon')) { WpeCommon::purge_memcached(); WpeCommon::clear_maxcdn_cache(); WpeCommon::purge_varnish_cache(); } } } /** * Clear Varnish caches */ if ('file' == $this->mode() && Avada()->settings->get('cache_server_ip')) { $this->clear_varnish_cache($this->file('url')); } }
private function clear_cache_plugins() { /* Not fully implemented yet - still testing */ /** * Automatically clears page caches after plugin install or upgraded * Called from upgrade_check() * Added 1.9.6.2, Modified 1.9.7.5 */ global $wpss_cache_check, $wp_fastest_cache, $file_prefix, $supercachedir; /* Flush Memcache(d) */ $flush_memcache = wp_cache_flush(); return; /* Temp - 1.9.7.5 */ /* Check if cache plugins or server-side caching active */ if (empty($wpss_cache_check)) { $wpss_cache_check = rs_wpss_check_cache_status(); } if ($wpss_cache_check['cache_check_status'] === 'ACTIVE') { if (WPSS_Compatibility::is_plugin_active('w3-total-cache/w3-total-cache.php') && function_exists('w3tc_pgcache_flush')) { /* W3 Total Cache */ w3tc_pgcache_flush(); } if (WPSS_Compatibility::is_plugin_active('wp-super-cache/wp-cache.php') && function_exists('wp_cache_clean_cache')) { /* WP Super Cache */ if (empty($supercachedir) && function_exists('get_supercache_dir')) { $supercachedir = get_supercache_dir(); } wp_cache_clean_cache($file_prefix); } if (WPSS_Compatibility::is_plugin_active('wp-fastest-cache/wpFastestCache.php') && method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) { /* WP Fastest Cache */ $wp_fastest_cache->deleteCache(); } if (class_exists('WPE_API', FALSE) && class_exists('WpeCommon')) { /* WP Engine Hosting */ if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); } if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { WpeCommon::clear_maxcdn_cache(); } if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); } } /* Add Autoptimize & other Cache Plugins... */ } }