public function getFiles()
 {
     $src_content = $this->src_content_markup = Compiler::markUp_CHK($this->src_content, array("ignore" => true));
     $src_content = $src_content;
     $src_content = StringUtil::removeAllHtmlComments($src_content);
     //---------------------------------------------------------
     if (!is_null($this->str_replace_silent)) {
         foreach ($this->str_replace_silent as $key => $value) {
             $this->src_content_silent = $src_content = str_replace($key, $value, $this->src_content);
         }
     }
     //---------------------------------------------------------
     preg_match_all('/(?:[\'\\"]|url\\()([\\-A-Za-z\\/_\\d\\.]+\\.(woff|ttf|mp4|jpg|jpeg|png|gif))/s', $src_content, $files, PREG_SET_ORDER);
     //---------------------------------------------------------
     $this->matches = $files;
     //---------------------------------------------------------
     foreach ($files as $file_key => $filePath) {
         $arr = array("compilerGlobal" => $this->compilerGlobal, "filePath" => $filePath[1], "forceDownload" => $this->forceDownload, "src_dir" => $this->src_dir, "save_dir" => $this->save_dir, "src_content" => is_null($this->src_content_updated) ? $this->src_content : $this->src_content_updated, "src_content_type" => $this->src_content_type, "relativeToSrc" => $this->relativeToSrc, "src_save_dir" => $this->src_save_dir, "base64" => $this->base64, "compilePath" => $this->compilePath);
         //---------------------------------------------------------
         $arr = SetPublicProp::go($arr, $this->fileProp, false);
         //---------------------------------------------------------
         $newFile = new Compile_File($arr);
         $this->src_content_updated = $newFile->src_content_updated;
         $this->images_info[] = $newFile;
     }
     //---------------------------------------------------------
     if (is_null($this->src_content_updated)) {
         $this->src_content_updated = $this->src_content;
     }
 }
Exemple #2
0
 public function scrape_CFG()
 {
     /*preg_match_all('/<!--<seperate((?: {|{)(?:.*?)})(.*?)<!--<\/seperate>-->/s', $content, $matches);
     		//---------------------------------------------------------
     		if (sizeof($matches[0]) > 0) {
     			$this->css_CFG(NULL, $matches[2][0], json_decode($matches[1][0], true));
     			//-----------------------------------------------------
     			$content = str_replace($matches[0][0], "", $content);
     			//-----------------------------------------------------
     		}*/
     $this->tags = array();
     //---------------------------------------------------------
     $output_updated = $this->output_markup = Compiler::markUp_CHK($this->output, array("ignore" => true, "replace" => true));
     //$output_updated = StringUtil::removeAllHtmlComments($output_updated);
     //---------------------------------------------------------
     preg_match_all($this->regex, $output_updated, $matches, PREG_SET_ORDER);
     //---------------------------------------------------------
     $this->matches = $matches;
     //---------------------------------------------------------
     foreach ($matches as $key => $match) {
         $save_dir = $this->save_dir;
         //-----------------------------------------------------
         $prop = array("forceDownload" => $this->forceDownload, "compileType" => $this->compileType, "compilePath" => $this->compilePath, "compilerGlobal" => $this->compilerGlobal, "minify" => $this->minify, "save_dir" => $save_dir, "defaultSavePath" => $this->defaultSavePath, "output" => $this->output_updated, "match" => $match, "imagesProp" => $this->imagesProp, "index" => $key, "onRemoveMatch" => $this->onRemoveMatch, "src_path" => $this->src_path);
         //-----------------------------------------------------
         $newMatch = ClassUtil::classFromString($this->matchClass, array(ArrayUtil::array_replace_recursive($prop, $this->matchProp)));
         $newMatch->init();
         //-----------------------------------------------------
         $this->output_updated = $newMatch->output_updated;
         //-----------------------------------------------------
         if (!is_null($newMatch->link)) {
             if ($this->saveasphp) {
                 $this->mergedCode .= $newMatch->content_updated;
             } else {
                 //$this->extLinks .= $newMatch->link;
             }
         } else {
             //if (is_null($this->compilerGlobal->mergedCode)) $this->compilerGlobal->mergedCode = "";
             if (!is_null($newMatch->content_updated)) {
                 if ($newMatch->tagType != "tmpl") {
                     $this->mergedCode_noTag .= PHP_EOL . $newMatch->content_updated;
                     $this->mergedCode .= "<" . $newMatch->tagType . ">" . PHP_EOL . $newMatch->content_updated . "</" . $newMatch->tagType . ">";
                 } else {
                     $this->mergedCode .= PHP_EOL . $newMatch->content_updated;
                 }
             }
         }
         //-----------------------------------------------------
         $this->tags[] = $newMatch;
     }
     //---------------------------------------------------------
     //$this->output_updated = $output_updated;
 }
Exemple #3
0
 public function copy_CFG()
 {
     //krumo($this->copy);
     foreach ($this->copy as $key => $value) {
         if (!file_exists($key)) {
             $key = $value;
             $value = NULL;
         }
         if (!$this->raw) {
             $txt = Compiler::markUp_CHK(file_get_contents($key));
         }
         $path = isset($value['saveas']) ? str_replace(basename($key), $value['saveas'], Compiler::cleanURL($key, $this->compilePath)) : Compiler::cleanURL($key, $this->compilePath);
         FileFolder::file_put_contents($path, $txt);
         //copy($value, Compiler::cleanURL($value, $this->compilePath));
     }
 }