public function cache() { $cache = new autoptimizeCache($this->md5hash, 'js'); if (!$cache->check()) { //Cache our code $cache->cache($this->jscode, 'text/javascript'); } $this->url = AUTOPTIMIZE_CACHE_URL . $cache->getname(); $this->url = $this->url_replace_cdn($this->url); }
public function cache() { if ($this->datauris) { // MHTML Preparation $this->mhtml = "/*\r\nContent-Type: multipart/related; boundary=\"_\"\r\n\r\n" . $this->mhtml . "*/\r\n"; $md5 = md5($this->mhtml); $cache = new autoptimizeCache($md5, 'txt'); if (!$cache->check()) { //Cache our images for IE $cache->cache($this->mhtml, 'text/plain'); } $mhtml = AUTOPTIMIZE_CACHE_URL . $cache->getname(); } //CSS cache foreach ($this->csscode as $media => $code) { $md5 = $this->hashmap[md5($code)]; if ($this->datauris) { // Images for ie! Get the right url $code = str_replace('%%MHTML%%', $mhtml, $code); } $cache = new autoptimizeCache($md5, 'css'); if (!$cache->check()) { // Cache our code $cache->cache($code, 'text/css'); } $this->url[$media] = AUTOPTIMIZE_CACHE_URL . $cache->getname(); } }