コード例 #1
0
ファイル: cache.php プロジェクト: Nguyenkain/Elearning
 function getCache()
 {
     if (count($this->_files) == 0 && $this->_text == '') {
         return false;
     }
     if ($this->_cacheTime == 'static' || $this->_cacheTime == 0) {
         $folder = $this->_path . 'static' . DIRECTORY_SEPARATOR;
         $currentcachetime = 0;
     } else {
         $time = time();
         $currentcachetime = $time - $time % $this->_cacheTime;
         $folder = $this->_path . $this->_prename . $currentcachetime . DIRECTORY_SEPARATOR;
     }
     $this->createCacheSubFolder($folder, $currentcachetime);
     $hash = $this->createHash();
     $cachefile = $folder . $hash . '.' . $this->_filetype;
     $cachefilegzip = $folder . $hash . '.php';
     if (!NextendFilesystem::existsFile($cachefile)) {
         $cached = "/* " . date('l jS \\of F Y h:i:s A') . "*/\n\n";
         for ($i = 0; $i < count($this->_files); $i++) {
             $cached .= $this->parseFile(NextendFilesystem::readFile($this->_files[$i]), $this->_files[$i], $i);
         }
         $cached .= $this->_text;
         NextendFilesystem::createFile($cachefile, $this->parseCached($cached));
         if ($this->_gzip) {
             $php = '<?php ' . $this->getgzipHeader($currentcachetime) . 'if (extension_loaded("zlib") && (ini_get("output_handler") != "ob_gzhandler")) {' . 'ini_set("zlib.output_compression", 1);' . '}' . 'readfile("' . str_replace('\\', '/', $cachefile) . '");';
             NextendFilesystem::createFile($cachefilegzip, $php);
         }
     }
     if ($this->_gzip) {
         return NextendFilesystem::pathToAbsoluteURL($cachefilegzip);
     }
     return NextendFilesystem::pathToAbsoluteURL($cachefile);
 }
コード例 #2
0
ファイル: css.php プロジェクト: sangikumar/IP
 function generateAjaxCSS($loadedCSS)
 {
     $css = '';
     if (count($this->_cssFiles)) {
         $lesscache = $this->_lesscache;
         foreach ($this->_cssFiles as $k => $file) {
             if (!in_array($k, $loadedCSS)) {
                 if (is_array($file)) {
                     $lesscache->addContext($file[1], $file[2]);
                 } else {
                     $css .= preg_replace('#url\\([\'"]([^"\'\\)]+)[\'"]\\)#', 'url(' . NextendFilesystem::pathToAbsoluteURL(dirname($k)) . '/$1)', NextendFilesystem::readFile($k));
                 }
             }
         }
         if ($lesscache) {
             $filename = $lesscache->getCache();
             if ($filename) {
                 $lessfile = NextendFilesystem::absoluteURLToPath($lesscache->getCache());
                 $css .= preg_replace('#url\\([\'"]([^"\'\\)]+)[\'"]\\)#', 'url(' . NextendFilesystem::pathToAbsoluteURL(dirname($lessfile)) . '/$1)', NextendFilesystem::readFile($lessfile));
             }
         }
     }
     $css .= $this->_css;
     return $css;
 }
コード例 #3
0
ファイル: sliders.php プロジェクト: pguilford/vcomcc
 function ss2_css_image_replace($ms)
 {
     global $zip;
     if (substr($ms[1], 0, 2) == '//') {
         $ms[1] = 'http:' . $ms[1];
     }
     $path = NextendFilesystem::absoluteURLToPath($ms[1]);
     if (NextendFilesystem::fileexists($path)) {
         if (nextendIsJoomla()) {
             $rel = str_replace('plugins/', 'images/', NextendFilesystem::pathToRelativePath($path));
         } else {
             if (nextendIsWordpress()) {
                 $rel = str_replace(NEXTEND_SMART_SLIDER2 . 'plugins/', 'images/', $path);
             }
         }
         $zip->addFile(NextendFilesystem::readFile($path), $rel);
         return 'url(' . $rel . ')';
     }
 }
コード例 #4
0
ファイル: css.php プロジェクト: 01J/bealtine
 function generateAjaxCSS($loadedCSS)
 {
     $css = '';
     if (count($this->_cssFiles)) {
         foreach ($this->_cssFiles as $file) {
             if (!in_array($file, $loadedCSS)) {
                 $css .= NextendFilesystem::readFile($file);
             }
         }
     }
     $css .= $this->_css;
     return $css;
 }