本文整理汇总了PHP中TBGContext::isMinifyEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::isMinifyEnabled方法的具体用法?PHP TBGContext::isMinifyEnabled怎么用?PHP TBGContext::isMinifyEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::isMinifyEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runServe
public function runServe(TBGRequest $request)
{
if (!TBGContext::isMinifyEnabled()) {
$itemarray = array($request['g'] => explode(',', base64_decode($request['files'])));
if (array_key_exists('js', $itemarray)) {
header('Content-type: text/javascript');
foreach ($itemarray['js'] as $file) {
$ext = substr($file, -2);
if ($ext == 'js' && file_exists($file) && strpos(realpath($file), THEBUGGENIE_PATH) !== false) {
echo file_get_contents($file);
}
}
} else {
header('Content-type: text/css');
foreach ($itemarray['css'] as $file) {
$ext = substr($file, -3);
if ($ext == 'css' && file_exists($file) && strpos(realpath($file), THEBUGGENIE_PATH) !== false) {
echo file_get_contents($file);
}
}
}
exit;
}
$this->getResponse()->setDecoration(TBGResponse::DECORATE_NONE);
define('MINIFY_MIN_DIR', dirname(__FILE__) . '/../../../core/min');
// load config
require MINIFY_MIN_DIR . '/config.php';
// setup include path
set_include_path($min_libPath . PATH_SEPARATOR . get_include_path());
require 'Minify.php';
Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
Minify::setCache(isset($min_cachePath) ? $min_cachePath : '', $min_cacheFileLocking);
if ($min_documentRoot) {
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
} elseif (0 === mb_stripos(PHP_OS, 'win')) {
Minify::setDocRoot();
// IIS may need help
}
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
if ($min_allowDebugFlag && isset($_GET['debug'])) {
$min_serveOptions['debug'] = true;
}
if ($min_errorLogger) {
require_once 'Minify/Logger.php';
if (true === $min_errorLogger) {
require_once 'FirePHP.php';
Minify_Logger::setLogger(FirePHP::getInstance(true));
} else {
Minify_Logger::setLogger($min_errorLogger);
}
}
// check for URI versioning
if (preg_match('/&\\d/', $_SERVER['QUERY_STRING'])) {
$min_serveOptions['maxAge'] = 31536000;
}
$itemarray = array($request['g'] => explode(',', base64_decode($request['files'])));
$min_serveOptions['minApp']['groups'] = $itemarray;
ob_end_clean();
$data = Minify::serve('MinApp', $min_serveOptions);
header_remove('Pragma');
foreach ($data['headers'] as $name => $val) {
header($name . ': ' . $val);
}
header('HTTP/1.1 ' . $data['statusCode']);
if ($data['statusCode'] != 304) {
echo $data['content'];
}
exit;
}