Skip to content

Commit

Permalink
Merge branch 'CI3'
Browse files Browse the repository at this point in the history
  • Loading branch information
uncaose committed May 24, 2018
2 parents f4a1cba + 26dadf0 commit 08ccf8c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions application/controllers/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/
class Asset extends CI_Controller
{
public $config = [];
public $conf = [];

public function __construct() {
parent::__construct();
$this->config->load('straight', TRUE, FALSE);
$this->config = $this->config->item('straight');
$this->load->driver('cache', $this->config['adapter']);
$this->conf = $this->config->item('straight');
$this->load->driver('cache', $this->conf['adapter']);
}

public function js()
Expand Down Expand Up @@ -48,7 +48,7 @@ public function combine( $file = '' )

if( $content = $this->cache->get( $file ) ) // md5.ext key
{
if( isset($content['minify']) && $content['minify'] == $this->config['asset_minify_'.$ext] )
if( isset($content['minify']) && $content['minify'] == $this->conf['asset_minify_'.$ext] )
{
echo $content['body'];
exit;
Expand Down Expand Up @@ -91,14 +91,14 @@ public function combine( $file = '' )
}
$content = join($ext=='js'?";\n":"\n", $content);

$this->cache->save($file, ['minify'=>$this->config['asset_minify_'.$ext], 'body'=>$content], $this->config['ttl'] );
$this->cache->save($file, ['minify'=>$this->conf['asset_minify_'.$ext], 'body'=>$content], $this->conf['ttl'] );
echo $content;
}

private function _js( $file = '' )
{
$rs = '';
if( $this->config['asset_minify_js'] === TRUE && class_exists('MatthiasMullie\\Minify\\JS') )
if( $this->conf['asset_minify_js'] === TRUE && class_exists('MatthiasMullie\\Minify\\JS') )
{
$minifier = new Minify\JS( $file );
$rs = $minifier->minify();
Expand All @@ -111,7 +111,7 @@ private function _js( $file = '' )
private function _css( $file = '' )
{
$rs = '';
if( $this->config['asset_minify_css'] === TRUE && class_exists('MatthiasMullie\\Minify\\CSS') )
if( $this->conf['asset_minify_css'] === TRUE && class_exists('MatthiasMullie\\Minify\\CSS') )
{
$minifier = new Minify\CSS( $file );
$rs = $minifier->minify();
Expand Down Expand Up @@ -168,9 +168,9 @@ private function webCache( $file='', $time=30758400 )
if( file_exists($file) )
{
$lastModifTime = filemtime($file);
$Etag = hash_file($this->config['asset_hashkey'], $file);
$Etag = hash_file($this->conf['asset_hashkey'], $file);
}else{
$Etag = hash($this->config['asset_hashkey'], $file);
$Etag = hash($this->conf['asset_hashkey'], $file);
}

// checkt last time & Etag
Expand Down

0 comments on commit 08ccf8c

Please sign in to comment.