cvs: phd(PHD_ENTERPRISE) / config.php render.php /formats bigxhtml.php php.php xhtml.php /include PhDBuildOptions.class.php PhDFormat.class.php
PhDIndex.class.php PhDRender.class.php

From: Date: Tue, 29 Jul 2008 19:56:49 +0000
Subject: cvs: phd(PHD_ENTERPRISE) / config.php render.php /formats bigxhtml.php php.php xhtml.php /include PhDBuildOptions.class.php PhDFormat.class.php
PhDIndex.class.php PhDRender.class.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1956@lists.php.net to get a copy of this message
loudi Tue Jul 29 19:56:49 2008 UTC Modified files: (Branch: PHD_ENTERPRISE) /phd/formats xhtml.php bigxhtml.php php.php /phd config.php render.php /phd/include PhDIndex.class.php PhDFormat.class.php PhDBuildOptions.class.php PhDRender.class.php Log: * added HEAD PhDConfig class * cleaned some stuff in render.php

http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.68.2.1&r2=1.68.2.2&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.68.2.1 phd/formats/xhtml.php:1.68.2.2 --- phd/formats/xhtml.php:1.68.2.1 Mon Jul 28 22:40:57 2008 +++ phd/formats/xhtml.php Tue Jul 29 19:56:48 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.68.2.1 2008/07/28 22:40:57 bjori Exp $ */ +/* $Id: xhtml.php,v 1.68.2.2 2008/07/29 19:56:48 loudi Exp $ */ class PhDXHTMLFormat extends PhDFormat { private $myelementmap = array( /* {{{ */ 'abstract' => 'div', /* Docbook-xsl prints "abstract"... */ @@ -481,7 +481,7 @@ return "\n</body>\n</html>\n"; } public function writeChunk($id, $fp) { - $filename = PhDConfig::get("output_dir") . $id . '.' .$this->ext; + $filename = PhDConfig::output_dir() . $id . '.' .$this->ext; rewind($fp); file_put_contents($filename, $this->header($id)); http://cvs.php.net/viewvc.cgi/phd/formats/bigxhtml.php?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: phd/formats/bigxhtml.php diff -u phd/formats/bigxhtml.php:1.2.2.2 phd/formats/bigxhtml.php:1.2.2.3 --- phd/formats/bigxhtml.php:1.2.2.2 Mon Jul 28 22:47:59 2008 +++ phd/formats/bigxhtml.php Tue Jul 29 19:56:48 2008 @@ -66,7 +66,7 @@ public function open() { static $i = 0; $i++; - $this->bigfp = fopen(PhDConfig::get("output_dir") . "bightml$i.html", "w+"); + $this->bigfp = fopen(PhDConfig::output_dir() . "bightml$i.html", "w+"); // FIXME: Use correct lang attribute and insert <title> of the DB file fwrite($this->bigfp, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://cvs.php.net/viewvc.cgi/phd/formats/php.php?r1=1.4.2.2&r2=1.4.2.3&diff_format=u Index: phd/formats/php.php diff -u phd/formats/php.php:1.4.2.2 phd/formats/php.php:1.4.2.3 --- phd/formats/php.php:1.4.2.2 Mon Jul 28 22:47:59 2008 +++ phd/formats/php.php Tue Jul 29 19:56:48 2008 @@ -76,8 +76,8 @@ public function __construct() { parent::__construct(); - $this->versions = self::generateVersionInfo(PhDConfig::get("phpweb_version_filename")); - $this->acronyms = self::generateAcronymInfo(PhDConfig::get("phpweb_acronym_filename")); + $this->versions = self::generateVersionInfo(PhDConfig::phpweb_version_filename()); + $this->acronyms = self::generateAcronymInfo(PhDConfig::phpweb_acronym_filename()); } http://cvs.php.net/viewvc.cgi/phd/config.php?r1=1.53&r2=1.53.2.1&diff_format=u Index: phd/config.php diff -u phd/config.php:1.53 phd/config.php:1.53.2.1 --- phd/config.php:1.53 Thu Jul 24 19:39:02 2008 +++ phd/config.php Tue Jul 29 19:56:48 2008 @@ -1,36 +1,17 @@ <?php -/* $Id: config.php,v 1.53 2008/07/24 19:39:02 bjori Exp $ */ +/* $Id: config.php,v 1.53.2.1 2008/07/29 19:56:48 loudi Exp $ */ require $ROOT . "/include/PhDErrors.php"; -define("PHD_VERSION", "0.4.0-dev"); +define("PHD_VERSION", "2.0-enterprise"); class PhDConfig { private static $optionArray = array( 'output_format' => array( 'xhtml', - 'manpage', - 'pdf', - ), - 'output_theme' => array( - 'xhtml' => array( - 'php' => array( - 'phpweb', - 'chunkedhtml', - 'bightml', - 'chmsource', - ), - ), - 'manpage' => array( - 'php' => array( - 'phpfunctions', - ), - ), - 'pdf' => array( - 'php' => array( - ), - ), + 'php', + 'bigxhtml', ), 'chunk_extra' => array( "legalnotice" => true, @@ -38,7 +19,8 @@ ), 'index' => true, 'xml_root' => '.', - 'xml_file' => './.manual.xml', + 'xml_file' => "./.manual.xml", + 'lang_dir' => './', 'language' => 'en', 'verbose' => VERBOSE_DEFAULT, 'date_format' => "H:i:s", @@ -47,7 +29,7 @@ 'skip_ids' => array( ), 'color_output' => false, - 'output_dir' => '.', + 'output_dir' => './', 'php_error_output' => NULL, 'php_error_color' => false, 'user_error_output' => NULL, @@ -55,9 +37,22 @@ 'phd_info_output' => NULL, 'phd_info_color' => false, ); + + public static function init(array $a) { + self::$optionArray = array_merge(self::$optionArray, (array)$a); + } + + /*public static function get($opt) { + if (!is_string($opt)) { + throw new UnexpectedValueException("Excpecting a string"); + } + if (!isset(self::$optionArray[$opt])) { + throw new UnexpectedValueException("Unknown option: $opt"); + } + return self::$optionArray[$opt]; + }*/ - public static function __callStatic($name, $params) - { + public static function __callStatic($name, $params) { $name = strtolower($name); // FC if this becomes case-sensitive if (strncmp($name, 'set', 3) === 0) { $name = substr($name, 3); http://cvs.php.net/viewvc.cgi/phd/render.php?r1=1.3.2.2&r2=1.3.2.3&diff_format=u Index: phd/render.php diff -u phd/render.php:1.3.2.2 phd/render.php:1.3.2.3 --- phd/render.php:1.3.2.2 Mon Jul 28 22:47:59 2008 +++ phd/render.php Tue Jul 29 19:56:49 2008 @@ -1,73 +1,90 @@ <?php -require "include/PhDObjectStorage.class.php"; -require "include/PhDConfig.class.php"; +$ROOT = __DIR__; -require "include/PhDReader.class.php"; -require "include/PhDRender.class.php"; -require "include/PhDFormat.class.php"; -require "include/PhDIndex.class.php"; - -require "formats/xhtml.php"; -require "formats/bigxhtml.php"; -require "formats/php.php"; +require $ROOT . "/include/PhDObjectStorage.class.php"; +require $ROOT . "/config.php"; +include $ROOT . "/include/PhDBuildOptions.class.php"; + +require $ROOT . "/include/PhDReader.class.php"; +require $ROOT . "/include/PhDRender.class.php"; +require $ROOT . "/include/PhDFormat.class.php"; +require $ROOT . "/include/PhDIndex.class.php"; + +require $ROOT . "/formats/xhtml.php"; +require $ROOT . "/formats/bigxhtml.php"; +require $ROOT . "/formats/php.php"; -$INDEX = "/home/bjori/php/doc/.manual.xml"; -$FILENAME = "/home/bjori/php/doc/.manual.xml"; +//$INDEX = "/Users/loudi/Travail/phpdoc/.manual.xml"; +//$FILENAME = "/Users/loudi/Travail/phpdoc/.manual.xml"; //$INDEX = $FILENAME = "/home/bjori/php/cleandocs/json.xml"; define("NO_SQLITE", false); PhDConfig::init(array( - "verbose" => VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING), - "lang_dir" => __DIR__ . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR, - "output_dir" => __DIR__ . DIRECTORY_SEPARATOR . "output" . DIRECTORY_SEPARATOR, - - "phpweb_version_filename" => dirname($FILENAME) . DIRECTORY_SEPARATOR . 'phpbook' . DIRECTORY_SEPARATOR . 'phpbook-xsl/' . 'version.xml', - "phpweb_acronym_filename" => dirname($FILENAME) . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml', -)); + "verbose" => VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING), + "lang_dir" => $ROOT . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR, -$render = new PhDRender(); + "phpweb_version_filename" => PhDConfig::xml_root() . DIRECTORY_SEPARATOR . 'phpbook' . DIRECTORY_SEPARATOR . 'phpbook-xsl' . DIRECTORY_SEPARATOR . 'version.xml', + "phpweb_acronym_filename" => PhDConfig::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml', + )); +$render = new PhDRender(); $reader = new PhDReader(); foreach(range(0, 0) as $i) { - var_dump(date(DATE_RSS)); + //var_dump(date(DATE_RSS)); - if (1) { - // Create indexer - $format = new PhDIndex(); - $render->attach($format); - - $reader->open($INDEX); - $render->render($reader); - - $format->commit(); - $render->detach($format); - - var_dump(date(DATE_RSS)); - } - - // Standalone phpweb Format - $xhtml = new PhDPHPFormat(); - $render->attach($xhtml); - - /* - // Standalone Chunked xHTML Format - $xhtml = new PhDXHTMLFormat(); - $render->attach($xhtml); - - // Use the markup from the Chunked xHTML Format to produce Big xHTML - $bightml = new PhDBigXHTMLFormat(); - $xhtml->attach($bightml); - - // Standalone Big xHTML Format - $bightml = new PhDBigXHTMLFormat(); - $render->attach($bightml); - */ + if (1) { + v("Indexing...", VERBOSE_INDEXING); + // Create indexer + $format = new PhDIndex(); + $render->attach($format); + + $reader->open(PhDConfig::xml_file()); + $render->render($reader); + + $format->commit(); + $render->detach($format); + + v("Indexing done", VERBOSE_INDEXING); + //var_dump(date(DATE_RSS)); + } + + foreach (PhDConfig::output_format() as $format) { + switch($format) { + case "xhtml": // Standalone Chunked xHTML Format + $render->attach(new PhDXHTMLFormat()); + break; + case "php": // Standalone phpweb Format + $render->attach(new PhDPHPFormat()); + break; + case "bigxhtml": // Standalone Big xHTML Format + $render->attach(new PhDBigXHTMLFormat()); + break; + } + } +/* +// Standalone phpweb Format +//$xhtml = new PhDPHPFormat(); +//$render->attach($xhtml); + + +// Standalone Chunked xHTML Format +$xhtml = new PhDXHTMLFormat(); +$render->attach($xhtml); + +// Use the markup from the Chunked xHTML Format to produce Big xHTML +$bightml = new PhDBigXHTMLFormat(); +$xhtml->attach($bightml); + +// Standalone Big xHTML Format +$bightml = new PhDBigXHTMLFormat(); +$render->attach($bightml); +*/ } foreach(range(0, 0) as $i) { - $reader->open($FILENAME); - $render->render($reader); + $reader->open(PhDConfig::xml_file()); + $render->render($reader); } http://cvs.php.net/viewvc.cgi/phd/include/PhDIndex.class.php?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: phd/include/PhDIndex.class.php diff -u phd/include/PhDIndex.class.php:1.2.2.2 phd/include/PhDIndex.class.php:1.2.2.3 --- phd/include/PhDIndex.class.php:1.2.2.2 Mon Jul 28 22:47:59 2008 +++ phd/include/PhDIndex.class.php Tue Jul 29 19:56:49 2008 @@ -1,123 +1,123 @@ <?php class PhDIndex extends PhDFormat { - private $myelementmap = array( - 'article' => 'format_container_chunk', - 'appendix' => 'format_container_chunk', - 'bibliography' => array( - /* DEFAULT */ false, - 'article' => 'format_chunk', - 'book' => 'format_chunk', - 'part' => 'format_chunk', + private $myelementmap = array( + 'article' => 'format_container_chunk', + 'appendix' => 'format_container_chunk', + 'bibliography' => array( + /* DEFAULT */ false, + 'article' => 'format_chunk', + 'book' => 'format_chunk', + 'part' => 'format_chunk', ), - 'book' => 'format_container_chunk', - 'chapter' => 'format_container_chunk', - 'colophon' => 'format_chunk', - 'glossary' => array( - /* DEFAULT */ false, - 'article' => 'format_chunk', - 'book' => 'format_chunk', - 'part' => 'format_chunk', + 'book' => 'format_container_chunk', + 'chapter' => 'format_container_chunk', + 'colophon' => 'format_chunk', + 'glossary' => array( + /* DEFAULT */ false, + 'article' => 'format_chunk', + 'book' => 'format_chunk', + 'part' => 'format_chunk', ), - 'index' => array( - /* DEFAULT */ false, - 'article' => 'format_chunk', - 'book' => 'format_chunk', - 'part' => 'format_chunk', + 'index' => array( + /* DEFAULT */ false, + 'article' => 'format_chunk', + 'book' => 'format_chunk', + 'part' => 'format_chunk', ), - 'legalnotice' => 'format_legalnotice_chunk', - 'part' => 'format_container_chunk', - 'preface' => 'format_chunk', - 'refentry' => 'format_chunk', - 'reference' => 'format_container_chunk', - 'sect1' => 'format_section_chunk', - 'section' => array( - /* DEFAULT */ false, - 'sect1' => 'format_section_chunk', - 'preface' => 'format_section_chunk', - 'chapter' => 'format_section_chunk', - 'appendix' => 'format_section_chunk', - 'article' => 'format_section_chunk', - 'part' => 'format_section_chunk', - 'reference' => 'format_section_chunk', - 'refentry' => 'format_section_chunk', - 'index' => 'format_section_chunk', - 'bibliography' => 'format_section_chunk', - 'glossary' => 'format_section_chunk', - 'colopone' => 'format_section_chunk', - 'book' => 'format_section_chunk', - 'set' => 'format_section_chunk', - 'setindex' => 'format_section_chunk', - 'legalnotice' => 'format_section_chunk', + 'legalnotice' => 'format_legalnotice_chunk', + 'part' => 'format_container_chunk', + 'preface' => 'format_chunk', + 'refentry' => 'format_chunk', + 'reference' => 'format_container_chunk', + 'sect1' => 'format_section_chunk', + 'section' => array( + /* DEFAULT */ false, + 'sect1' => 'format_section_chunk', + 'preface' => 'format_section_chunk', + 'chapter' => 'format_section_chunk', + 'appendix' => 'format_section_chunk', + 'article' => 'format_section_chunk', + 'part' => 'format_section_chunk', + 'reference' => 'format_section_chunk', + 'refentry' => 'format_section_chunk', + 'index' => 'format_section_chunk', + 'bibliography' => 'format_section_chunk', + 'glossary' => 'format_section_chunk', + 'colopone' => 'format_section_chunk', + 'book' => 'format_section_chunk', + 'set' => 'format_section_chunk', + 'setindex' => 'format_section_chunk', + 'legalnotice' => 'format_section_chunk', ), - 'set' => 'format_container_chunk', - 'setindex' => 'format_chunk', + 'set' => 'format_container_chunk', + 'setindex' => 'format_chunk', - 'title' => 'format_ldesc', - 'refpurpose' => 'format_ldesc', - 'refname' => 'format_refname', - 'titleabbrev' => 'format_sdesc', - ); - private $mytextmap = array( - ); - private $chunks = array(); - - public function transformFromMap($open, $tag, $name, $attrs, $props) { - } - public function TEXT($value) { - } - public function CDATA($value) { - } - public function createLink($for, &$desc = null, $desc = PhDFormat::SDESC) { - } - public function appendData($data) { - } + 'title' => 'format_ldesc', + 'refpurpose' => 'format_ldesc', + 'refname' => 'format_refname', + 'titleabbrev' => 'format_sdesc', + ); + private $mytextmap = array( + ); + private $chunks = array(); + + public function transformFromMap($open, $tag, $name, $attrs, $props) { + } + public function TEXT($value) { + } + public function CDATA($value) { + } + public function createLink($for, &$desc = null, $desc = PhDFormat::SDESC) { + } + public function appendData($data) { + } public function update($event, $value = null) { switch($event) { - case PhDRender::CHUNK: + case PhDRender::CHUNK: $this->flags = $value; break; - case PhDRender::STANDALONE: + case PhDRender::STANDALONE: if ($value) { $this->registerElementMap(static::getDefaultElementMap()); $this->registerTextMap(static::getDefaultTextMap()); } break; - case PhDRender::INIT: - if ($value) { - if (file_exists("index.sqlite")) { - unlink("index.sqlite"); - } - $db = sqlite_open("index.sqlite"); - - sqlite_exec($db, 'PRAGMA default_synchronous=OFF'); - sqlite_exec($db, 'PRAGMA count_changes=OFF'); - sqlite_exec($db, 'PRAGMA cache_size=100000'); + case PhDRender::INIT: + if ($value) { + if (file_exists("index.sqlite")) { + unlink("index.sqlite"); + } + $db = sqlite_open("index.sqlite"); + + sqlite_exec($db, 'PRAGMA default_synchronous=OFF'); + sqlite_exec($db, 'PRAGMA count_changes=OFF'); + sqlite_exec($db, 'PRAGMA cache_size=100000'); - $create = <<<SQL + $create = <<<SQL CREATE TABLE ids ( - docbook_id TEXT PRIMARY KEY, - filename TEXT, - parent_id TEXT, - sdesc TEXT, - ldesc TEXT, - element TEXT + docbook_id TEXT PRIMARY KEY, + filename TEXT, + parent_id TEXT, + sdesc TEXT, + ldesc TEXT, + element TEXT ); SQL; - sqlite_exec($db, 'PRAGMA default_synchronous=OFF'); - sqlite_exec($db, 'PRAGMA count_changes=OFF'); - sqlite_exec($db, 'PRAGMA cache_size=100000'); - sqlite_exec($db, $create); - - $this->db = $db; - - $this->chunks = array(); - } else { - //print_r($this->chunks); - } + sqlite_exec($db, 'PRAGMA default_synchronous=OFF'); + sqlite_exec($db, 'PRAGMA count_changes=OFF'); + sqlite_exec($db, 'PRAGMA cache_size=100000'); + sqlite_exec($db, $create); + + $this->db = $db; + + $this->chunks = array(); + } else { + //print_r($this->chunks); + } } } public function getDefaultElementMap() { @@ -126,74 +126,74 @@ public function getDefaultTextMap() { return $this->mytextmap; } - public function UNDEF($open, $name, $attrs, $props) { - if ($open) { + public function UNDEF($open, $name, $attrs, $props) { + if ($open) { if(!isset($attrs[PhDReader::XMLNS_XML]["id"])) { - return false; - } - $id = $attrs[PhDReader::XMLNS_XML]["id"]; - $this->storeInfo($name, $id, $this->currentchunk); - - return false; - } - - if(!isset($attrs[PhDReader::XMLNS_XML]["id"])) { - return false; - } - - $this->appendID(); - return false; - } - protected function storeInfo($elm, $id, $filename) { - $this->nfo[$id] = array( - "parent" => "", - "filename" => $filename, - "sdesc" => "", - "ldesc" => "", - "element" => $elm, - "children" => array(), - ); - $this->ids[] = $id; - $this->currentid = $id; - } - public function appendID() { - static $rand = 0; - - $lastchunkid = array_pop($this->ids); - $parentid = end($this->ids); - - $this->currentid = $parentid; - $a = $this->nfo[$lastchunkid]; - if (is_array($a["sdesc"])) { - $array = true; - $sdesc = array_shift($a["sdesc"]); - } else { - $array = false; - $sdesc = $a["sdesc"]; - } - $this->commit .= sprintf( - "INSERT INTO ids (docbook_id, filename, parent_id, sdesc, ldesc, element) VALUES('%s', '%s', '%s', '%s', '%s', '%s');\n", - sqlite_escape_string($lastchunkid), - sqlite_escape_string($a["filename"]), - sqlite_escape_string($this->currentchunk), - sqlite_escape_string($sdesc), - sqlite_escape_string($a["ldesc"]), - sqlite_escape_string($a["element"]) - ); - if ($array === true && !empty($a["sdesc"])) { - foreach($a["sdesc"] as $sdesc) { - ++$rand; - $this->commit .= sprintf( - "INSERT INTO ids (docbook_id, filename, parent_id, sdesc, ldesc, element) VALUES('%s', '%s', '', '%s', '%s', '%s');\n", - "phdgen-" . $rand, - sqlite_escape_string($a["filename"]), - sqlite_escape_string($sdesc), - sqlite_escape_string($a["ldesc"]), - sqlite_escape_string($a["element"]) - ); - } - } - } + return false; + } + $id = $attrs[PhDReader::XMLNS_XML]["id"]; + $this->storeInfo($name, $id, $this->currentchunk); + + return false; + } + + if(!isset($attrs[PhDReader::XMLNS_XML]["id"])) { + return false; + } + + $this->appendID(); + return false; + } + protected function storeInfo($elm, $id, $filename) { + $this->nfo[$id] = array( + "parent" => "", + "filename" => $filename, + "sdesc" => "", + "ldesc" => "", + "element" => $elm, + "children" => array(), + ); + $this->ids[] = $id; + $this->currentid = $id; + } + public function appendID() { + static $rand = 0; + + $lastchunkid = array_pop($this->ids); + $parentid = end($this->ids); + + $this->currentid = $parentid; + $a = $this->nfo[$lastchunkid]; + if (is_array($a["sdesc"])) { + $array = true; + $sdesc = array_shift($a["sdesc"]); + } else { + $array = false; + $sdesc = $a["sdesc"]; + } + $this->commit .= sprintf( + "INSERT INTO ids (docbook_id, filename, parent_id, sdesc, ldesc, element) VALUES('%s', '%s', '%s', '%s', '%s', '%s');\n", + sqlite_escape_string($lastchunkid), + sqlite_escape_string($a["filename"]), + sqlite_escape_string($this->currentchunk), + sqlite_escape_string($sdesc), + sqlite_escape_string($a["ldesc"]), + sqlite_escape_string($a["element"]) + ); + if ($array === true && !empty($a["sdesc"])) { + foreach($a["sdesc"] as $sdesc) { + ++$rand; + $this->commit .= sprintf( + "INSERT INTO ids (docbook_id, filename, parent_id, sdesc, ldesc, element) VALUES('%s', '%s', '', '%s', '%s', '%s');\n", + "phdgen-" . $rand, + sqlite_escape_string($a["filename"]), + sqlite_escape_string($sdesc), + sqlite_escape_string($a["ldesc"]), + sqlite_escape_string($a["element"]) + ); + } + } + } public function format_section_chunk($open, $name, $attrs, $props) { static $a = array(); if ($open) { @@ -205,13 +205,13 @@ } $x = array_pop($a); if ($x == $name) { - return $this->format_chunk($open, $name, $attrs, $props); + return $this->format_chunk($open, $name, $attrs, $props); } $a[] = $x; return $this->UNDEF($open, $name, $attrs, $props); } public function format_container_chunk($open, $name, $attrs, $props) { - return $this->format_chunk($open, $name, $attrs, $props); + return $this->format_chunk($open, $name, $attrs, $props); } public function format_chunk($open, $name, $attrs, $props) { if ($open) { @@ -220,55 +220,55 @@ } else { $id = uniqid("phd"); } - $this->chunks[] = $id; - $this->currentchunk = $id; - $this->storeInfo($name, $id, $id); + $this->chunks[] = $id; + $this->currentchunk = $id; + $this->storeInfo($name, $id, $id); $this->notify(PhDRender::CHUNK, PhDRender::OPEN); - return false; + return false; } - array_pop($this->chunks); - $this->currentchunk = end($this->chunks); + array_pop($this->chunks); + $this->currentchunk = end($this->chunks); $this->notify(PhDRender::CHUNK, PhDRender::CLOSE); - $this->appendID(); + $this->appendID(); + + return false; + } + public function format_legalnotice_chunk($open, $name, $attrs, $props) { + return $this->format_chunk($open, $name, $attrs, $props); + } + public function format_ldesc($open, $name, $attrs, $props) { + if ($open) { + if (empty($this->nfo[$this->currentid]["ldesc"])) { + /* FIXME: How can I mark that node with "reparse" flag? */ + $s = $this->getReader()->readInnerXml(); + $this->nfo[$this->currentid]["ldesc"] = $s; + } + } + } + public function format_sdesc($open, $name, $attrs, $props) { + if ($open) { + if (empty($this->nfo[$this->currentid]["sdesc"])) { + /* FIXME: How can I mark that node with "reparse" flag? */ + $s = $this->getReader()->readInnerXml(); + $this->nfo[$this->currentid]["sdesc"] = $s; + } - return false; + } + } + public function format_refname($open, $name, $attrs, $props) { + if ($open) { + $s = $this->getReader()->readInnerXml(); + $s = str_replace(array("_", "::", "->"), array("-", "-", "-"), $s); + $this->nfo[$this->currentid]["sdesc"][] = strtolower($s); + } + } + public function commit() { + var_dump(sqlite_exec($this->db, 'BEGIN TRANSACTION; '.$this->commit.' COMMIT')); + $this->commit = null; } - public function format_legalnotice_chunk($open, $name, $attrs, $props) { - return $this->format_chunk($open, $name, $attrs, $props); - } - public function format_ldesc($open, $name, $attrs, $props) { - if ($open) { - if (empty($this->nfo[$this->currentid]["ldesc"])) { - /* FIXME: How can I mark that node with "reparse" flag? */ - $s = $this->getReader()->readInnerXml(); - $this->nfo[$this->currentid]["ldesc"] = $s; - } - } - } - public function format_sdesc($open, $name, $attrs, $props) { - if ($open) { - if (empty($this->nfo[$this->currentid]["sdesc"])) { - /* FIXME: How can I mark that node with "reparse" flag? */ - $s = $this->getReader()->readInnerXml(); - $this->nfo[$this->currentid]["sdesc"] = $s; - } - - } - } - public function format_refname($open, $name, $attrs, $props) { - if ($open) { - $s = $this->getReader()->readInnerXml(); - $s = str_replace(array("_", "::", "->"), array("-", "-", "-"), $s); - $this->nfo[$this->currentid]["sdesc"][] = strtolower($s); - } - } - public function commit() { - var_dump(sqlite_exec($this->db, 'BEGIN TRANSACTION; '.$this->commit.' COMMIT')); - $this->commit = null; - } } http://cvs.php.net/viewvc.cgi/phd/include/PhDFormat.class.php?r1=1.10.6.1&r2=1.10.6.2&diff_format=u Index: phd/include/PhDFormat.class.php diff -u phd/include/PhDFormat.class.php:1.10.6.1 phd/include/PhDFormat.class.php:1.10.6.2 --- phd/include/PhDFormat.class.php:1.10.6.1 Mon Jul 28 22:40:57 2008 +++ phd/include/PhDFormat.class.php Tue Jul 29 19:56:49 2008 @@ -4,38 +4,38 @@ const SDESC = 1; const LDESC = 2; - private $elementmap = array(); - private $textmapmap = array(); - protected $sqlite; + private $elementmap = array(); + private $textmapmap = array(); + protected $sqlite; - private static $autogen = array(); + private static $autogen = array(); - public function __construct() { - $this->sqlite = sqlite_open("index.sqlite"); + public function __construct() { + $this->sqlite = sqlite_open("index.sqlite"); $this->sortIDs(); - } + } - abstract public function transformFromMap($open, $tag, $name, $attrs, $props); - abstract public function UNDEF($open, $name, $attrs, $props); - abstract public function TEXT($value); - abstract public function CDATA($value); - abstract public function createLink($for, &$desc = null, $desc = PhDFormat::SDESC); - abstract public function appendData($data); - abstract public function update($event, $value = null); + abstract public function transformFromMap($open, $tag, $name, $attrs, $props); + abstract public function UNDEF($open, $name, $attrs, $props); + abstract public function TEXT($value); + abstract public function CDATA($value); + abstract public function createLink($for, &$desc = null, $desc = PhDFormat::SDESC); + abstract public function appendData($data); + abstract public function update($event, $value = null); public function sortIDs() { sqlite_create_aggregate($this->sqlite, "idx", array($this, "SQLiteIndex"), array($this, "SQLiteFinal"), 6); sqlite_unbuffered_query($this->sqlite, "SELECT idx(docbook_id, filename, parent_id, sdesc, ldesc, element) FROM ids", SQLITE_ASSOC); - print_r($this->idx); + //print_r($this->idx); } public function SQLiteIndex(&$context, $id, $filename, $parent, $sdesc, $ldesc, $element) { $this->idx[$id] = array( - "docbook_id" => $id, - "filename" => $filename, - "parent_id" => $parent, - "sdesc" => $sdesc, - "ldesc" => $ldesc, - "element" => $element +"docbook_id" => $id, +"filename" => $filename, +"parent_id" => $parent, +"sdesc" => $sdesc, +"ldesc" => $ldesc, +"element" => $element ); if ($element == "refentry") { $this->refs[$sdesc] = $id; @@ -47,50 +47,51 @@ } - final public function notify($event, $val = null) { - $this->update($event, $val); - foreach($this as $format) { - $format->update($event, $val); - } - } - final public function registerElementMap(array $map) { - $this->elementmap = $map; - } - final public function registerTextMap(array $map) { - $this->textmap = $map; - } - final public function attach($obj, $inf = array()) { - if (!($obj instanceof $this) && get_class($obj) != get_class($this)) { - throw new InvalidArgumentException(get_class($this) . " themes *MUST* _inherit_ " .get_class($this). ", got " . get_class($obj)); - } - $obj->notify(PhDRender::STANDALONE, false); - return parent::attach($obj, $inf); - } - final public function getElementMap() { - return $this->elementmap; - } - final public function getTextMap() { - return $this->textmap; - } + final public function notify($event, $val = null) { + $this->update($event, $val); + foreach($this as $format) { + $format->update($event, $val); + } + } + final public function registerElementMap(array $map) { + $this->elementmap = $map; + } + final public function registerTextMap(array $map) { + $this->textmap = $map; + } + final public function attach($obj, $inf = array()) { + if (!($obj instanceof $this) && get_class($obj) != get_class($this)) { + throw new InvalidArgumentException(get_class($this) . " themes *MUST* _inherit_ " .get_class($this). ", got " . get_class($obj)); + } + $obj->notify(PhDRender::STANDALONE, false); + return parent::attach($obj, $inf); + } + final public function getElementMap() { + return $this->elementmap; + } + final public function getTextMap() { + return $this->textmap; + } + final public static function autogen($text, $lang) { if (isset(self::$autogen[$lang])) { - if (isset(self::$autogen[$lang][$text])) { - return self::$autogen[$lang][$text]; - } - if ($lang == PhDConfig::get("fallback_language")) { - throw new InvalidArgumentException("Cannot autogenerate text for '$text'"); - } - return self::autogen($text, PhDConfig::get("fallback_language")); + if (isset(self::$autogen[$lang][$text])) { + return self::$autogen[$lang][$text]; + } + if ($lang == PhDConfig::fallback_language()) { + throw new InvalidArgumentException("Cannot autogenerate text for '$text'"); + } + return self::autogen($text, PhDConfig::fallback_language()); } - $filename = PhDConfig::get("lang_dir") . $lang . ".xml"; + $filename = PhDConfig::lang_dir() . $lang . ".xml"; $r = new XMLReader; if (!file_exists($filename) || !$r->open($filename)) { - if ($lang == PhDConfig::get("fallback_language")) { + if ($lang == PhDConfig::fallback_language()) { throw new Exception("Cannot open $filename"); } - return self::autogen($text, PhDConfig::get("fallback_language")); + return self::autogen($text, PhDConfig::fallback_language()); } $autogen = array(); while ($r->read()) { @@ -107,11 +108,11 @@ } } self::$autogen[$lang] = $autogen; - return self::autogen($text, $lang); + return self::autogen($text, $lang); } - /* {{{ Table helper functions */ +/* {{{ Table helper functions */ public function tgroup($attrs) { if (isset($attrs["cols"])) { $this->TABLE["cols"] = $attrs["cols"]; @@ -127,7 +128,7 @@ return $colspec; } public function getColspec(array $attrs) { - /* defaults */ +/* defaults */ $defaults["colname"] = count($this->TABLE["colspec"])+1; $defaults["colnum"] = count($this->TABLE["colspec"])+1; $defaults["align"] = "left"; @@ -179,11 +180,11 @@ } return 1; } - /* }}} */ +/* }}} */ } /* - * vim600: sw=4 ts=4 fdm=syntax syntax=php et - * vim<600: sw=4 ts=4 - */ +* vim600: sw=4 ts=4 fdm=syntax syntax=php et +* vim<600: sw=4 ts=4 +*/ http://cvs.php.net/viewvc.cgi/phd/include/PhDBuildOptions.class.php?r1=1.6&r2=1.6.2.1&diff_format=u Index: phd/include/PhDBuildOptions.class.php diff -u phd/include/PhDBuildOptions.class.php:1.6 phd/include/PhDBuildOptions.class.php:1.6.2.1 --- phd/include/PhDBuildOptions.class.php:1.6 Mon Jul 21 18:26:35 2008 +++ phd/include/PhDBuildOptions.class.php Tue Jul 29 19:56:49 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: PhDBuildOptions.class.php,v 1.6 2008/07/21 18:26:35 loudi Exp $ */ +/* $Id: PhDBuildOptions.class.php,v 1.6.2.1 2008/07/29 19:56:49 loudi Exp $ */ class PhDBuildOptionsParser extends PhDOptionParser { @@ -10,7 +10,6 @@ { return array( "format:" => "f:", // The format to render (xhtml, pdf...) - "theme:" => "t:", // The theme to render (phpweb, bightml..) "index:" => "i:", // Re-index or load from cache "docbook:" => "d:", // The Docbook XML file to render from (.manual.xml) "output:" => "o:", // The output directory @@ -34,81 +33,26 @@ foreach((array)$v as $i => $val) { switch($val) { case "xhtml": - case "manpage": - case "pdf": + case "bigxhtml": + case "php": if (!in_array($val, $formats)) { $formats[] = $val; } break; default: - trigger_error("Only xhtml, pdf and manpage are supported at this time", E_USER_ERROR); + trigger_error("Only xhtml, bigxhtml and php are supported at this time", E_USER_ERROR); } } PhDConfig::set_output_format($formats); } - public function option_t($k, $v) - { - $this->option_theme($k, $v); - } - public function option_theme($k, $v) - { - /* Remove the default themes */ - $themes = PhDConfig::output_theme(); - $themes['xhtml']['php'] = array(); - $themes['manpage']['php'] = array(); - - foreach((array)$v as $i => $val) { - switch($val) { - case "phpweb": - case "chunkedhtml": - case "bightml": - case "chmsource": - case "phpkdevelop": - if (!in_array($val, $themes["xhtml"]["php"])) { - $themes["xhtml"]["php"][] = $val; - } - break; - case "phpfunctions": - if (!in_array($val, $themes["manpage"]["php"])) { - $themes["manpage"]["php"][] = $val; - } - break; - case "phppdf": - case "phpbigpdf": - if (!in_array($val, $themes["pdf"]["php"])) { - $themes["pdf"]["php"][] = $val; - } - break; - case "pear": - $themes["xhtml"]["pear"] = array( - 'pearweb', - 'pearchunkedhtml', - 'pearbightml', - 'pearchm' - ); - break; - case "pearweb": - case "pearchunkedhtml": - case "pearbightml": - case "pearchm": - if (!in_array($val, $themes["xhtml"]["pear"])) { - $themes["xhtml"]["pear"][] = $val; - } - break; - default: - trigger_error(sprintf("Unknown theme '%s'", $val), E_USER_ERROR); - } - } - PhDConfig::set_output_theme($themes); - } - public function option_i($k, $v) { $this->option_index($k, $v); } public function option_index($k, $v) { + /* if (is_array($v)) { trigger_error(sprintf("You cannot pass %s more than once", $k), E_USER_ERROR); } @@ -117,7 +61,7 @@ PhDConfig::set_index($val); } else { trigger_error("yes/no || on/off || true/false || 1/0 expected", E_USER_ERROR); - } + }*/ } public function option_d($k, $v) @@ -148,8 +92,9 @@ } @mkdir($v, 0777, true); if (!is_dir($v) || !is_readable($v)) { - trigger_error(sprintf("'%s' is not a valid directory", $v), E_USER_ERROR); + trigger_error(sprintf("'%s' is not a valid directory", $v), E_USER_ERROR); die("toto"); } + $v = (substr($v, strlen($v) - strlen(DIRECTORY_SEPARATOR)) == DIRECTORY_SEPARATOR) ? $v : ($v . DIRECTORY_SEPARATOR); PhDConfig::set_output_dir($v); } @@ -239,7 +184,6 @@ public function option_list($k, $v) { static $formatList = NULL; - static $themeList = NULL; if (is_null($formatList)) { $formatList = array(); @@ -247,48 +191,11 @@ $formatList[] = substr(basename($item), 0, -4); } } - if (is_null($themeList)) { - $themeList = array(); - foreach (glob($GLOBALS['ROOT'] . "/themes/*", GLOB_ONLYDIR) as $item) { - if (!in_array(basename($item), array('CVS', '.', '..'))) { - $maintheme = basename($item); - $subthemes = array(); - foreach (glob($item . "/*.php") as $subitem) { - $subthemes[] = substr(basename($subitem), 0, -4); - } - $themeList[$maintheme] = $subthemes; - } - } - } - - if ($v === false) { - $v = array('f', 't'); - } - foreach((array)$v as $val) { - switch($val) { - case "f": - case "format": - case "formats": { - echo "Supported formats:\n"; - echo "\t" . implode("\n\t", $formatList) . "\n"; - break; - } - - case "t": - case "theme": - case "themes": - echo "Supported themes:\n"; - foreach ($themeList as $theme => $subthemes) { - echo "\t" . $theme . "\n\t\t" . implode("\n\t\t", $subthemes) . "\n"; - } - break; - - default: - echo "Unknown list type '$val'\n"; - break; - } - } + echo "Supported formats:\n"; + echo "\t" . implode("\n\t", $formatList) . "\n"; + break; + exit(0); } @@ -336,8 +243,6 @@ --verbose <int> Adjusts the verbosity level -f <formatname> --format <formatname> The build format to use - -t <themename> - --theme <themename> The theme to use -i <bool> --index <bool> Index before rendering (default) or load from cache (false) -d <filename> @@ -347,7 +252,7 @@ -s <id[=bool]> --skip <id[=bool]> The ID to skip, optionally skipping its children chunks (default to true; skip children) -l <formats/themes> - --list <formats/themes> Print out the supported formats/themes (default: both) + --list Print out the supported formats -o <directory> --output <directory> The output directory (default: .) -c <bool> http://cvs.php.net/viewvc.cgi/phd/include/PhDRender.class.php?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: phd/include/PhDRender.class.php diff -u phd/include/PhDRender.class.php:1.2.2.2 phd/include/PhDRender.class.php:1.2.2.3 --- phd/include/PhDRender.class.php:1.2.2.2 Mon Jul 28 22:47:59 2008 +++ phd/include/PhDRender.class.php Tue Jul 29 19:56:49 2008 @@ -1,221 +1,221 @@ <?php class PhDRender extends PhDObjectStorage { - const CHUNK = 0x001; - const OPEN = 0x002; - const CLOSE = 0x004; - const STANDALONE = 0x008; - const INIT = 0x010; - - private $STACK = array(); - - public function __construct() { /* {{{ */ - } /* }}} */ - - public function notXPath($tag, $depth) { /* {{{ */ - do { - if (isset($tag[$this->STACK[--$depth]])) { - $tag = $tag[$this->STACK[$depth]]; - } else { - $tag = $tag[0]; - } - } while (is_array($tag)); - return $tag; - } /* }}} */ - - public function attach($obj, $inf = array()) { /* {{{ */ - if (!($obj instanceof PhDFormat)) { - throw new InvalidArgumentException("All formats *MUST* inherit PhDFormat"); - } - $obj->notify(PhDRender::STANDALONE, true); - - return parent::attach($obj, $inf); - } /* }}} */ - - public function render(PhDReader $r) { /* {{{ */ - PhDObjectStorage::setReader($r); - - foreach($this as $format) { - $format->notify(PhDRender::INIT, true); - } - - $lastdepth = -1; - while($r->read()) { - $type = $r->nodeType; - $data = $retval = $name = $open = false; - - switch($type) { - case XMLReader::ELEMENT: /* {{{ */ - $open = true; - /* break intentionally omitted */ - case XMLReader::END_ELEMENT: - $name = $r->name; - $depth = $r->depth; - $attrs = array( - PhDReader::XMLNS_DOCBOOK => array(), - PhDReader::XMLNS_XML => array(), - ); - - if ($r->hasAttributes) { - $r->moveToFirstAttribute(); - do { - $k = $r->namespaceURI; - $attrs[!empty($k) ? $k : PhDReader::XMLNS_DOCBOOK][$r->localName] = $r->value; - } while ($r->moveToNextAttribute()); - $r->moveToElement(); - } - - $props = array( - "empty" => $r->isEmptyElement, - "isChunk" => false, - "lang" => $r->xmlLang, - "ns" => $r->namespaceURI, - "sibling" => $lastdepth >= $depth ? $this->STACK[$depth] : "", - "depth" => $depth, - ); - - $this->STACK[$depth] = $name; - - foreach($this as $format) { - $map = $this[$format][XMLReader::ELEMENT]; - - if (isset($map[$name]) === false) { - $data = $format->UNDEF($open, $name, $attrs, $props); - $format->appendData($data); - continue; - } - - $tag = $map[$name]; - if (is_array($tag)) { - $tag = $this->notXPath($tag, $depth); - } - - if ($tag === false) { - $data = $format->UNDEF($open, $name, $attrs, $props); - $format->appendData($data); - continue; - } - - if (strncmp($tag, "format_", 7) !== 0) { - $data = $retval = $format->transformFromMap($open, $tag, $name, $attrs, $props); - } else { - $data = $retval = $format->{$tag}($open, $name, $attrs, $props); - } - $format->appendData($data); - - foreach($format as $theme) { - $map = $format[$theme][XMLReader::ELEMENT]; - if (isset($map[$name])) { - $tag = $map[$name]; - - if (is_array($tag)) { - $tag = $this->notXPath($tag, $depth); - } - - if ($tag !== false) { - $retval = $theme->{$tag}($open, $name, $attrs, $props); - - if ($retval !== false) { - $data = $retval; - } - } - } - $theme->appendData($data); - } - } - - $lastdepth = $depth; - break; - /* }}} */ - - case XMLReader::TEXT: /* {{{ */ - $value = $r->value; - $eldepth = $r->depth - 1; - $name = $this->STACK[$eldepth]; - - foreach($this as $format) { - $map = $this[$format][XMLReader::TEXT]; - if (isset($map[$name])) { - $tag = $map[$name]; - - if (is_array($tag)) { - $tag = $this->notXPath($tag, $eldepth); - } - - if ($tag !== false) { - $data = $retval = $format->{$tag}($value, $name); - } else { - $data = $retval = $format->TEXT($value); - } - } else { - $data = $retval = $format->TEXT($value); - } - - if ($data === false) { - $format->appendData($value); - } else { - $format->appendData($data); - } - - foreach($format as $theme) { - $map = $format[$theme][XMLReader::TEXT]; - if (isset($map[$name])) { - $tag = $map[$name]; - - if (is_array($tag)) { - $tag = $this->notXPath($tag, $eldepth); - } - - if ($tag !== false) { - $retval = $format->{$tag}($value, $name); - if ($retval !== false) { - $data = $retval; - } - } - } - $theme->appendData($data); - } - } - break; - /* }}} */ - - case XMLReader::CDATA: /* {{{ */ - /* Different formats may want to escape the CDATA sections differently */ - $value = $r->value; - foreach($this as $format) { - $retval = $format->CDATA($value); - $format->appendData($retval); - foreach($format as $theme) { - $theme->appendData($retval); - } - } - break; - /* }}} */ - - case XMLReader::WHITESPACE: /* {{{ */ - case XMLReader::SIGNIFICANT_WHITESPACE: - /* WS is always WS */ - $retval = $r->value; - foreach($this as $format) { - $format->appendData($retval); - foreach($format as $theme) { - $theme->appendData($retval); - } - } - break; - /* }}} */ - - } - } - - /* Closing time */ - foreach($this as $format) { - //$format->notify(PhDRender::INIT, false); - } - $r->close(); + const CHUNK = 0x001; + const OPEN = 0x002; + const CLOSE = 0x004; + const STANDALONE = 0x008; + const INIT = 0x010; + + private $STACK = array(); + + public function __construct() { /* {{{ */ + } /* }}} */ + + public function notXPath($tag, $depth) { /* {{{ */ + do { + if (isset($tag[$this->STACK[--$depth]])) { + $tag = $tag[$this->STACK[$depth]]; + } else { + $tag = $tag[0]; + } + } while (is_array($tag)); + return $tag; + } /* }}} */ + + public function attach($obj, $inf = array()) { /* {{{ */ + if (!($obj instanceof PhDFormat)) { + throw new InvalidArgumentException("All formats *MUST* inherit PhDFormat"); + } + $obj->notify(PhDRender::STANDALONE, true); + + return parent::attach($obj, $inf); + } /* }}} */ + + public function render(PhDReader $r) { /* {{{ */ + PhDObjectStorage::setReader($r); + + foreach($this as $format) { + $format->notify(PhDRender::INIT, true); + } + + $lastdepth = -1; + while($r->read()) { + $type = $r->nodeType; + $data = $retval = $name = $open = false; + + switch($type) { + case XMLReader::ELEMENT: /* {{{ */ + $open = true; + /* break intentionally omitted */ + case XMLReader::END_ELEMENT: + $name = $r->name; + $depth = $r->depth; + $attrs = array( + PhDReader::XMLNS_DOCBOOK => array(), + PhDReader::XMLNS_XML => array(), + ); + + if ($r->hasAttributes) { + $r->moveToFirstAttribute(); + do { + $k = $r->namespaceURI; + $attrs[!empty($k) ? $k : PhDReader::XMLNS_DOCBOOK][$r->localName] = $r->value; + } while ($r->moveToNextAttribute()); + $r->moveToElement(); + } + + $props = array( + "empty" => $r->isEmptyElement, + "isChunk" => false, + "lang" => $r->xmlLang, + "ns" => $r->namespaceURI, + "sibling" => $lastdepth >= $depth ? $this->STACK[$depth] : "", + "depth" => $depth, + ); + + $this->STACK[$depth] = $name; + + foreach($this as $format) { + $map = $this[$format][XMLReader::ELEMENT]; + + if (isset($map[$name]) === false) { + $data = $format->UNDEF($open, $name, $attrs, $props); + $format->appendData($data); + continue; + } + + $tag = $map[$name]; + if (is_array($tag)) { + $tag = $this->notXPath($tag, $depth); + } + + if ($tag === false) { + $data = $format->UNDEF($open, $name, $attrs, $props); + $format->appendData($data); + continue; + } + + if (strncmp($tag, "format_", 7) !== 0) { + $data = $retval = $format->transformFromMap($open, $tag, $name, $attrs, $props); + } else { + $data = $retval = $format->{$tag}($open, $name, $attrs, $props); + } + $format->appendData($data); + + foreach($format as $theme) { + $map = $format[$theme][XMLReader::ELEMENT]; + if (isset($map[$name])) { + $tag = $map[$name]; + + if (is_array($tag)) { + $tag = $this->notXPath($tag, $depth); + } + + if ($tag !== false) { + $retval = $theme->{$tag}($open, $name, $attrs, $props); + + if ($retval !== false) { + $data = $retval; + } + } + } + $theme->appendData($data); + } + } + + $lastdepth = $depth; + break; + /* }}} */ + + case XMLReader::TEXT: /* {{{ */ + $value = $r->value; + $eldepth = $r->depth - 1; + $name = $this->STACK[$eldepth]; + + foreach($this as $format) { + $map = $this[$format][XMLReader::TEXT]; + if (isset($map[$name])) { + $tag = $map[$name]; + + if (is_array($tag)) { + $tag = $this->notXPath($tag, $eldepth); + } + + if ($tag !== false) { + $data = $retval = $format->{$tag}($value, $name); + } else { + $data = $retval = $format->TEXT($value); + } + } else { + $data = $retval = $format->TEXT($value); + } + + if ($data === false) { + $format->appendData($value); + } else { + $format->appendData($data); + } + + foreach($format as $theme) { + $map = $format[$theme][XMLReader::TEXT]; + if (isset($map[$name])) { + $tag = $map[$name]; + + if (is_array($tag)) { + $tag = $this->notXPath($tag, $eldepth); + } + + if ($tag !== false) { + $retval = $format->{$tag}($value, $name); + if ($retval !== false) { + $data = $retval; + } + } + } + $theme->appendData($data); + } + } + break; + /* }}} */ + + case XMLReader::CDATA: /* {{{ */ + /* Different formats may want to escape the CDATA sections differently */ + $value = $r->value; + foreach($this as $format) { + $retval = $format->CDATA($value); + $format->appendData($retval); + foreach($format as $theme) { + $theme->appendData($retval); + } + } + break; + /* }}} */ + + case XMLReader::WHITESPACE: /* {{{ */ + case XMLReader::SIGNIFICANT_WHITESPACE: + /* WS is always WS */ + $retval = $r->value; + foreach($this as $format) { + $format->appendData($retval); + foreach($format as $theme) { + $theme->appendData($retval); + } + } + break; + /* }}} */ + + } + } + + /* Closing time */ + foreach($this as $format) { + //$format->notify(PhDRender::INIT, false); + } + $r->close(); - PhDObjectStorage::popReader(); + PhDObjectStorage::popReader(); - } /* }}} */ + } /* }}} */ }
« previous php.doc.cvs (#1956) next »