Example #1
0
File: XHTML.php Project: philip/phd
 /**
  * Called after the constructor finished.
  * This is needed since themes set their outputdir and outputfile
  * in the constructor. That file/dir is used for mediamanager.
  * That means we cannot instantiate and complete the manager in our
  * constructor centrally.
  *
  * Each theme needs its own media manager, since the manager contains
  * the output path.
  *
  * @return void
  */
 public function postConstruct()
 {
     $this->mediamanager = new MediaManager(Config::xml_root());
     $outputdir = $this->getOutputDir();
     if (isset($outputdir) && $outputdir) {
         $this->mediamanager->output_dir = $outputdir;
     } else {
         $this->mediamanager->output_dir = Config::output_dir() . '/' . strtolower($this->getFormatName()) . '-data/';
         $this->mediamanager->relative_ref_path = basename($this->mediamanager->output_dir) . '/';
     }
 }
Example #2
0
Options_Parser::getopt();
/* If no docbook file was passed, die */
if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) {
    trigger_error("No Docbook file given. Specify it on the command line with --docbook.", E_USER_ERROR);
}
if (!file_exists(Config::output_dir())) {
    v("Creating output directory..", VERBOSE_MESSAGES);
    if (!mkdir(Config::output_dir(), 0777, True)) {
        v("Can't create output directory : %s", Config::output_dir(), E_USER_ERROR);
    }
} elseif (!is_dir(Config::output_dir())) {
    v("Output directory is not a file?", E_USER_ERROR);
}
// This needs to be moved. Preferably into the PHP package.
if (!$conf) {
    Config::init(array("lang_dir" => __INSTALLDIR__ . DIRECTORY_SEPARATOR . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR, "phpweb_version_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'version.xml', "phpweb_acronym_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml'));
}
if (Config::saveconfig()) {
    v("Writing the config file", VERBOSE_MESSAGES);
    file_put_contents("phd.config.php", "<?php\nreturn " . var_export(Config::getAllFiltered(), 1) . ";");
}
if (Config::quit()) {
    exit(0);
}
function make_reader()
{
    //Partial Rendering
    $idlist = Config::render_ids() + Config::skip_ids();
    if (!empty($idlist)) {
        v("Running partial build", VERBOSE_RENDER_STYLE);
        $reader = new Reader_Partial();
Example #3
0
 public function format_imagedata($open, $name, $attrs, $props)
 {
     if ($props["empty"] && isset($this->cchunk["xml-base"]) && ($base = $this->cchunk["xml-base"]) && isset($attrs[Reader::XMLNS_DOCBOOK]["fileref"]) && ($fileref = $attrs[Reader::XMLNS_DOCBOOK]["fileref"])) {
         $imagePath = Config::xml_root() . DIRECTORY_SEPARATOR . $base . $fileref;
         if (file_exists($imagePath)) {
             $this->pdfDoc->add(PdfWriter::IMAGE, $imagePath);
         }
     }
     return '';
 }