Exemple #1
0
 public function compile($output = NULL)
 {
     if (!is_null($output)) {
         $this->output_updated = $output;
     }
     $value = NULL;
     foreach ($this->tags as $key => $value) {
         $link = NULL;
         //-------------------------------------------------
         $value->compile();
         //-------------------------------------------------
         if ($this->compileType == "seperate") {
             if (!is_null($value->save_path)) {
                 $link = Html::getExtLink($value->save_path_relative);
             }
         } else {
             if ($this->compileType == "single") {
                 /*if (is_null($this->mergedCode)) $this->mergedCode = "";
                 		//krumo($value->save_path_relative);
                 		$this->mergedCode .= $value->content_updated.PHP_EOL;
                 		krumo($this->mergedCode);*/
             }
         }
         //-------------------------------------------------
         if (!is_null($value->link_compile_file) && is_null($value->link_compile_file->content)) {
             $link = Html::getExtLink($value->link_compile_file->filePath);
         }
         //-------------------------------------------------
         if (!is_null($link)) {
             $this->extLinks .= $link . PHP_EOL;
             //$this->output_updated = str_replace("</head>",$link.PHP_EOL.'</head>', $this->output_updated);
         }
         //krumo($this->output_updated);
     }
     //-------------------------------------------------
     if ($this->compileType == "single" && !is_null($value)) {
         //krumo($value);
         $this->import_save_path_relative = "import." . $value->saveas_ext;
         $this->import_save_path = $this->compilePath . $this->import_save_path_relative;
         FileFolder::file_put_contents($this->import_save_path, $this->mergedCode);
         $link = Compiler::insertExtLink($this->import_save_path_relative);
         //krumo($this->output_updated);
         $this->extLinks .= $link . PHP_EOL;
         //$this->output_updated = str_replace("</head>",$link.PHP_EOL.'</head>', $this->output_updated);
     } else {
         if ($this->compileType == "inject") {
             $this->output_updated = str_replace("<head>", "<head>" . PHP_EOL . $this->mergedCode . PHP_EOL, $this->output_updated);
         }
     }
 }