Example #1
0
 public function update($event, $val = null)
 {
     switch ($event) {
         case Render::FINALIZE:
             $this->writeJsonIndex();
             break;
         case Render::CHUNK:
             $this->flags = $val;
             break;
         case Render::STANDALONE:
             if ($val) {
                 $this->registerElementMap(static::getDefaultElementMap());
                 $this->registerTextMap(static::getDefaultTextMap());
             }
             break;
         case Render::INIT:
             $this->loadVersionAcronymInfo();
             // For HHVM - put in actual output_dir, not output_dir . strtolower($this->getFormatName) . '/'
             // This allows us to directly put the docs in manual/en instead of manual/en/php-web and having to sync back
             $this->setOutputDir(Config::output_dir() . '/');
             $this->postConstruct();
             if (file_exists($this->getOutputDir())) {
                 if (!is_dir($this->getOutputDir())) {
                     v("Output directory is a file?", E_USER_ERROR);
                 }
             } else {
                 if (!mkdir($this->getOutputDir(), 0777, true)) {
                     v("Can't create output directory", E_USER_ERROR);
                 }
             }
             if ($this->getFormatName() == "PHP-Web") {
                 if (!Config::no_toc() && is_dir($this->getOutputDir() . 'toc')) {
                     removeDir($this->getOutputDir() . 'toc');
                 }
                 if (!file_exists($this->getOutputDir() . "toc") || is_file($this->getOutputDir() . "toc")) {
                     mkdir($this->getOutputDir() . "toc", 0777, true) or die("Can't create the toc directory");
                 }
             }
             if (Config::css()) {
                 $this->fetchStylesheet();
             }
             break;
         case Render::VERBOSE:
             v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
             break;
     }
 }