예제 #1
0
 public function __toString()
 {
     $minifiedScript = '';
     $tags = '';
     $filename = "/" . $this->getExtension() . "/combined_{$this->context}." . $this->getExtension();
     if ($this->combine === true) {
         foreach ($this->minifiableScripts as $script) {
             $minifiedScript .= file_get_contents($script);
         }
         file_put_contents(AssetsLoader::getDestinationDir() . $filename, Minifier::minify($minifiedScript, $this->getMinifier()));
         $tags = $this->getTag(AssetsLoader::getSiteUrl() . $filename);
     } else {
         if ($this->combine == false) {
             $tags .= $this->writeTags($this->minifiableScripts);
         }
     }
     $tags .= $this->writeTags($this->otherScripts);
     $this->minifiableScripts = array();
     $this->otherScripts = array();
     return $tags;
 }