コード例 #1
0
 /**
  * Returns required rules for module
  *
  * @param W3_Config $config
  * @return array
  */
 public function get_required_rules($config)
 {
     if (!$config->get_boolean('browsercache.enabled')) {
         return null;
     }
     $rewrite_rules = array();
     $dispatcher = w3_instance('W3_Dispatcher');
     if ($dispatcher->should_browsercache_generate_rules_for_cdn($config)) {
         $domain = $dispatcher->get_cdn_domain();
         $cdn_rules_path = sprintf('ftp://%s/%s', $domain, w3_get_cdn_rules_path());
         $rewrite_rules[] = array('filename' => $cdn_rules_path, 'content' => $this->rules_cache_generate($config, true));
     }
     $browsercache_rules_cache_path = w3_get_browsercache_rules_cache_path();
     $rewrite_rules[] = array('filename' => $browsercache_rules_cache_path, 'content' => $this->rules_cache_generate($config));
     if ($config->get_boolean('browsercache.no404wp')) {
         $browsercache_rules_no404wp_path = w3_get_browsercache_rules_no404wp_path();
         $rewrite_rules[] = array('filename' => $browsercache_rules_no404wp_path, 'content' => $this->rules_no404wp_generate($config));
     }
     return $rewrite_rules;
 }
コード例 #2
0
 /**
  * Returns required rules for module
  * @return array
  */
 function get_required_rules()
 {
     $rewrite_rules = array();
     if ($this->_config->get_boolean('cdn.enabled') && $this->_config->get_string('cdn.engine') == 'ftp') {
         $domain = $this->_get_common()->get_cdn()->get_domain();
         $cdn_rules_path = sprintf('ftp://%s/%s', $domain, w3_get_cdn_rules_path());
         $rewrite_rules[] = array('filename' => $cdn_rules_path, 'content' => $this->generate_rules());
     }
     if ($this->_config->get_boolean('cdn.enabled') || $this->_config->get_boolean('cloudflare.enabled')) {
         $browsercache_rules_cache_path = w3_get_browsercache_rules_cache_path();
         $rewrite_rules[] = array('filename' => $browsercache_rules_cache_path, 'content' => $this->generate_rules());
     }
     return $rewrite_rules;
 }
コード例 #3
0
ファイル: admin.php プロジェクト: easinewe/Avec2016
/**
 * Deletes Browser Cache .htaccess from FTP
 *
 * @return void
 */
function w3_cdn_delete_browsercache()
{
    $w3_plugin_cdn = w3_instance('W3_Plugin_CdnCommon');
    $cdn_path = w3_get_cdn_rules_path();
    $tmp_path = W3TC_CACHE_TMP_DIR . '/' . $cdn_path;
    $results = array();
    $delete = array($w3_plugin_cdn->build_file_descriptor($tmp_path, $cdn_path));
    $w3_plugin_cdn->delete($delete, false, $results);
}
コード例 #4
0
ファイル: TotalCache.php プロジェクト: niko-lgdcom/archives
 /**
  * Deletes Browser Cache .htaccess from FTP
  *
  * @return void
  */
 function cdn_delete_browsercache()
 {
     require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php';
     $w3_plugin_cdn =& W3_Plugin_Cdn::instance();
     $cdn_path = w3_get_cdn_rules_path();
     $tmp_path = W3TC_TMP_DIR . '/' . $cdn_path;
     $results = array();
     $delete = array($tmp_path => $cdn_path);
     $w3_plugin_cdn->delete($delete, false, $results);
 }
コード例 #5
0
 /**
  * Returns required rules for module
  * @param W3_Config $config
  * @return array|null
  */
 function get_required_rules($config)
 {
     if (!$config->get_boolean('cdn.enabled')) {
         return null;
     }
     $rewrite_rules = array();
     $rules = $this->rules_generate($config);
     if (strlen($rules) > 0) {
         if ($config->get_string('cdn.engine') == 'ftp') {
             /**
              * @var W3_Plugin_CdnCommon $w3_plugin_cdncommon
              */
             $w3_plugin_cdncommon = w3_instance('W3_Plugin_CdnCommon');
             $domain = $w3_plugin_cdncommon->get_cdn()->get_domain();
             $cdn_rules_path = sprintf('ftp://%s/%s', $domain, w3_get_cdn_rules_path());
             $rewrite_rules[] = array('filename' => $cdn_rules_path, 'content' => $rules);
         }
         $path = w3_get_browsercache_rules_cache_path();
         $rewrite_rules[] = array('filename' => $path, 'content' => $rules);
     }
     return $rewrite_rules;
 }
コード例 #6
0
 /**
  * Deletes Browser Cache .htaccess from FTP
  *
  * @return void
  */
 function cdn_delete_browsercache()
 {
     $w3_plugin_cdn =& w3_instance('W3_Plugin_CdnCommon');
     $cdn_path = w3_get_cdn_rules_path();
     $tmp_path = W3TC_TMP_DIR . '/' . $cdn_path;
     $results = array();
     $delete = array($tmp_path => $cdn_path);
     $w3_plugin_cdn->delete($delete, false, $results);
 }