/var/www/hkosl.com/aga/wp-content/plugins/smart-slider-3/nextend/library/libraries/assets/cache.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php

class N2AssetsCache {

    public 
$outputFileType;

    protected 
$group$files$codes;

    public function 
getAssetFile($group, &$files = array(), &$codes = array()) {
        
$this->group $group;
        
$this->files $files;
        
$this->codes $codes;

        
$cache = new N2CacheManifest($grouptruetrue);
        
$hash  $this->getHash();

        return 
$cache->makeCache($group "." $this->outputFileType$hash, array(
            
$this,
            
'getCachedContent'
        
));
    }

    protected function 
getHash() {
        
$hash '';
        foreach (
$this->files AS $file) {
            
$hash .= $this->makeFileHash($file);
        }
        foreach (
$this->codes AS $code) {
            
$hash .= $code;
        }

        return 
md5($hash);
    }

    protected function 
getCacheFileName() {
        
$hash '';
        foreach (
$this->files AS $file) {
            
$hash .= $this->makeFileHash($file);
        }
        foreach (
$this->codes AS $code) {
            
$hash .= $code;
        }

        return 
md5($hash) . "." $this->outputFileType;
    }

    
/**
     * @param N2CacheManifest $cache
     *
     * @return string
     */
    
public function getCachedContent($cache) {
        
$fileContents '';
        foreach (
$this->files AS $file) {
            
$fileContents .= $this->parseFile($cacheN2Filesystem::readFile($file), $file) . "\n";
        }

        foreach (
$this->codes AS $code) {
            
$fileContents .= $code "\n";
        }

        return 
$fileContents;
    }

    protected function 
makeFileHash($file) {
        return 
$file filemtime($file);
    }

    
/**
     * @param N2CacheManifest $cache
     * @param                 $content
     * @param                 $originalFilePath
     *
     * @return mixed
     */
    
protected function parseFile($cache$content$originalFilePath) {
        return 
$content;
    }

}