public function matchContent_CFG() { $this->markup_CFG(); //-------------------------------------------------- if (!is_null($this->link_compile_file) && !is_null($this->link_compile_file->link)) { $this->link = $this->link_compile_file->link; /*//-------------------------------------------------- if ($this->saveasphp) { $this->content = $link; }*/ } if ($this->minify && !preg_match_all("/\\.min/", $this->file) && !is_null($this->content) && $this->tagType != "tmpl") { $this->content_updated = Minifier_v0::minify(array("type" => $this->codeType, "code" => $this->content_updated)); } /*else { $this->content_updated = $this->content; }*/ //------------------------------------------------------ }
public function minifyAll() { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "minJs"); $code = ''; //---------------------------------------------------------- if (is_array($this->files)) { for ($i = 0; $i < sizeof($this->files); $i++) { $code .= Minifier_v0::getContents($this->files[$i], $this->fileLocation); } } else { $code .= Minifier_v0::getContents($this->files, $this->fileLocation); } //---------------------------------------------------------- $this->code = $code; //---------------------------------------------------------- return $this->minify($this->code); }
public function minify($code) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'traceID' => "minJs"); //---------------------------------------------------------- if (strpos($this->fileName, "js") !== false) { $content = Minifier::minify($code); } else { if (strpos($this->fileName, "css") !== false) { $content = CssMin::minify($code); } else { if (strpos($this->fileName, "html") !== false) { $content = $code; } } } //---------------------------------------------------------- $chk['result'] = $content; //---------------------------------------------------------- if (is_null($fileLocation)) { $chk['message'] = "code has been successfully minified!!!!!"; } //---------------------------------------------------------- $chk = CreateFile_v0::go($this->fileName, $content, $this->fileLocation, true); //---------------------------------------------------------- Minifier_v0::createDependantFiles($content); //---------------------------------------------------------- return $chk; }
public function getFileContent($type, $index, $minify) { $content = NULL; if ($this->isPropSet($this->code[$type], "forceDownload", true) && $index['forced']) { $index['content'] = file_get_contents($index["file"]); $content = $this->compiler->getFiles($index["content"], $index["file"]); //if (!is_null($index['ex'])) $this->content = str_replace($index['ex'], '', $this->content); } else { if ($index['forced']) { $content = $this->getExtLink($index['file']); } else { $content = $index['content']; } } if ($minify && !preg_match_all("/\\.min/", $index["file"]) && isset($index['content'])) { //krumo($type); //krumo($index); //krumo($content); $content = Minifier_v0::minify(array("type" => $type, "code" => $content)); if ($type == "css") { $content = "<style>" . PHP_EOL . $content . PHP_EOL . "</style>"; } else { if ($type == "js") { $content = "<script>" . PHP_EOL . $content . PHP_EOL . "</script>"; } } } //--------------------------------------------------------- //krumo($content); return $content . PHP_EOL; }