示例#1
0
 public function __construct($options = array())
 {
     $document = Ming_Factory::getDocument();
     $this->_docRoot = isset($options['doc_root']) ? $options['doc_root'] : PUBLIC_DIR;
     if (!$document->cssBaseDir) {
         $document->cssBaseDir = PUBLIC_DIR . 'assets' . DS . 'css' . DS;
     }
     $this->_cssBaseDir = isset($options['base_dir']) ? $options['base_dir'] : $document->cssBaseDir;
     $this->_publicDir = isset($options['public_dir']) ? $options['public_dir'] : $document->getPublicPath();
 }
示例#2
0
 public function process($jsFile, $jsv = '1.0')
 {
     $document = Ming_Factory::getDocument();
     if (!$document->jsBaseDir) {
         $document->jsBaseDir = PUBLIC_DIR . 'assets' . DS . 'js' . DS;
     }
     $baseDir = $document->jsBaseDir;
     foreach ($jsFile as $fileName => $data) {
         $file = $baseDir . $fileName;
         $this->_sum .= $fileName . @filemtime($file);
     }
     $this->_sum .= $jsv;
     $name = hash('crc32b', $this->_sum) . '.js';
     if (!file_exists(PUBLIC_DIR . 'temp' . DS . $name)) {
         $js = '';
         foreach ($jsFile as $file => $data) {
             $js .= file_get_contents($baseDir . $file);
         }
         $this->_js = $js;
         $this->save($name);
     }
     return $name;
 }