当前位置: 首页>>代码示例>>PHP>>正文


PHP Util_Environment::cache_blog_dir方法代码示例

本文整理汇总了PHP中Util_Environment::cache_blog_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::cache_blog_dir方法的具体用法?PHP Util_Environment::cache_blog_dir怎么用?PHP Util_Environment::cache_blog_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util_Environment的用法示例。


在下文中一共展示了Util_Environment::cache_blog_dir方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param array   $config
  */
 function __construct($config = array())
 {
     parent::__construct($config);
     if (isset($config['cache_dir'])) {
         $this->_cache_dir = trim($config['cache_dir']);
     } else {
         $this->_cache_dir = Util_Environment::cache_blog_dir($config['section'], $config['blog_id']);
     }
     $this->_exclude = isset($config['exclude']) ? (array) $config['exclude'] : array();
     $this->_flush_timelimit = isset($config['flush_timelimit']) ? (int) $config['flush_timelimit'] : 180;
     $this->_locking = isset($config['locking']) ? (bool) $config['locking'] : false;
     if (isset($config['flush_dir'])) {
         $this->_flush_dir = $config['flush_dir'];
     } else {
         if ($config['blog_id'] <= 0 && !isset($config['cache_dir'])) {
             // clear whole section if we operate on master cache
             // and in a mode when cache_dir not strictly specified
             $this->_flush_dir = Util_Environment::cache_dir($config['section']);
         } else {
             $this->_flush_dir = $this->_cache_dir;
         }
     }
     if (isset($config['use_wp_hash']) && $config['use_wp_hash']) {
         $this->_use_wp_hash = true;
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:31,代码来源:Cache_File.php

示例2: cleanup

 function cleanup()
 {
     $c = Dispatcher::config();
     $engine = $c->get_string(array('fragmentcache', 'engine'));
     switch ($engine) {
         case 'file':
             $w3_cache_file_cleaner = new Cache_File_Cleaner(array('cache_dir' => Util_Environment::cache_blog_dir('fragment'), 'clean_timelimit' => $c->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner->clean();
             break;
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:11,代码来源:Extension_FragmentCache_Core.php

示例3: cleanup_local

 function cleanup_local()
 {
     $engine = $this->_config->get_string('pgcache.engine');
     switch ($engine) {
         case 'file':
             $w3_cache_file_cleaner = new Cache_File_Cleaner(array('cache_dir' => Util_Environment::cache_blog_dir('page'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner->clean();
             break;
         case 'file_generic':
             if (Util_Environment::blog_id() == 0) {
                 $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
             } else {
                 $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . Util_Environment::host();
             }
             $w3_cache_file_cleaner_generic = new Cache_File_Cleaner_Generic(array('exclude' => array('.htaccess'), 'cache_dir' => $flush_dir, 'expire' => $this->_config->get_integer('browsercache.html.lifetime'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner_generic->clean();
             break;
     }
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:19,代码来源:PgCache_Plugin_Admin.php

示例4: _precache_file

 /**
  * Pre-caches external file
  *
  * @param string  $url
  * @param string  $type
  * @return string
  */
 function _precache_file($url, $type)
 {
     $lifetime = $this->_config->get_integer('minify.lifetime');
     $cache_path = sprintf('%s/minify_%s.%s', Util_Environment::cache_blog_dir('minify'), md5($url), $type);
     if (!file_exists($cache_path) || @filemtime($cache_path) < time() - $lifetime) {
         if (!@is_dir(dirname($cache_path))) {
             Util_File::mkdir_from(dirname($cache_path), W3TC_CACHE_DIR);
         }
         Util_Http::download($url, $cache_path);
     }
     return file_exists($cache_path) ? $this->_get_minify_source($cache_path, $url) : false;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:19,代码来源:Minify_MinifiedFileRequestHandler.php

示例5: cleanup

 /**
  * Does disk cache cleanup
  *
  * @return void
  */
 function cleanup()
 {
     $w3_cache_file_cleaner_generic = new Cache_File_Cleaner_Generic(array('exclude' => array('*.files', '.htaccess', 'index.php'), 'cache_dir' => Util_Environment::cache_blog_dir('minify'), 'expire' => $this->_config->get_integer('minify.file.gc'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
     $w3_cache_file_cleaner_generic->clean();
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:10,代码来源:Minify_Plugin_Admin.php

示例6: cleanup

 /**
  * Does disk cache cleanup
  *
  * @return void
  */
 function cleanup()
 {
     $w3_cache_file_cleaner = new Cache_File_Cleaner(array('cache_dir' => Util_Environment::cache_blog_dir('db'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
     $w3_cache_file_cleaner->clean();
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:10,代码来源:DbCache_Plugin.php

示例7: get_files_minify

 /**
  * Exports min files to CDN
  *
  * @return array
  */
 function get_files_minify()
 {
     $files = array();
     if ($this->_config->get_boolean('minify.rewrite') && Util_Rule::can_check_rules() && (!$this->_config->get_boolean('minify.auto') || Cdn_Util::is_engine_mirror($this->_config->get_string('cdn.engine')))) {
         $minify = Dispatcher::component('Minify_Plugin');
         $document_root = Util_Environment::document_root();
         $minify_root = Util_Environment::cache_blog_dir('minify');
         $minify_path = ltrim(str_replace($document_root, '', $minify_root), '/');
         $urls = $minify->get_urls();
         // in WPMU + network admin (this code used for minify manual only)
         // common minify files are stored under context of main blog (i.e. 1)
         // but have urls of 0 blog, so download has to be used
         if ($this->_config->get_string('minify.engine') == 'file' && !(Util_Environment::is_wpmu() && is_network_admin())) {
             foreach ($urls as $url) {
                 Util_Http::get($url);
             }
             $files = Cdn_Util::search_files($minify_root, $minify_path, '*.css;*.js');
         } else {
             foreach ($urls as $url) {
                 $file = Util_Environment::normalize_file_minify($url);
                 $file = Util_Environment::translate_file($file);
                 if (!Util_Environment::is_url($file)) {
                     $file = $document_root . '/' . $file;
                     $file = ltrim(str_replace($minify_root, '', $file), '/');
                     $dir = dirname($file);
                     if ($dir) {
                         Util_File::mkdir($dir, 0777, $minify_root);
                     }
                     if (Util_Http::download($url, $minify_root . '/' . $file) !== false) {
                         $files[] = $minify_path . '/' . $file;
                     }
                 }
             }
         }
     }
     return $files;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:42,代码来源:Cdn_Plugin.php

示例8: cache_blog_minify_dir

 public static function cache_blog_minify_dir()
 {
     // when minify manual used with a shared config - shared
     // minify urls has to be used too, since CDN upload is possible
     // only from network admin
     if (Util_Environment::is_wpmu() && Util_Environment::is_using_master_config() && !Dispatcher::config()->get_boolean('minify.auto')) {
         $path = Util_Environment::cache_blog_dir('minify', 0);
     } else {
         $path = Util_Environment::cache_blog_dir('minify');
     }
     return $path;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:12,代码来源:Util_Environment.php

示例9: on_cdn_file_upload

 /**
  * Called on successful file upload to CDN
  *
  * @param unknown $file_name
  */
 public static function on_cdn_file_upload($file_name)
 {
     $minify_enabled = self::config()->get_boolean('minify.enabled');
     if ($minify_enabled) {
         $minify_document_root = Util_Environment::cache_blog_dir('minify') . '/';
         if (!substr($file_name, 0, strlen($minify_document_root)) == $minify_document_root) {
             // unexpected file name
             return;
         }
         $short_file_name = substr($file_name, strlen($minify_document_root));
         $minify = Dispatcher::component('Minify_MinifiedFileRequestHandler');
         $minify->set_file_custom_data($short_file_name, array('cdn.status' => 'uploaded'));
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:19,代码来源:Dispatcher.php


注:本文中的Util_Environment::cache_blog_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。