Esempio n. 1
0
File: CHM.php Progetto: philip/phd
 public function update($event, $val = null)
 {
     switch ($event) {
         case Render::CHUNK:
             parent::update($event, $val);
             break;
         case Render::STANDALONE:
             parent::update($event, $val);
             break;
         case Render::INIT:
             $this->chmdir = Config::output_dir() . strtolower($this->getFormatName()) . DIRECTORY_SEPARATOR;
             if (!file_exists($this->chmdir) || is_file($this->chmdir)) {
                 mkdir($this->chmdir) or die("Can't create the CHM project directory");
             }
             $this->outputdir = Config::output_dir() . strtolower($this->getFormatName()) . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR;
             $this->postConstruct();
             if (!file_exists($this->outputdir) || is_file($this->outputdir)) {
                 mkdir($this->outputdir) or die("Can't create the cache directory");
             }
             $lang = Config::language();
             $this->hhpStream = fopen($this->chmdir . "pear_manual_{$lang}.hhp", "w");
             $this->hhcStream = fopen($this->chmdir . "pear_manual_{$lang}.hhc", "w");
             $this->hhkStream = fopen($this->chmdir . "pear_manual_{$lang}.hhk", "w");
             foreach (array("reset-fonts", "style", "manual") as $name) {
                 if (!file_exists($this->outputdir . "{$name}.css")) {
                     file_put_contents($this->outputdir . "{$name}.css", $this->fetchStylesheet($name));
                 }
             }
             self::headerChm();
             break;
         case Render::VERBOSE:
             parent::update($event, $val);
             break;
     }
 }