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);
 }
 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;
 }
Пример #3
0
 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.');
 }
Пример #4
0
 /**
  * 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();
         }
     }
 }
Пример #5
0
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 .= __(' &amp; WP Super Cache flushed');
    }
    return $msg;
}
Пример #6
0
 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
0
/**
 * 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;
}
 /**
  * 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();
         }
     }
 }
 /**
  * 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();
         }
     }
 }
Пример #10
0
 /**
  * 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() . '');
         }
     }
 }
Пример #11
0
 /**
  * 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();
         }
     }
 }
Пример #12
0
 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();
     }
 }
Пример #13
0
 /**
  * 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?');
     }
 }
Пример #14
0
 /**
  * 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;
 }
Пример #15
0
 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;
     }
 }
Пример #16
0
 /**
  * Checks if the plugin was recently updated and upgrades if necessary
  * @author Ian Dunn <*****@*****.**>
  */
 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();
         }
     }
 }
Пример #17
0
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);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Пример #18
0
    /**
     * 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 .= __(' &amp; W3 Total Cache Page Cache flushed', 'wordpress-seo');
            } else {
                if (function_exists('wp_cache_clear_cache')) {
                    wp_cache_clear_cache();
                    $msg .= __(' &amp; 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;
        }
    }
Пример #19
0
 /**
  * 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);
     }
 }
Пример #20
0
    //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__));
 /**
  * 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();
     }
 }
Пример #22
0
 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');
 }
Пример #23
0
function print_PingdomRUM_management()
{
    if (isset($_POST['submit'])) {
        if (!current_user_can('manage_options')) {
            wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
        }
        $code = trim($_POST['pingdom_rum_code']);
        $cache = get_option('pingdom_rum_code');
        if (empty($code)) {
            delete_option('pingdom_rum_code');
        } else {
            if ($cache != $code) {
                update_option('pingdom_rum_code', $code);
            }
        }
        // Clear WP-Super Cache on POST
        if (function_exists('wp_cache_clear_cache')) {
            wp_cache_clear_cache();
        }
        ?>
<div id="message" class="updated fade"><p><strong><?php 
        esc_attr_e('Options saved.');
        ?>
</strong></p></div>
<?php 
    }
    wp_enqueue_style("pingdom-rum", plugin_dir_url("/", __FILE__) . trim(dirname(plugin_basename(__FILE__)), '/') . "/pingdom.css");
    ?>
<div class="wrap">
    <img src="<?php 
    echo plugin_dir_url("/", __FILE__) . trim(dirname(plugin_basename(__FILE__)), '/');
    ?>
/img-pingdom-logo.png" alt="Pingdom logo" />
    <h2><?php 
    esc_attr_e('Real User Monitoring', 'pingdom-rum');
    ?>
</h2>
    <p><?php 
    _e('Please enter your Pingdom Real User Monitoring Site ID. If you do not yet have an account, go get one at <a href="https://www.pingdom.com/signup/">Pingdom.com</a>!', 'pingdom-rum');
    ?>
</p>
    <p><?php 
    _e('To get your ID, login at <a href="https://my.pingdom.com/">My Pingdom</a>, go to "RUM" and edit or create your check. In the JavaScript code, look for something like this:', 'pingdom-rum');
    ?>
</p>
    <p><code>var _prum = [['id', '1a2b3c4e5f6a7b8c9d0e1f2a'],</code></p>
    <p><?php 
    _e('In this example the <strong>Site ID</strong> is:', 'pingdom-rum');
    ?>
</p>
    <p><code>1a2b3c4e5f6a7b8c9d0e1f2a</code></p>

    <form method="post" action="" class="pingdom-form">
        <h3><?php 
    esc_attr_e('Your Real User Monitoring Site ID', 'pingdom-rum');
    ?>
</h3>
        <input name="pingdom_rum_code" type="text" id="pingdom_rum_code" value="<?php 
    echo get_option('pingdom_rum_code');
    ?>
" class="pingdom-input" maxlength="24" placeholder="e.g. 1a2b3c4e5f6a7b8c9d0e1f2a" />
        <input type="submit" name="submit" class="pingdom-button" value="<?php 
    esc_attr_e('Save Changes');
    ?>
" />
        <p class="pingdom-description"><?php 
    esc_attr_e('Leave empty to remove', 'pingdom-rum');
    ?>
</span>
    </form>

</div>
<?php 
}
Пример #24
0
 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();
     }
 }
Пример #25
0
function wp_cache_check_site()
{
    global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification;
    if (!isset($wp_super_cache_front_page_check) || isset($wp_super_cache_front_page_check) && $wp_super_cache_front_page_check == 0) {
        return false;
    }
    if (function_exists("wp_remote_get") == false) {
        return false;
    }
    $front_page = wp_remote_get(site_url(), array('timeout' => 60, 'blocking' => true));
    if (is_array($front_page)) {
        // Check for gzipped front page
        if ($front_page['headers']['content-type'] == 'application/x-gzip') {
            if (!isset($wp_super_cache_front_page_clear) || isset($wp_super_cache_front_page_clear) && $wp_super_cache_front_page_clear == 0) {
                wp_mail(get_option('admin_email'), sprintf(__('[%s] Front page is gzipped! Please clear cache!', 'wp-super-cache'), site_url()), sprintf(__("Please visit %s to clear the cache as the front page of your site is now downloading!", 'wp-super-cache'), trailingslashit(site_url()) . "wp-admin/options-general.php?page=wpsupercache"));
            } else {
                wp_cache_clear_cache();
                wp_mail(get_option('admin_email'), sprintf(__('[%s] Front page is gzipped! Cache Cleared!', 'wp-super-cache'), site_url()), sprintf(__("The cache on your blog has been cleared because the front page of your site is now downloading. Please visit %s to verify the cache has been cleared.", 'wp-super-cache'), trailingslashit(site_url()) . "wp-admin/options-general.php?page=wpsupercache"));
            }
        }
        // Check for broken front page
        if (isset($wp_super_cache_front_page_text) && $wp_super_cache_front_page_text != '' && false === strpos($front_page['body'], $wp_super_cache_front_page_text)) {
            if (!isset($wp_super_cache_front_page_clear) || isset($wp_super_cache_front_page_clear) && $wp_super_cache_front_page_clear == 0) {
                wp_mail(get_option('admin_email'), sprintf(__('[%s] Front page is not correct! Please clear cache!', 'wp-super-cache'), site_url()), sprintf(__('Please visit %1$s to clear the cache as the front page of your site is not correct and missing the text, "%2$s"!', 'wp-super-cache'), trailingslashit(site_url()) . "wp-admin/options-general.php?page=wpsupercache", $wp_super_cache_front_page_text));
            } else {
                wp_cache_clear_cache();
                wp_mail(get_option('admin_email'), sprintf(__('[%s] Front page is not correct! Cache Cleared!', 'wp-super-cache'), site_url()), sprintf(__('The cache on your blog has been cleared because the front page of your site is missing the text "%2$s". Please visit %1$s to verify the cache has been cleared.', 'wp-super-cache'), trailingslashit(site_url()) . "wp-admin/options-general.php?page=wpsupercache", $wp_super_cache_front_page_text));
            }
        }
    }
    if (isset($wp_super_cache_front_page_notification) && $wp_super_cache_front_page_notification == 1) {
        wp_mail(get_option('admin_email'), sprintf(__('[%s] Front page check!', 'wp-super-cache'), site_url()), sprintf(__("WP Super Cache has checked the front page of your blog. Please visit %s if you would like to disable this.", 'wp-super-cache') . "\n\n", trailingslashit(site_url()) . "wp-admin/options-general.php?page=wpsupercache#debug") . print_r($front_page, 1));
    }
    if (!wp_next_scheduled('wp_cache_check_site_hook')) {
        wp_schedule_single_event(time() + 360, 'wp_cache_check_site_hook');
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('scheduled wp_cache_check_site_hook for 360 seconds time.', 2);
        }
    }
}
Пример #26
0
 public static function emptyCache()
 {
     if (function_exists('w3tc_pgcache_flush')) {
         w3tc_pgcache_flush();
     }
     if (function_exists('wp_cache_clear_cache')) {
         wp_cache_clear_cache();
     }
 }
Пример #27
0
        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 .= __(' &amp; W3 Total Cache Page Cache flushed');
                } else {
                    if (function_exists('wp_cache_clear_cache() ')) {
                        wp_cache_clear_cache();
                        $msg .= __(' &amp; 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')));
            }
        }
Пример #28
0
 /**
  * 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();
     }
 }
 /**
  * Clear the cache when the Cherry Mega Menu is updated.
  *
  * @since 1.0.0
  */
 public function clear_caches()
 {
     // https://wordpress.org/plugins/widget-output-cache/
     if (function_exists('menu_output_cache_bump')) {
         menu_output_cache_bump();
     }
     // https://wordpress.org/plugins/widget-output-cache/
     if (function_exists('widget_output_cache_bump')) {
         widget_output_cache_bump();
     }
     // https://wordpress.org/plugins/wp-super-cache/
     if (function_exists('wp_cache_clear_cache')) {
         global $wpdb;
         wp_cache_clear_cache($wpdb->blogid);
     }
 }
/**
 * 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();
        }
    }
}