本文整理汇总了PHP中Util_Environment::cache_blog_minify_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::cache_blog_minify_dir方法的具体用法?PHP Util_Environment::cache_blog_minify_dir怎么用?PHP Util_Environment::cache_blog_minify_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::cache_blog_minify_dir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: minified_url
public static function minified_url($minify_filename)
{
$path = Util_Environment::cache_blog_minify_dir();
$filename = $path . '/' . $minify_filename;
$c = Dispatcher::config();
if (Util_Rule::can_check_rules() && $c->get_boolean('minify.rewrite')) {
return Util_Environment::filename_to_url($filename);
}
return network_site_url('?w3tc_minify=' . $minify_filename);
}
示例2: _get_cache
/**
* Returns minify cache object
*
* @return object
*/
function _get_cache()
{
static $cache = array();
if (!isset($cache[0])) {
switch ($this->_config->get_string('minify.engine')) {
case 'memcached':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify', 'servers' => $this->_config->get_array('minify.memcached.servers'), 'persistent' => $this->_config->get_boolean('minify.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('minify.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('minify.memcached.username'), 'password' => $this->_config->get_boolean('minify.memcached.password'));
if (class_exists('Memcached')) {
$w3_cache = new Cache_Memcached($config);
} else {
if (class_exists('Memcache')) {
$w3_cache = new Cache_Memcache($config);
}
}
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'redis':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify', 'servers' => $this->_config->get_array('minify.redis.servers'), 'persistent' => $this->_config->get_boolean('minify.redis.persistent'), 'dbid' => $this->_config->get_boolean('minify.redis.dbid'), 'password' => $this->_config->get_boolean('minify.redis.password'));
if (class_exists('Memcached')) {
$w3_cache = new Cache_Memcached($config);
} else {
if (class_exists('Memcache')) {
$w3_cache = new Cache_Memcache($config);
}
}
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'apc':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
if (function_exists('apcu_store')) {
$w3_cache = new Cache_Apcu($config);
} else {
if (function_exists('apc_store')) {
$w3_cache = new Cache_Apc($config);
}
}
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'eaccelerator':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
$w3_cache = new Cache_Eaccelerator($config);
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'xcache':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
$w3_cache = new Cache_Xcache($config);
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'wincache':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
$w3_cache = new Cache_Wincache($config);
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'file':
default:
$cache[0] = new \Minify_Cache_File(Util_Environment::cache_blog_minify_dir(), array('.htaccess', 'index.php', '*.old'), $this->_config->get_boolean('minify.file.locking'), $this->_config->get_integer('timelimit.cache_flush'), Util_Environment::blog_id() == 0 ? W3TC_CACHE_MINIFY_DIR : null);
break;
}
}
return $cache[0];
}
示例3: minify_url_regexp
/**
* Gets regexp for minified files
*
* @return string
*/
private function minify_url_regexp($filename_mask)
{
$minify_base_url = Util_Environment::filename_to_url(Util_Environment::cache_blog_minify_dir());
$matches = null;
if (!preg_match('~((https?://)?([^/]+))(.+)~i', $minify_base_url, $matches)) {
return '';
}
$protocol_domain_regexp = Util_Environment::get_url_regexp($matches[1]);
$path_regexp = Util_Environment::preg_quote($matches[4]);
$regexp = '(' . '(' . $protocol_domain_regexp . ')?' . '(' . $path_regexp . $filename_mask . ')' . ')';
return $regexp;
}