本文整理汇总了PHP中Minify_Controller_Base::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Minify_Controller_Base::log方法的具体用法?PHP Minify_Controller_Base::log怎么用?PHP Minify_Controller_Base::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Minify_Controller_Base
的用法示例。
在下文中一共展示了Minify_Controller_Base::log方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serve
//.........这里部分代码省略.........
} else {
// client will need output
$headers = $cg->getHeaders();
unset($cg);
}
if ($this->options['contentType'] === self::TYPE_CSS && $this->options['rewriteCssUris']) {
$this->setupUriRewrites();
}
if ($this->options['concatOnly']) {
$this->options['minifiers'][self::TYPE_JS] = false;
foreach ($this->sources as $key => $source) {
if ($this->options['contentType'] === self::TYPE_JS) {
$source->setMinifier("");
} elseif ($this->options['contentType'] === self::TYPE_CSS) {
$source->setMinifier(array('Minify_CSSmin', 'minify'));
$sourceOpts = $source->getMinifierOptions();
$sourceOpts['compress'] = false;
$source->setMinifierOptions($sourceOpts);
}
}
}
// check server cache
if (!$this->options['debug']) {
// using cache
// the goal is to use only the cache methods to sniff the length and
// output the content, as they do not require ever loading the file into
// memory.
$cacheId = $this->_getCacheId();
$fullCacheId = $this->options['encodeMethod'] ? $cacheId . '.gz' : $cacheId;
// check cache for valid entry
$cacheIsReady = $this->cache->isValid($fullCacheId, $this->options['lastModifiedTime']);
if ($cacheIsReady) {
$cacheContentLength = $this->cache->getSize($fullCacheId);
} else {
// generate & cache content
try {
$content = $this->combineMinify();
} catch (Exception $e) {
$this->controller->log($e->getMessage());
if (!$this->options['quiet']) {
$this->errorExit($this->options['errorHeader'], self::URL_DEBUG);
}
throw $e;
}
$this->cache->store($cacheId, $content);
if (function_exists('gzencode') && $this->options['encodeMethod']) {
$this->cache->store($cacheId . '.gz', gzencode($content, $this->options['encodeLevel']));
}
}
} else {
// no cache
$cacheIsReady = false;
try {
$content = $this->combineMinify();
} catch (Exception $e) {
$this->controller->log($e->getMessage());
if (!$this->options['quiet']) {
$this->errorExit($this->options['errorHeader'], self::URL_DEBUG);
}
throw $e;
}
}
if (!$cacheIsReady && $this->options['encodeMethod']) {
// still need to encode
$content = gzencode($content, $this->options['encodeLevel']);
}
// add headers
if ($cacheIsReady) {
$headers['Content-Length'] = $cacheContentLength;
} else {
if (function_exists('mb_strlen') && (int) ini_get('mbstring.func_overload') & 2) {
$headers['Content-Length'] = mb_strlen($content, '8bit');
} else {
$headers['Content-Length'] = strlen($content);
}
}
$headers['Content-Type'] = $this->options['contentType'];
if ($this->options['contentTypeCharset']) {
$headers['Content-Type'] .= '; charset=' . $this->options['contentTypeCharset'];
}
if ($this->options['encodeMethod'] !== '') {
$headers['Content-Encoding'] = $contentEncoding;
}
if ($this->options['encodeOutput'] && $sendVary) {
$headers['Vary'] = 'Accept-Encoding';
}
if (!$this->options['quiet']) {
// output headers & content
foreach ($headers as $name => $val) {
header($name . ': ' . $val);
}
if ($cacheIsReady) {
$this->cache->display($fullCacheId);
} else {
echo $content;
}
} else {
return array('success' => true, 'statusCode' => 200, 'content' => $cacheIsReady ? $this->cache->fetch($fullCacheId) : $content, 'headers' => $headers);
}
}