コード例 #1
0
<?php

/**
 * W3 Total Cache advanced cache module
 */
if (!defined('W3TC_IN_MINIFY')) {
    if (!defined('W3TC_DIR')) {
        define('W3TC_DIR', WP_CONTENT_DIR . '/plugins/w3-total-cache');
    }
    if (!@is_dir(W3TC_DIR) || !file_exists(W3TC_DIR . '/inc/define.php')) {
        if (defined('WP_ADMIN')) {
            // lets don't show error on front end
            @header('HTTP/1.1 503 Service Unavailable');
            die(sprintf('<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', __FILE__));
        }
    } else {
        require_once W3TC_DIR . '/inc/define.php';
        require_once W3TC_LIB_W3_DIR . '/PgCache.php';
        $w3_pgcache =& W3_PgCache::instance();
        $w3_pgcache->process();
    }
}
コード例 #2
0
ファイル: PgCacheFlush.php プロジェクト: nxtclass/NXTClass
 /**
  * PHP5 Constructor
  */
 function __construct()
 {
     parent::__construct();
 }
コード例 #3
0
ファイル: wp_eMember1.php プロジェクト: phupx/genco
function wp_eMember_plugin_conflict_check()
{
    $emember_config = Emember_Config::getInstance();
    $msg = "";
    //Check schemea
    $installed_schema_version = get_option("wp_eMember_db_version");
    if ($installed_schema_version != WP_EMEMBER_DB_VERSION) {
        $msg .= '<div class="error"><p>It looks like you did not follow the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=3" target="_blank">WP eMember upgrade instruction</a> to update the plugin. The database schema is out of sync and need to be updated. Please deactivate the plugin and follow the <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=3" target="_blank">upgrade instruction from here</a> to upgrade the plugin and correct this.</p></div>';
    }
    $activation_flag_value = $emember_config->getValue('wp_eMember_plugin_activation_check_flag');
    if ($activation_flag_value != '1' && empty($msg)) {
        //no need check for conflict
        return;
    }
    if (function_exists('bb2_install')) {
        $msg .= '<div class="updated fade">You have the Bad Behavior plugin active! This plugin is known to block PayPal\'s payment notification (IPN). Please see <a href="http://www.tipsandtricks-hq.com/forum/topic/list-of-plugins-that-dont-play-nice-conflicting-plugins" target="_blank">this post</a> for more details.</div>';
    }
    if (function_exists('wp_cache_serve_cache_file')) {
        // WP Supercache is active
        $sc_integration_incomplete = false;
        global $wp_super_cache_late_init;
        if (false == isset($wp_super_cache_late_init) || isset($wp_super_cache_late_init) && $wp_super_cache_late_init == 0) {
            $sc_integration_incomplete = true;
        }
        if (defined('TIPS_AND_TRICKS_SUPER_CACHE_OVERRIDE')) {
            $sc_integration_incomplete = false;
        }
        if ($sc_integration_incomplete) {
            $msg .= '<div class="updated fade"><p>You have the WP Super Cache plugin active. Please make sure to follow <a href="http://www.tipsandtricks-hq.com/forum/topic/using-the-plugins-together-with-wp-super-cache-plugin" target="_blank">this instruction</a> to make it work with the WP eMember plugin. You can ignore this message if you have already applied the recommended changes.</p></div>';
        }
    }
    if (function_exists('w3tc_pgcache_flush') && class_exists('W3_PgCache')) {
        $integration_in_place = false;
        $w3_pgcache =& W3_PgCache::instance();
        foreach ($w3_pgcache->_config->get_array('pgcache.reject.cookie') as $reject_cookie) {
            if (strstr($reject_cookie, "eMember_in_use") !== false) {
                $integration_in_place = true;
            }
        }
        if (!$integration_in_place) {
            $msg .= '<div class="updated fade"><p>You have the W3 Total Cache plugin active. Please make sure to follow <a href="http://www.tipsandtricks-hq.com/forum/topic/using-the-plugins-with-w3-total-cache-plugin" target="_blank">these instructions</a> to make it work with the WP eMember plugin.</p></div>';
        }
    }
    //Check for duplicate copies of the eMember plugin
    $plugins_list = get_plugins();
    $plugin_names_arrray = array();
    foreach ($plugins_list as $plugin) {
        $plugin_names_arrray[] = $plugin['Name'];
    }
    $plugin_unqiue_count = array_count_values($plugin_names_arrray);
    if ($plugin_unqiue_count['WP eMember'] > 1) {
        $msg .= '<div class="error"><br />It looks like you have two copies (potentially different versions) of the WP eMember plugin in your plugins directory. This can be the source of many problems. Please delete every copy of the eMember plugin from your plugins directory to clean it out then upload one fresh copy. <a href="http://www.tipsandtricks-hq.com/wordpress-membership/?p=3" target="_blank">More Info</a><br /><br /></div>';
    }
    if (!empty($msg)) {
        echo $msg;
    } else {
        //Set this flag so it does not do the conflict check on every page load
        $emember_config->setValue('wp_eMember_plugin_activation_check_flag', '');
        $emember_config->saveConfig();
    }
}
コード例 #4
0
ファイル: plugin.php プロジェクト: niko-lgdcom/archives
/**
 * Shortcut for page post cache flush
 *
 * @param integer $post_id
 * @return boolean
 */
function w3tc_pgcache_flush_post($post_id)
{
    require_once W3TC_LIB_W3_DIR . '/PgCache.php';
    $w3_pgcache =& W3_PgCache::instance();
    return $w3_pgcache->flush_post($post_id);
}
コード例 #5
0
ファイル: TotalCache.php プロジェクト: niko-lgdcom/archives
 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback(&$buffer)
 {
     global $wpdb;
     if ($buffer != '' && w3_is_xml($buffer)) {
         if (w3_is_database_error($buffer)) {
             @header('HTTP/1.1 503 Service Unavailable');
         } else {
             /**
              * Replace links for preview mode
              */
             if (w3_is_preview_mode() && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] != W3TC_POWERED_BY) {
                 $domain_url_regexp = w3_get_domain_url_regexp();
                 $buffer = preg_replace_callback('~(href|src|action)=([\'"])(' . $domain_url_regexp . ')?(/[^\'"]*)~', array(&$this, 'link_replace_callback'), $buffer);
             }
             /**
              * Add footer comment
              */
             $date = date_i18n('Y-m-d H:i:s');
             $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
             if ($this->is_supported()) {
                 $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", w3_escape_comment($host), $date);
             } else {
                 $strings = array();
                 if ($this->_config->get_boolean('minify.enabled') && !$this->_config->get_boolean('minify.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
                     $w3_plugin_minify =& W3_Plugin_Minify::instance();
                     $strings[] = sprintf("Minified using %s%s", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('pgcache.enabled') && !$this->_config->get_boolean('pgcache.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/PgCache.php';
                     $w3_pgcache =& W3_PgCache::instance();
                     $strings[] = sprintf("Page Caching using %s%s", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : '');
                 }
                 if ($this->_config->get_boolean('dbcache.enabled') && !$this->_config->get_boolean('dbcache.debug') && is_a($wpdb, 'W3_Db')) {
                     $append = is_user_logged_in() ? ' (user is logged in)' : '';
                     if ($wpdb->query_hits) {
                         $strings[] = sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s", $wpdb->query_hits, $wpdb->query_total, $wpdb->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                     } else {
                         $strings[] = sprintf("Database Caching using %s%s", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                     }
                 }
                 if ($this->_config->get_boolean('objectcache.enabled') && !$this->_config->get_boolean('objectcache.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/ObjectCache.php';
                     $w3_objectcache =& W3_ObjectCache::instance();
                     $strings[] = sprintf("Object Caching %d/%d objects using %s", $w3_objectcache->cache_hits, $w3_objectcache->cache_total, w3_get_engine_name($this->_config->get_string('objectcache.engine')));
                 }
                 if ($this->_config->get_boolean('cdn.enabled') && !$this->_config->get_boolean('cdn.debug')) {
                     require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php';
                     $w3_plugin_cdn =& W3_Plugin_Cdn::instance();
                     $cdn =& $w3_plugin_cdn->get_cdn();
                     $via = $cdn->get_via();
                     $strings[] = sprintf("Content Delivery Network via %s%s", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : '');
                 }
                 $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n";
                 if (count($strings)) {
                     $buffer .= "\r\n" . implode("\r\n", $strings) . "\r\n";
                 }
                 $buffer .= sprintf("\r\nServed from: %s @ %s -->", w3_escape_comment($host), $date);
             }
         }
     }
     return $buffer;
 }
コード例 #6
0
 /**
  * Change action
  */
 function on_change()
 {
     static $flushed = false;
     if (!$flushed) {
         require_once W3TC_LIB_W3_DIR . '/PgCache.php';
         $w3_pgcache =& W3_PgCache::instance();
         $w3_pgcache->flush();
     }
 }
コード例 #7
0
ファイル: TotalCache.php プロジェクト: alx/SBek-Arak
 /**
  * Output buffering callback
  *
  * @param string $buffer
  * @return string
  */
 function ob_callback($buffer)
 {
     global $wpdb;
     if ($buffer != '' && w3_is_xml($buffer)) {
         $date = date('Y-m-d H:i:s');
         $host = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost';
         if ($this->is_supported()) {
             $buffer .= sprintf("\r\n<!-- Served from: %s @ %s by W3 Total Cache -->", $host, $date);
         } else {
             $buffer .= "\r\n<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/\r\n\r\n";
             if ($this->_config->get_boolean('minify.enabled')) {
                 require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
                 $w3_plugin_minify =& W3_Plugin_Minify::instance();
                 $buffer .= sprintf("Minified using %s%s\r\n", w3_get_engine_name($this->_config->get_string('minify.engine')), $w3_plugin_minify->minify_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_minify->minify_reject_reason) : '');
             }
             if ($this->_config->get_boolean('pgcache.enabled')) {
                 require_once W3TC_LIB_W3_DIR . '/PgCache.php';
                 $w3_pgcache =& W3_PgCache::instance();
                 $buffer .= sprintf("Page Caching using %s%s\r\n", w3_get_engine_name($this->_config->get_string('pgcache.engine')), $w3_pgcache->cache_reject_reason != '' ? sprintf(' (%s)', $w3_pgcache->cache_reject_reason) : '');
             }
             if ($this->_config->get_boolean('dbcache.enabled') && is_a($wpdb, 'W3_Db')) {
                 $append = is_user_logged_in() ? ' (user is logged in)' : '';
                 if ($wpdb->query_hits) {
                     $buffer .= sprintf("Database Caching %d/%d queries in %.3f seconds using %s%s\r\n", $wpdb->query_hits, $wpdb->query_total, $wpdb->time_total, w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                 } else {
                     $buffer .= sprintf("Database Caching using %s%s\r\n", w3_get_engine_name($this->_config->get_string('dbcache.engine')), $append);
                 }
             }
             if ($this->_config->get_boolean('cdn.enabled')) {
                 require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php';
                 $w3_plugin_cdn =& W3_Plugin_Cdn::instance();
                 $cdn =& $w3_plugin_cdn->get_cdn();
                 $via = $cdn->get_via();
                 $buffer .= sprintf("Content Delivery Network via %s%s\r\n", $via ? $via : 'N/A', $w3_plugin_cdn->cdn_reject_reason != '' ? sprintf(' (%s)', $w3_plugin_cdn->cdn_reject_reason) : '');
             }
             $buffer .= sprintf("\r\nServed from: %s @ %s -->", $host, $date);
         }
     }
     return $buffer;
 }