本文整理汇总了PHP中Minify::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Minify::factory方法的具体用法?PHP Minify::factory怎么用?PHP Minify::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Minify
的用法示例。
在下文中一共展示了Minify::factory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleStatic
private function handleStatic($filenames, $type)
{
/* Fix to prevent debug bar from rendering on this page */
$config = Kohana::config('debug_toolbar');
if ($config) {
$config->set('auto_render', false);
}
/* end fix */
if ($filenames === null) {
$this->response = "/* No {$type} TO BE FOUND */";
return;
}
if (Kohana_Core::$environment != Kohana::DEVELOPMENT && self::check(300) === FALSE) {
self::set(300);
}
$this->response->headers('Content-Type', File::mime_by_ext($type));
$body = "";
$filenames = preg_replace("/\\.{$type}\$/", '', $filenames);
foreach (explode(',', $filenames) as $key) {
$key = basename($key, ".{$type}");
$file = Kohana::find_file('views/' . $type, $key, $type);
if (!$file) {
$body .= "/* No such file or directory ({$key}.{$type}) */\n";
continue;
}
$body .= implode('', array('/* (', str_replace(DOCROOT, '', $file), ") */\n"));
$body .= file_get_contents($file);
}
/* Play nice with minify module if its enabled */
if (Kohana::config('minify.enabled', false) && class_exists('Minify')) {
$body = Minify::factory($type)->set($body)->min();
}
$this->response->body($body);
}
示例2: after
public function after()
{
if ($this->auto_render) {
$styles = array('base.css', 'master.css');
$scripts = array('jquery-1.4.1.js');
$this->template->styles = array_merge($styles, $this->template->styles);
$this->template->scripts = array_merge($scripts, $this->template->scripts);
$this->template->styles = Minify::factory('css')->minify($this->template->styles);
$this->template->scripts = Minify::factory('js')->minify($this->template->scripts);
}
parent::after();
}