cvs: phd / render.php /phpdotnet/phd BuildOptionsParser.php Config.php Format.php Helper.php Index.php MediaManager.php ObjectStorage.php Reader.php
Render.php Theme.php functions.php /phpdotnet/phd/Format Factory.php Legacy.php Manpage.php PDF.php XHTML.php /phpdotnet/phd/Format/Abstract
XHTML.php /phpdotnet/phd/Package/Default Factory.php XHTML.php /phpdotnet/phd/Reader Legacy.php Partial.php /phpdotnet/phd/Theme XHTML.php
/phpdotnet/phd/Theme/PEAR Base.php BigHTML.php CHM.php ChunkedHTML.php Web.php /phpdotnet/phd/Theme/PHP BigHTML.php BigPDF.php CHMSource.php
ChunkedHTML.php Functions.php HowTo.php KDevelop.php PDF.php PHPDotNet.php Web.php

From: Date: Fri, 19 Jun 2009 21:48:54 +0000
Subject: cvs: phd / render.php /phpdotnet/phd BuildOptionsParser.php Config.php Format.php Helper.php Index.php MediaManager.php ObjectStorage.php Reader.php
Render.php Theme.php functions.php /phpdotnet/phd/Format Factory.php Legacy.php Manpage.php PDF.php XHTML.php /phpdotnet/phd/Format/Abstract
XHTML.php /phpdotnet/phd/Package/Default Factory.php XHTML.php /phpdotnet/phd/Reader Legacy.php Partial.php /phpdotnet/phd/Theme XHTML.php
/phpdotnet/phd/Theme/PEAR Base.php BigHTML.php CHM.php ChunkedHTML.php Web.php /phpdotnet/phd/Theme/PHP BigHTML.php BigPDF.php CHMSource.php
ChunkedHTML.php Functions.php HowTo.php KDevelop.php PDF.php PHPDotNet.php Web.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4167@lists.php.net to get a copy of this message
cweiske Fri Jun 19 21:48:54 2009 UTC Modified files: /phd render.php /phd/phpdotnet/phd BuildOptionsParser.php Config.php Format.php Helper.php Index.php MediaManager.php ObjectStorage.php Reader.php Render.php Theme.php functions.php /phd/phpdotnet/phd/Format Factory.php Legacy.php Manpage.php PDF.php XHTML.php /phd/phpdotnet/phd/Format/Abstract XHTML.php /phd/phpdotnet/phd/Package/Default Factory.php XHTML.php /phd/phpdotnet/phd/Reader Legacy.php Partial.php /phd/phpdotnet/phd/Theme XHTML.php /phd/phpdotnet/phd/Theme/PEAR Base.php BigHTML.php CHM.php ChunkedHTML.php Web.php /phd/phpdotnet/phd/Theme/PHP BigHTML.php BigPDF.php CHMSource.php ChunkedHTML.php Functions.php HowTo.php KDevelop.php PDF.php PHPDotNet.php Web.php Log: Add namespace in (hopefully) every class. This is fully untested! I probably confused Format_Legacy with Format in some files.

http://cvs.php.net/viewvc.cgi/phd/render.php?r1=1.4&r2=1.5&diff_format=u Index: phd/render.php diff -u phd/render.php:1.4 phd/render.php:1.5 --- phd/render.php:1.4 Sat Jun 13 13:00:45 2009 +++ phd/render.php Fri Jun 19 21:48:53 2009 @@ -1,30 +1,13 @@ <?php +namespace phpdotnet\phd; $ROOT = __DIR__; - -require $ROOT . "/include/PhDObjectStorage.class.php"; -require $ROOT . "/include/PhDHelper.class.php"; -require $ROOT . "/config.php"; -include $ROOT . "/include/PhDBuildOptions.class.php"; - -require $ROOT . "/include/PhDReader.class.php"; -require $ROOT . "/include/PhDFormat.class.php"; -require $ROOT . "/include/PhDTheme.class.php"; -require $ROOT . "/include/PhDThemeXhtml.class.php"; - -//Enterprise -require $ROOT . "/include/PhDEnterpriseReader.class.php"; -require $ROOT . "/include/PhDRender.class.php"; -require $ROOT . "/include/PhDEnterpriseFormat.class.php"; -require $ROOT . "/include/PhDIndex.class.php"; -require $ROOT . "/include/PhDFormatFactory.php"; - -require $ROOT . "/formats/AbstractXHTMLFormat.php"; -//require $ROOT . "/formats/AbstractBigXHTMLFormat.php"; -//require $ROOT . "/formats/AbstractPHPFormat.php"; -require $ROOT . "/formats/xhtml.php"; -require $ROOT . "/formats/manpage.php"; -require $ROOT . "/formats/pdf.php"; +function autoload($name) +{ + require_once str_replace(array('\\', '_'), '/', $name) . '.php'; +} +spl_autoload_register(__NAMESPACE__ . '\\autoload'); +require_once 'phpdotnet/phd/functions.php'; //$INDEX = "/Users/loudi/Travail/phpdoc/.manual.xml"; //$FILENAME = "/Users/loudi/Travail/phpdoc/.manual.xml"; @@ -32,39 +15,39 @@ define("NO_SQLITE", false); /* If no docbook file was passed, die */ -if (!is_dir(PhDConfig::xml_root()) || !is_file(PhDConfig::xml_file())) { +if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) { trigger_error("No '.manual.xml' file was given. Specify it on the command line with --docbook.", E_USER_ERROR); } -if (!file_exists(PhDConfig::output_dir())) { +if (!file_exists(Config::output_dir())) { v("Creating output directory..", E_USER_NOTICE); - if (!mkdir(PhDConfig::output_dir())) { + if (!mkdir(Config::output_dir())) { v("Can't create output directory", E_USER_ERROR); } -} elseif (!is_dir(PhDConfig::output_dir())) { +} elseif (!is_dir(Config::output_dir())) { v("Output directory is not a file?", E_USER_ERROR); } -PhDConfig::init(array( +Config::init(array( "verbose" => VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING), "lang_dir" => $ROOT . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR, - "phpweb_version_filename" => PhDConfig::xml_root() . DIRECTORY_SEPARATOR . 'version.xml', - "phpweb_acronym_filename" => PhDConfig::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml', + "phpweb_version_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'version.xml', + "phpweb_acronym_filename" => Config::xml_root() . DIRECTORY_SEPARATOR . 'entities' . DIRECTORY_SEPARATOR . 'acronyms.xml', )); -$render = new PhDRender(); -$reader = new PhDEnterpriseReader(); -$factory = PhDFormatFactory::createFactory(); +$render = new Render(); +$reader = new EnterpriseReader(); +$factory = FormatFactory::createFactory(); // Indexing & registering formats foreach(range(0, 0) as $i) { - if (PhDIndex::requireIndexing()) { + if (Index::requireIndexing()) { v("Indexing...", VERBOSE_INDEXING); // Create indexer - $format = new PhDIndex(); + $format = new Index(); $render->attach($format); - $reader->open(PhDConfig::xml_file()); + $reader->open(Config::xml_file()); $render->render($reader); $format->commit(); @@ -75,7 +58,7 @@ v("Skipping indexing", VERBOSE_INDEXING); } - foreach (PhDConfig::output_format() as $format) { + foreach (Config::output_format() as $format) { switch($format) { case "xhtml": // Standalone Chunked xHTML Format $render->attach($factory->createXhtmlFormat()); @@ -92,9 +75,9 @@ // Rendering formats foreach(range(0, 0) as $i) { - $reader->open(PhDConfig::xml_file()); + $reader->open(Config::xml_file()); foreach($render as $format) { - $format->notify(PhDRender::VERBOSE, true); + $format->notify(Render::VERBOSE, true); } $render->render($reader); } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/BuildOptionsParser.php?r1=1.14&r2=1.15&diff_format=u Index: phd/phpdotnet/phd/BuildOptionsParser.php diff -u phd/phpdotnet/phd/BuildOptionsParser.php:1.14 phd/phpdotnet/phd/BuildOptionsParser.php:1.15 --- phd/phpdotnet/phd/BuildOptionsParser.php:1.14 Thu Jun 4 14:09:10 2009 +++ phd/phpdotnet/phd/BuildOptionsParser.php Fri Jun 19 21:48:53 2009 @@ -1,7 +1,8 @@ <?php -/* $Id: BuildOptionsParser.php,v 1.14 2009/06/04 14:09:10 moacir Exp $ */ +namespace phpdotnet\phd; +/* $Id: BuildOptionsParser.php,v 1.15 2009/06/19 21:48:53 cweiske Exp $ */ -class PhDBuildOptionsParser extends PhDOptionParser +class BuildOptionsParser extends OptionParser { public $docbook = false; public $verbose = 0; @@ -49,7 +50,7 @@ trigger_error("Format not supported at this time", E_USER_ERROR); } } - PhDConfig::set_output_format($formats); + Config::set_output_format($formats); } public function option_g($k, $v) @@ -58,7 +59,7 @@ } public function option_highlighter($k, $v) { - PhDConfig::setHighlighter($v); + Config::setHighlighter($v); } public function option_i($k, $v) @@ -67,7 +68,7 @@ } public function option_noindex($k, $v) { - PhDConfig::set_index(false); + Config::set_index(false); } public function option_d($k, $v) @@ -82,8 +83,8 @@ if (!file_exists($v) || is_dir($v) || !is_readable($v)) { trigger_error(sprintf("'%s' is not a readable docbook file", $v), E_USER_ERROR); } - PhDConfig::set_xml_root(dirname($v)); - PhDConfig::set_xml_file($v); + Config::set_xml_root(dirname($v)); + Config::set_xml_file($v); $this->docbook = true; } @@ -101,7 +102,7 @@ trigger_error(sprintf("'%s' is not a valid directory", $v), E_USER_ERROR); } $v = (substr($v, strlen($v) - strlen(DIRECTORY_SEPARATOR)) == DIRECTORY_SEPARATOR) ? $v : ($v . DIRECTORY_SEPARATOR); - PhDConfig::set_output_dir($v); + Config::set_output_dir($v); } public function option_p($k, $v) @@ -113,7 +114,7 @@ } public function option_partial($k, $v) { - $render_ids = PhDConfig::render_ids(); + $render_ids = Config::render_ids(); foreach((array)$v as $i => $val) { $recursive = true; if (strpos($val, "=") !== false) { @@ -126,7 +127,7 @@ } $render_ids[$val] = $recursive; } - PhDConfig::set_render_ids($render_ids); + Config::set_render_ids($render_ids); } public function option_package($k, $v) { @@ -142,7 +143,7 @@ } if (in_array($v, $packageList)) { - PhDConfig::set_package($v); + Config::set_package($v); } else { trigger_error("Invalid Package", E_USER_ERROR); } @@ -154,7 +155,7 @@ } public function option_skip($k, $v) { - $skip_ids = PhDConfig::skip_ids(); + $skip_ids = Config::skip_ids(); foreach((array)$v as $i => $val) { $recursive = true; if (strpos($val, "=") !== false) { @@ -167,7 +168,7 @@ } $skip_ids[$val] = $recursive; } - PhDConfig::set_skip_ids($skip_ids); + Config::set_skip_ids($skip_ids); } public function option_v($k, $v) @@ -184,7 +185,7 @@ } else { $this->verbose |= 1; } - PhDConfig::set_verbose($this->verbose); + Config::set_verbose($this->verbose); error_reporting($GLOBALS['olderrrep'] | $this->verbose); } @@ -201,7 +202,7 @@ } } } - PhDConfig::set_verbose($this->verbose); + Config::set_verbose($this->verbose); error_reporting($GLOBALS['olderrrep'] | $this->verbose); } @@ -241,7 +242,7 @@ public function option_lang($k, $v) { - PhDConfig::set_language($v); + Config::set_language($v); } public function option_c($k, $v) { @@ -255,13 +256,13 @@ $val = phd_bool($v); if (is_bool($val)) { if ($val && function_exists('posix_isatty')) { - PhDConfig::set_phd_info_color(posix_isatty(PhDConfig::phd_info_output()) ? '01;32' : false); // Bright (bold) green - PhDConfig::set_user_error_color(posix_isatty(PhDConfig::user_error_output()) ? '01;33' : false); // Bright (bold) yellow - PhDConfig::set_php_error_color(posix_isatty(PhDConfig::php_error_output()) ? '01;31' : false); // Bright (bold) red + Config::set_phd_info_color(posix_isatty(Config::phd_info_output()) ? '01;32' : false); // Bright (bold) green + Config::set_user_error_color(posix_isatty(Config::user_error_output()) ? '01;33' : false); // Bright (bold) yellow + Config::set_php_error_color(posix_isatty(Config::php_error_output()) ? '01;31' : false); // Bright (bold) red } else { - PhDConfig::set_phd_info_color(false); - PhDConfig::set_user_error_color(false); - PhDConfig::set_php_error_color(false); + Config::set_phd_info_color(false); + Config::set_user_error_color(false); + Config::set_php_error_color(false); } } else { trigger_error("yes/no || on/off || true/false || 1/0 expected", E_USER_ERROR); @@ -270,8 +271,8 @@ public function option_version($k, $v) { - $color = PhDConfig::phd_info_color(); - $output = PhDConfig::phd_info_output(); + $color = Config::phd_info_color(); + $output = Config::phd_info_output(); if (isset($GLOBALS['base_revision'])) { $rev = preg_replace('/\$Re[v](?:ision)?(: ([\d.]+) ?)?\$$/e', "'\\1' == '' ? '??' : '\\2'", $GLOBALS['base_revision']); fprintf($output, "%s\n", term_color("PhD Version: " . PHD_VERSION . " (" . $rev . ")", $color)); @@ -331,7 +332,7 @@ } } -$optParser = new PhDBuildOptionsParser; +$optParser = new BuildOptionsParser; $optParser->getopt(); ?> http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Config.php?r1=1.59&r2=1.60&diff_format=u Index: phd/phpdotnet/phd/Config.php diff -u phd/phpdotnet/phd/Config.php:1.59 phd/phpdotnet/phd/Config.php:1.60 --- phd/phpdotnet/phd/Config.php:1.59 Sat Jun 13 12:59:06 2009 +++ phd/phpdotnet/phd/Config.php Fri Jun 19 21:48:53 2009 @@ -1,11 +1,10 @@ <?php -/* $Id: Config.php,v 1.59 2009/06/13 12:59:06 moacir Exp $ */ - -require $ROOT . "/include/PhDErrors.php"; +namespace phpdotnet\phd; +/* $Id: Config.php,v 1.60 2009/06/19 21:48:53 cweiske Exp $ */ define("PHD_VERSION", "phd-from-cvs"); -class PhDConfig +class Config { private static $optionArray = array( 'output_format' => array( @@ -39,7 +38,7 @@ 'user_error_color' => false, 'phd_info_output' => NULL, 'phd_info_color' => false, - 'highlighter' => 'PhDHighlighter', + 'highlighter' => '\phpdotnet\phd\Highlighter', 'package' => 'PHP', ); @@ -64,9 +63,9 @@ } } -PhDConfig::set_php_error_output(STDERR); -PhDConfig::set_user_error_output(STDERR); -PhDConfig::set_phd_info_output(STDOUT); +Config::set_php_error_output(STDERR); +Config::set_user_error_output(STDERR); +Config::set_phd_info_output(STDOUT); /* {{{ Workaround/fix for Windows prior to PHP5.3 */ if (!function_exists('getopt')) { @@ -111,7 +110,7 @@ } /* }}} */ -abstract class PhDOptionParser +abstract class OptionParser { abstract public function getOptionList(); http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format.php?r1=1.1&r2=1.2&diff_format=u Index: phd/phpdotnet/phd/Format.php diff -u phd/phpdotnet/phd/Format.php:1.1 phd/phpdotnet/phd/Format.php:1.2 --- phd/phpdotnet/phd/Format.php:1.1 Sat Jun 13 11:18:08 2009 +++ phd/phpdotnet/phd/Format.php Fri Jun 19 21:48:53 2009 @@ -1,6 +1,7 @@ <?php +namespace phpdotnet\phd; -abstract class PhDEnterpriseFormat extends PhDObjectStorage { +abstract class EnterpriseFormat extends ObjectStorage { const SDESC = 1; const LDESC = 2; @@ -16,8 +17,8 @@ private static $autogen = array(); public function __construct() { - if (file_exists(PhDConfig::output_dir() . "index.sqlite")) { - $this->sqlite = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); + if (file_exists(Config::output_dir() . "index.sqlite")) { + $this->sqlite = new SQLite3(Config::output_dir() . 'index.sqlite'); $this->sortIDs(); } } @@ -26,7 +27,7 @@ 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, $type = PhDEnterpriseFormat::SDESC); + abstract public function createLink($for, &$desc = null, $type = EnterpriseFormat::SDESC); abstract public function appendData($data); abstract public function update($event, $value = null); @@ -82,7 +83,7 @@ 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); + $obj->notify(Render::STANDALONE, false); return parent::attach($obj, $inf); } final public function getElementMap() { @@ -104,8 +105,8 @@ final public function parse($xml) { $parsed = ""; - $reader = new PhDEnterpriseReader(); - $render = new PhDRender(); + $reader = new EnterpriseReader(); + $render = new Render(); $reader->XML("<notatag>" . $xml . "</notatag>"); @@ -124,20 +125,20 @@ if (isset(self::$autogen[$lang][$text])) { return self::$autogen[$lang][$text]; } - if ($lang == PhDConfig::fallback_language()) { + if ($lang == Config::fallback_language()) { throw new InvalidArgumentException("Cannot autogenerate text for '$text'"); } - return self::autogen($text, PhDConfig::fallback_language()); + return self::autogen($text, Config::fallback_language()); } - $filename = PhDConfig::lang_dir() . $lang . ".xml"; + $filename = Config::lang_dir() . $lang . ".xml"; $r = new XMLReader; if (!file_exists($filename) || !$r->open($filename)) { - if ($lang == PhDConfig::fallback_language()) { + if ($lang == Config::fallback_language()) { throw new Exception("Cannot open $filename"); } - return self::autogen($text, PhDConfig::fallback_language()); + return self::autogen($text, Config::fallback_language()); } $autogen = array(); while ($r->read()) { http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Helper.php?r1=1.14&r2=1.15&diff_format=u Index: phd/phpdotnet/phd/Helper.php diff -u phd/phpdotnet/phd/Helper.php:1.14 phd/phpdotnet/phd/Helper.php:1.15 --- phd/phpdotnet/phd/Helper.php:1.14 Thu May 28 07:32:10 2009 +++ phd/phpdotnet/phd/Helper.php Fri Jun 19 21:48:53 2009 @@ -1,10 +1,11 @@ <?php -/* $Id: Helper.php,v 1.14 2009/05/28 07:32:10 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: Helper.php,v 1.15 2009/06/19 21:48:53 cweiske Exp $ */ /** -* Base class for PhDTheme +* Base class for Theme */ -class PhDHelper +class Helper { /** * Array of all ids as key and their "attributes" (not xml-atts) @@ -163,8 +164,8 @@ */ final public function autogen($text, $lang) { - if (isset(PhDHelper::$autogen[$lang])) { - return PhDHelper::$autogen[$lang][$text]; + if (isset(Helper::$autogen[$lang])) { + return Helper::$autogen[$lang][$text]; } $filename = dirname(__FILE__) ."/langs/$lang.xml"; @@ -189,8 +190,8 @@ $autogen[$k] = $r->value; } } - PhDHelper::$autogen[$lang] = $autogen; - return PhDHelper::$autogen[$lang][$text]; + Helper::$autogen[$lang] = $autogen; + return Helper::$autogen[$lang][$text]; } /** @@ -205,13 +206,13 @@ public function highlight($text, $role = 'php', $format = 'xhtml') { if (!isset(self::$highlighters[$format])) { - $class = PhdConfig::highlighter(); + $class = Config::highlighter(); if (!class_exists($class, true)) { - if ($class == 'PhDHighlighter') { + if ($class == 'Highlighter') { //hard coded path for phdhighlighter, since phd doesn't follow // pear file conventions - require_once dirname(__FILE__) . '/PhDHighlighter.class.php'; + require_once dirname(__FILE__) . '/Highlighter.class.php'; } else { //simple autoload replacement for pear-style classes require_once str_replace('_', '/', $class) . '.php'; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Index.php?r1=1.3&r2=1.4&diff_format=u Index: phd/phpdotnet/phd/Index.php diff -u phd/phpdotnet/phd/Index.php:1.3 phd/phpdotnet/phd/Index.php:1.4 --- phd/phpdotnet/phd/Index.php:1.3 Sat Jun 13 11:18:08 2009 +++ phd/phpdotnet/phd/Index.php Fri Jun 19 21:48:53 2009 @@ -1,5 +1,8 @@ <?php -class PhDIndex extends PhDEnterpriseFormat { +namespace phpdotnet\phd; + +class Index extends Format_Enterprise +{ private $myelementmap = array( 'article' => 'format_container_chunk', 'appendix' => 'format_container_chunk', @@ -72,19 +75,19 @@ } public function CDATA($value) { } - public function createLink($for, &$desc = null, $type = PhDEnterpriseFormat::SDESC) { + public function createLink($for, &$desc = null, $type = Format_Enterprise::SDESC) { } public function appendData($data) { } // Require indexing if --index=true, if no indexing has been successfully done before // or if xml input file has changed since the last indexing final static public function requireIndexing() { - if (!PhDConfig::index() && file_exists(PhDConfig::output_dir() . "index.sqlite")) { - $db = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); + if (!Config::index() && file_exists(Config::output_dir() . "index.sqlite")) { + $db = new SQLite3(Config::output_dir() . 'index.sqlite'); $indexingCount = $db->query('SELECT COUNT(time) FROM indexing')->fetchArray(SQLITE3_NUM); if ($indexingCount[0] > 0) { $indexing = $db->query('SELECT time FROM indexing')->fetchArray(SQLITE3_ASSOC); - $xmlLastModification = filemtime(PhDConfig::xml_file()); + $xmlLastModification = filemtime(Config::xml_file()); if ($indexing["time"] > $xmlLastModification) { return false; } @@ -94,24 +97,24 @@ } public function update($event, $value = null) { switch($event) { - case PhDRender::CHUNK: + case Render::CHUNK: $this->flags = $value; break; - case PhDRender::STANDALONE: + case Render::STANDALONE: if ($value) { $this->registerElementMap(static::getDefaultElementMap()); $this->registerTextMap(static::getDefaultTextMap()); } break; - case PhDRender::INIT: + case Render::INIT: if ($value) { - if (file_exists(PhDConfig::output_dir() . "index.sqlite")) { - $db = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); + if (file_exists(Config::output_dir() . "index.sqlite")) { + $db = new SQLite3(Config::output_dir() . 'index.sqlite'); $db->exec('DELETE FROM ids'); $db->exec('DELETE FROM indexing'); } else { - $db = new SQLite3(PhDConfig::output_dir() . 'index.sqlite'); + $db = new SQLite3(Config::output_dir() . 'index.sqlite'); $create = <<<SQL CREATE TABLE ids ( docbook_id TEXT PRIMARY KEY, @@ -139,7 +142,7 @@ print_r($this->chunks); } break; - case PhDRender::FINALIZE: + case Render::FINALIZE: $this->db->exec("INSERT INTO indexing (time) VALUES ('" . time() . "')"); break; } @@ -152,14 +155,14 @@ } public function UNDEF($open, $name, $attrs, $props) { /*if ($open) { - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader_Enterprise::XMLNS_XML]["id"])) { + $id = $attrs[Reader_Enterprise::XMLNS_XML]["id"]; $this->storeInfo($name, $id, $this->currentchunk); } return false; } - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { + if(isset($attrs[Reader_Enterprise::XMLNS_XML]["id"])) { $this->appendID(); }*/ return false; @@ -235,8 +238,8 @@ if ($props["sibling"] === $name) { return $this->format_chunk($open, $name, $attrs, $props); } - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader_Enterprise::XMLNS_XML]["id"])) { + $id = $attrs[Reader_Enterprise::XMLNS_XML]["id"]; return $this->storeInfo($name, $id, $this->currentchunk, false); } return $this->UNDEF($open, $name, $attrs, $props); @@ -246,8 +249,8 @@ return $this->format_chunk($open, $name, $attrs, $props); } $sectionChunks[] = $x; - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader_Enterprise::XMLNS_XML]["id"])) { + $id = $attrs[Reader_Enterprise::XMLNS_XML]["id"]; return $this->appendID(false); } return $this->UNDEF($open, $name, $attrs, $props); @@ -257,8 +260,8 @@ } public function format_chunk($open, $name, $attrs, $props) { if ($open) { - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader_Enterprise::XMLNS_XML]["id"])) { + $id = $attrs[Reader_Enterprise::XMLNS_XML]["id"]; } else { $id = uniqid("phd"); } @@ -266,14 +269,14 @@ $this->currentchunk = $id; $this->storeInfo($name, $id, $id); - $this->notify(PhDRender::CHUNK, PhDRender::OPEN); + $this->notify(Render::CHUNK, Render::OPEN); return false; } array_pop($this->chunks); $this->currentchunk = end($this->chunks); - $this->notify(PhDRender::CHUNK, PhDRender::CLOSE); + $this->notify(Render::CHUNK, Render::CLOSE); $this->appendID(); return false; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/MediaManager.php?r1=1.4&r2=1.5&diff_format=u Index: phd/phpdotnet/phd/MediaManager.php diff -u phd/phpdotnet/phd/MediaManager.php:1.4 phd/phpdotnet/phd/MediaManager.php:1.5 --- phd/phpdotnet/phd/MediaManager.php:1.4 Thu Feb 19 11:57:43 2009 +++ phd/phpdotnet/phd/MediaManager.php Fri Jun 19 21:48:53 2009 @@ -1,5 +1,6 @@ <?php -/* $Id: MediaManager.php,v 1.4 2009/02/19 11:57:43 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: MediaManager.php,v 1.5 2009/06/19 21:48:53 cweiske Exp $ */ /** * Handles images (and other media objects) referenced in the docbook files. @@ -8,7 +9,7 @@ * * @author Christian Weiske <cweiske@php.net> */ -class PhDMediaManager +class MediaManager { /** * Directory where files are put @@ -108,6 +109,6 @@ copy($fullfilename, $fullpath); }//protected function copyOver(..) -}//class PhDMediaManager +}//class MediaManager ?> http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/ObjectStorage.php?r1=1.3&r2=1.4&diff_format=u Index: phd/phpdotnet/phd/ObjectStorage.php diff -u phd/phpdotnet/phd/ObjectStorage.php:1.3 phd/phpdotnet/phd/ObjectStorage.php:1.4 --- phd/phpdotnet/phd/ObjectStorage.php:1.3 Sat Jun 13 11:18:08 2009 +++ phd/phpdotnet/phd/ObjectStorage.php Fri Jun 19 21:48:53 2009 @@ -1,10 +1,15 @@ <?php -class PhDObjectStorage extends SplObjectStorage { +namespace phpdotnet\phd; + +class ObjectStorage extends \SplObjectStorage +{ protected static $r = array(); public function attach($obj, $inf = array()) { - if (!($obj instanceof PhDEnterpriseFormat)) { - throw new InvalidArgumentException("Only classess inheriting PhDEnterpriseFormat supported"); + if (!($obj instanceof Format_Enterprise)) { + throw new InvalidArgumentException( + 'Only classess inheriting ' . __NAMESPACE__ . '\\Format_Enterprise supported' + ); } if (empty($inf)) { $inf = array( @@ -14,7 +19,7 @@ } parent::attach($obj, $inf); } - final protected static function setReader(PhDEnterpriseReader $r) { + final protected static function setReader(Reader_Enterprise $r) { self::$r[] = $r; } final protected function getReader() { http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Reader.php?r1=1.1&r2=1.2&diff_format=u Index: phd/phpdotnet/phd/Reader.php diff -u phd/phpdotnet/phd/Reader.php:1.1 phd/phpdotnet/phd/Reader.php:1.2 --- phd/phpdotnet/phd/Reader.php:1.1 Sat Jun 13 11:18:08 2009 +++ phd/phpdotnet/phd/Reader.php Fri Jun 19 21:48:53 2009 @@ -1,8 +1,10 @@ <?php -/* $Id: Reader.php,v 1.1 2009/06/13 11:18:08 moacir Exp $ */ +namespace phpdotnet\phd; +/* $Id: Reader.php,v 1.2 2009/06/19 21:48:53 cweiske Exp $ */ //6271 -class PhDEnterpriseReader extends XMLReader { +class Reader extends \XMLReader +{ const XMLNS_XML = "http://www.w3.org/XML/1998/namespace"; const XMLNS_XLINK = "http://www.w3.org/1999/xlink"; const XMLNS_PHD = "http://www.php.net/ns/phd"; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Render.php?r1=1.3&r2=1.4&diff_format=u Index: phd/phpdotnet/phd/Render.php diff -u phd/phpdotnet/phd/Render.php:1.3 phd/phpdotnet/phd/Render.php:1.4 --- phd/phpdotnet/phd/Render.php:1.3 Sat Jun 13 11:18:08 2009 +++ phd/phpdotnet/phd/Render.php Fri Jun 19 21:48:53 2009 @@ -1,5 +1,8 @@ <?php -class PhDRender extends PhDObjectStorage { +namespace phpdotnet\phd; + +class Render extends ObjectStorage +{ const CHUNK = 0x001; const OPEN = 0x002; const CLOSE = 0x004; @@ -25,19 +28,21 @@ } /* }}} */ public function attach($obj, $inf = array()) { /* {{{ */ - if (!($obj instanceof PhDEnterpriseFormat)) { - throw new InvalidArgumentException("All formats *MUST* inherit PhDEnterpriseFormat"); + if (!($obj instanceof Format)) { + throw new InvalidArgumentException( + 'All formats *MUST* inherit ' . __NAMESPACE__ . '\\Format' + ); } - $obj->notify(PhDRender::STANDALONE, true); + $obj->notify(Render::STANDALONE, true); return parent::attach($obj, $inf); } /* }}} */ - public function render(PhDEnterpriseReader $r) { /* {{{ */ - PhDObjectStorage::setReader($r); + public function render(Reader $r) { /* {{{ */ + ObjectStorage::setReader($r); foreach($this as $format) { - $format->notify(PhDRender::INIT, true); + $format->notify(Render::INIT, true); } $lastdepth = -1; @@ -53,15 +58,15 @@ $name = $r->name; $depth = $r->depth; $attrs = array( - PhDEnterpriseReader::XMLNS_DOCBOOK => array(), - PhDEnterpriseReader::XMLNS_XML => array(), + Reader::XMLNS_DOCBOOK => array(), + Reader::XMLNS_XML => array(), ); if ($r->hasAttributes) { $r->moveToFirstAttribute(); do { $k = $r->namespaceURI; - $attrs[!empty($k) ? $k : PhDEnterpriseReader::XMLNS_DOCBOOK][$r->localName] = $r->value; + $attrs[!empty($k) ? $k : Reader::XMLNS_DOCBOOK][$r->localName] = $r->value; } while ($r->moveToNextAttribute()); $r->moveToElement(); } @@ -214,11 +219,11 @@ /* Closing time */ foreach($this as $format) { - $format->notify(PhDRender::FINALIZE, true); + $format->notify(Render::FINALIZE, true); } $r->close(); - PhDObjectStorage::popReader(); + ObjectStorage::popReader(); } /* }}} */ http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme.php?r1=1.4&r2=1.5&diff_format=u Index: phd/phpdotnet/phd/Theme.php diff -u phd/phpdotnet/phd/Theme.php:1.4 phd/phpdotnet/phd/Theme.php:1.5 --- phd/phpdotnet/phd/Theme.php:1.4 Tue Feb 17 19:03:32 2009 +++ phd/phpdotnet/phd/Theme.php Fri Jun 19 21:48:53 2009 @@ -1,8 +1,10 @@ <?php -/* $Id: Theme.php,v 1.4 2009/02/17 19:03:32 cweiske Exp $ */ -require $ROOT. "/include/PhDMediaManager.class.php"; +namespace phpdotnet\phd; -abstract class PhDTheme extends PhDHelper implements iPhDTheme { +/* $Id: Theme.php,v 1.5 2009/06/19 21:48:53 cweiske Exp $ */ + +abstract class Theme extends Helper implements iTheme +{ protected $format; @@ -22,7 +24,7 @@ /** * Overwritten in xhtml themes only. * - * @see PhDThemeXhtml::postConstruct() + * @see Theme_XHTML::postConstruct() */ public function postConstruct() {} @@ -33,7 +35,7 @@ } } -interface iPhDTheme { +interface iTheme { public function appendData($data, $isChunk); } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/functions.php?r1=1.6&r2=1.7&diff_format=u Index: phd/phpdotnet/phd/functions.php diff -u phd/phpdotnet/phd/functions.php:1.6 phd/phpdotnet/phd/functions.php:1.7 --- phd/phpdotnet/phd/functions.php:1.6 Wed Feb 11 05:08:17 2009 +++ phd/phpdotnet/phd/functions.php Fri Jun 19 21:48:53 2009 @@ -1,5 +1,6 @@ <?php -/* $Id: functions.php,v 1.6 2009/02/11 05:08:17 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: functions.php,v 1.7 2009/06/19 21:48:53 cweiske Exp $ */ /* {{{ PhD error & message handler */ @@ -84,7 +85,7 @@ } $recursive = true; - $time = date(PhDConfig::date_format()); + $time = date(Config::date_format()); switch($errno) { case VERBOSE_INDEXING: case VERBOSE_FORMAT_RENDERING: @@ -96,8 +97,8 @@ case VERBOSE_CHUNK_WRITING: case VERBOSE_NOVERSION: case VERBOSE_BROKEN_LINKS: - $color = PhDConfig::phd_info_color(); - $output = PhDConfig::phd_info_output(); + $color = Config::phd_info_color(); + $output = Config::phd_info_output(); $data = $msg; break; @@ -105,8 +106,8 @@ case E_USER_ERROR: case E_USER_WARNING: case E_USER_NOTICE: - $color = PhDConfig::user_error_color(); - $output = PhDConfig::user_error_output(); + $color = Config::user_error_color(); + $output = Config::user_error_output(); $data = sprintf("%s:%d\n\t%s", $file, $line, $msg); break; @@ -116,8 +117,8 @@ case E_STRICT: case E_WARNING: case E_NOTICE: - $color = PhDConfig::php_error_color(); - $output = PhDConfig::php_error_output(); + $color = Config::php_error_color(); + $output = Config::php_error_output(); $data = sprintf("%s:%d\n\t%s", $file, $line, $msg); break; @@ -138,7 +139,7 @@ return true; } /* }}} */ -set_error_handler("errh"); +set_error_handler(__NAMESPACE__ . '\\errh'); /* }}} */ ?> http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format/Factory.php?r1=1.2&r2=1.3&diff_format=u Index: phd/phpdotnet/phd/Format/Factory.php diff -u phd/phpdotnet/phd/Format/Factory.php:1.2 phd/phpdotnet/phd/Format/Factory.php:1.3 --- phd/phpdotnet/phd/Format/Factory.php:1.2 Sat Jun 13 11:18:08 2009 +++ phd/phpdotnet/phd/Format/Factory.php Fri Jun 19 21:48:53 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -abstract class PhDFormatFactory { +abstract class Format_Factory +{ public function createXhtmlFormat() { trigger_error("This format is not supported by this package", E_USER_ERROR); } @@ -11,15 +13,16 @@ trigger_error("This format is not supported by this package", E_USER_ERROR); } - public static final function createFactory() { + public static final function createFactory() + { global $ROOT; - $package = PhDConfig::package(); + $package = Config::package(); $classname = "{$package}Factory"; require_once $ROOT . "/packages/$package/$classname.class.php"; $factory = new $classname(); - if (!($factory instanceof PhDFormatFactory)) { + if (!($factory instanceof Format_Factory)) { throw new Exception("All Factories must inherit PhDFormatFactory"); } return $factory; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format/Legacy.php?r1=1.13&r2=1.14&diff_format=u Index: phd/phpdotnet/phd/Format/Legacy.php diff -u phd/phpdotnet/phd/Format/Legacy.php:1.13 phd/phpdotnet/phd/Format/Legacy.php:1.14 --- phd/phpdotnet/phd/Format/Legacy.php:1.13 Tue Feb 17 19:03:32 2009 +++ phd/phpdotnet/phd/Format/Legacy.php Fri Jun 19 21:48:53 2009 @@ -1,7 +1,9 @@ <?php -/* $Id: Legacy.php,v 1.13 2009/02/17 19:03:32 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: Legacy.php,v 1.14 2009/06/19 21:48:53 cweiske Exp $ */ -abstract class PhDFormat extends PhDHelper { +abstract class Format_Legacy extends Helper +{ private $TABLE = array(); /* abstract functions */ @@ -97,4 +99,4 @@ * vim600: sw=4 ts=4 fdm=syntax syntax=php et * vim<600: sw=4 ts=4 */ - +?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format/Manpage.php?r1=1.7&r2=1.8&diff_format=u Index: phd/phpdotnet/phd/Format/Manpage.php diff -u phd/phpdotnet/phd/Format/Manpage.php:1.7 phd/phpdotnet/phd/Format/Manpage.php:1.8 --- phd/phpdotnet/phd/Format/Manpage.php:1.7 Thu May 28 07:32:10 2009 +++ phd/phpdotnet/phd/Format/Manpage.php Fri Jun 19 21:48:53 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -class ManpagePhDFormat extends PhDFormat { +class Format_Manpage extends Format +{ protected $elementmap = array( /* {{{ */ 'acronym' => 'format_suppressed_tags', 'abbrev' => 'format_suppressed_tags', @@ -343,8 +345,8 @@ public function format_methodparam($open, $name, $attrs, $props) { if ($open) { - $opt = isset($attrs[PhDReader::XMLNS_DOCBOOK]["choice"]) && - $attrs[PhDReader::XMLNS_DOCBOOK]["choice"] == "opt"; + $opt = isset($attrs[Reader::XMLNS_DOCBOOK]["choice"]) && + $attrs[Reader::XMLNS_DOCBOOK]["choice"] == "opt"; $this->cchunk["methodsynopsis"]["params"][] = array( "optional" => $opt, "type" => "", @@ -427,14 +429,14 @@ public function format_xref($open, $name, $attrs, $props) { if ($props['empty']) - return "\n\"" . PhDHelper::getDescription($attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]) . "\""; + return "\n\"" . Helper::getDescription($attrs[Reader::XMLNS_DOCBOOK]["linkend"]) . "\""; return ""; } public function format_verbatim($open, $name, $attrs, $props) { if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[PhDReader::XMLNS_DOCBOOK]["role"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { $this->role = false; } @@ -449,8 +451,8 @@ } public function format_refsect($open, $name, $attrs, $props) { - if ($open && isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { - $this->cchunk["role"] = $attrs[PhDReader::XMLNS_DOCBOOK]["role"]; + if ($open && isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $this->cchunk["role"] = $attrs[Reader::XMLNS_DOCBOOK]["role"]; if ($this->cchunk["role"] == "description") { $this->cchunk["appendlater"] = true; } @@ -467,7 +469,7 @@ public function format_tgroup($open, $name, $attrs, $props) { if ($open) { - $nbCols = $attrs[PhDReader::XMLNS_DOCBOOK]["cols"]; + $nbCols = $attrs[Reader::XMLNS_DOCBOOK]["cols"]; $ret = "\n.TS\nbox, tab (|);\n"; for ($i = 0; $i < $nbCols; $i++) $ret .= "c | "; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format/PDF.php?r1=1.10&r2=1.11&diff_format=u Index: phd/phpdotnet/phd/Format/PDF.php diff -u phd/phpdotnet/phd/Format/PDF.php:1.10 phd/phpdotnet/phd/Format/PDF.php:1.11 --- phd/phpdotnet/phd/Format/PDF.php:1.10 Mon Apr 20 11:07:54 2009 +++ phd/phpdotnet/phd/Format/PDF.php Fri Jun 19 21:48:53 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -class PDFPhDFormat extends PhDFormat { +class Format_PDF extends Format +{ protected $elementmap = array( /* {{{ */ 'abstract' => 'format_suppressed_tags', 'abbrev' => 'format_suppressed_tags', @@ -552,16 +554,16 @@ public function format_link($open, $name, $attrs, $props) { if ($open && ! $props["empty"]) { $this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0, 0, 1)); // blue - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["linkend"])) { - $this->cchunk["linkend"] = $attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]; - } elseif(isset($attrs[PhDReader::XMLNS_XLINK]["href"])) { - $this->cchunk["href"] = $attrs[PhDReader::XMLNS_XLINK]["href"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["linkend"])) { + $this->cchunk["linkend"] = $attrs[Reader::XMLNS_DOCBOOK]["linkend"]; + } elseif(isset($attrs[Reader::XMLNS_XLINK]["href"])) { + $this->cchunk["href"] = $attrs[Reader::XMLNS_XLINK]["href"]; } - } elseif ($open && $name == "xref" && isset($attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]) - && $linkend = $attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]) { + } elseif ($open && $name == "xref" && isset($attrs[Reader::XMLNS_DOCBOOK]["linkend"]) + && $linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"]) { $this->cchunk["linkend"] = $linkend; $this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0, 0, 1)); // blue - $this->format_link_text(PhDHelper::getDescription($linkend), $name); + $this->format_link_text(Helper::getDescription($linkend), $name); $this->pdfDoc->revertFont(); $this->cchunk["linkend"] = ""; } elseif (!$open) { @@ -726,13 +728,13 @@ public function format_colspec($open, $name, $attrs) { if ($open) { - PhDFormat::colspec($attrs[PhDReader::XMLNS_DOCBOOK]); + Format::colspec($attrs[Reader::XMLNS_DOCBOOK]); } return ""; } public function format_thead($open, $name, $attrs) { if ($open) { - $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); $this->pdfDoc->setFont(PdfWriter::FONT_BOLD); } else { $this->pdfDoc->revertFont(); @@ -741,15 +743,15 @@ } public function format_tbody($open, $name, $attrs) { if ($open) { - $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); } return ""; } public function format_row($open, $name, $attrs) { if ($open) { - PhDFormat::initRow(); - $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); - $colCount = PhDFormat::getColCount(); + Format::initRow(); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); + $colCount = Format::getColCount(); $this->pdfDoc->add(PdfWriter::TABLE_ROW, array($colCount, $valign)); } else { $this->pdfDoc->add(PdfWriter::TABLE_END_ROW); @@ -763,9 +765,9 @@ $this->pdfDoc->add(PdfWriter::TABLE_END_ENTRY); } if ($open) { - $dbattrs = PhDFormat::getColspec($attrs[PhDReader::XMLNS_DOCBOOK]); + $dbattrs = Format::getColspec($attrs[Reader::XMLNS_DOCBOOK]); $align = (isset($dbattrs["align"]) ? $dbattrs["align"] : $align); - $colspan = PhDFormat::colspan($attrs[PhDReader::XMLNS_DOCBOOK]); + $colspan = Format::colspan($attrs[Reader::XMLNS_DOCBOOK]); $this->pdfDoc->add(PdfWriter::TABLE_ENTRY, array($colspan, 1, $align)); } else { $this->pdfDoc->add(PdfWriter::TABLE_END_ENTRY); @@ -780,11 +782,11 @@ return; } if ($open) { - $dbattrs = PhDFormat::getColspec($attrs[PhDReader::XMLNS_DOCBOOK]); + $dbattrs = Format::getColspec($attrs[Reader::XMLNS_DOCBOOK]); $align = (isset($dbattrs["align"]) ? $dbattrs["align"] : $align); $retval = ""; if (isset($dbattrs["colname"])) { - for($i=PhDFormat::getEntryOffset($dbattrs); $i>0; --$i) { + for($i=Format::getEntryOffset($dbattrs); $i>0; --$i) { $this->pdfDoc->add(PdfWriter::TABLE_ENTRY, array(1, 1, $align)); $this->pdfDoc->add(PdfWriter::TABLE_END_ENTRY); } @@ -797,10 +799,10 @@ if (isset($props["colspan"])) { $colspan = $props["colspan"]; } else { - $colspan = PhDFormat::colspan($dbattrs); + $colspan = Format::colspan($dbattrs); } - $rowspan = PhDFormat::rowspan($dbattrs); + $rowspan = Format::rowspan($dbattrs); $this->pdfDoc->add(PdfWriter::TABLE_ENTRY, array($colspan, $rowspan, $align)); } else { $this->pdfDoc->add(PdfWriter::TABLE_END_ENTRY); @@ -810,9 +812,9 @@ public function format_tgroup($open, $name, $attrs, $props) { if ($open) { - PhDFormat::tgroup($attrs[PhDReader::XMLNS_DOCBOOK]); - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["cols"])) - $this->pdfDoc->add(PdfWriter::TABLE, $attrs[PhDReader::XMLNS_DOCBOOK]["cols"]); + Format::tgroup($attrs[Reader::XMLNS_DOCBOOK]); + if (isset($attrs[Reader::XMLNS_DOCBOOK]["cols"])) + $this->pdfDoc->add(PdfWriter::TABLE, $attrs[Reader::XMLNS_DOCBOOK]["cols"]); } else { } return ""; @@ -862,7 +864,7 @@ public function format_methodparam_parameter($open, $name, $attrs, $props) { if ($props["empty"]) return ''; if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $this->pdfDoc->setFont(PdfWriter::FONT_VERBATIM, 10); $this->pdfDoc->appendText(" &$"); return ''; @@ -878,7 +880,7 @@ public function format_parameter($open, $name, $attrs, $props) { if ($props["empty"]) return ''; if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $this->pdfDoc->setFont(PdfWriter::FONT_VERBATIM_ITALIC, 10); $this->pdfDoc->appendText(" &"); return ''; @@ -896,7 +898,7 @@ if ($this->params["count"] == 0) { $content .= " ("; } - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["choice"]) && $attrs[PhDReader::XMLNS_DOCBOOK]["choice"] == "opt") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["choice"]) && $attrs[Reader::XMLNS_DOCBOOK]["choice"] == "opt") { $this->params["opt"]++; $content .= " ["; } else if($this->params["opt"]) { @@ -922,7 +924,7 @@ public function format_classsynopsisinfo($open, $name, $attrs, $props) { $this->cchunk["classsynopsisinfo"] = $this->dchunk["classsynopsisinfo"]; if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"]) && $attrs[PhDReader::XMLNS_DOCBOOK]["role"] == "comment") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") { $this->format_para($open, $name, $attrs, $props); $this->pdfDoc->appendText("/* "); return ''; @@ -930,7 +932,7 @@ return $this->format_para($open, $name, $attrs, $props); } - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"]) && $attrs[PhDReader::XMLNS_DOCBOOK]["role"] == "comment") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") { $this->pdfDoc->appendText(" */"); return $this->format_para($open, $name, $attrs, $props); } @@ -993,7 +995,7 @@ // Footnotes & Callouts {{{ public function format_footnoteref($open, $name, $attrs, $props) { if ($open) { - $linkend = $attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]; + $linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"]; $found = false; foreach($this->cchunk["footnote"] as $k => $note) { if ($note["id"] === $linkend) { @@ -1009,7 +1011,7 @@ public function format_footnote($open, $name, $attrs, $props) { if ($open) { $count = count($this->cchunk["footnote"]); - $noteid = isset($attrs[PhDReader::XMLNS_XML]["id"]) ? $attrs[PhDReader::XMLNS_XML]["id"] : $count + 1; + $noteid = isset($attrs[Reader::XMLNS_XML]["id"]) ? $attrs[Reader::XMLNS_XML]["id"] : $count + 1; $note = array("id" => $noteid, "str" => ""); $this->cchunk["footnote"][$count] = $note; if ($this->cchunk["table"]) { @@ -1030,10 +1032,10 @@ } public function format_co($open, $name, $attrs, $props) { - if (($open || $props["empty"]) && isset($attrs[PhDReader::XMLNS_XML]["id"]) && $id = $attrs[PhDReader::XMLNS_XML]["id"]) { + if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"]) && $id = $attrs[Reader::XMLNS_XML]["id"]) { $co = ++$this->cchunk["co"]; $this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0,0,1)); - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["linkends"]) && $linkends = $attrs[PhDReader::XMLNS_DOCBOOK]["linkends"]) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["linkends"]) && $linkends = $attrs[Reader::XMLNS_DOCBOOK]["linkends"]) { $linkAreas = $this->pdfDoc->add(PdfWriter::LINK_ANNOTATION, "[{$co}]"); if (!isset($this->cchunk["links-to-resolve"][$linkends])) $this->cchunk["links-to-resolve"][$linkends] = array(); @@ -1061,7 +1063,7 @@ if ($open) { $co = ++$this->cchunk["co"]; $this->pdfDoc->setFont(PdfWriter::FONT_BOLD, 12, array(0,0,1)); - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["arearefs"]) && $ref = $attrs[PhDReader::XMLNS_DOCBOOK]["arearefs"]) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["arearefs"]) && $ref = $attrs[Reader::XMLNS_DOCBOOK]["arearefs"]) { $linkAreas = $this->pdfDoc->add(PdfWriter::LINK_ANNOTATION, "[{$co}]"); if (!isset($this->cchunk["links-to-resolve"][$ref])) $this->cchunk["links-to-resolve"][$ref] = array(); @@ -1129,8 +1131,8 @@ public function format_imagedata($open, $name, $attrs, $props) { if ($props["empty"] && isset($this->cchunk["xml-base"]) && ($base = $this->cchunk["xml-base"]) && - isset($attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]) && ($fileref = $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"])) { - $imagePath = PhDConfig::xml_root() . DIRECTORY_SEPARATOR . $base . $fileref; + 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); http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format/XHTML.php?r1=1.98&r2=1.99&diff_format=u Index: phd/phpdotnet/phd/Format/XHTML.php diff -u phd/phpdotnet/phd/Format/XHTML.php:1.98 phd/phpdotnet/phd/Format/XHTML.php:1.99 --- phd/phpdotnet/phd/Format/XHTML.php:1.98 Tue May 5 19:09:03 2009 +++ phd/phpdotnet/phd/Format/XHTML.php Fri Jun 19 21:48:53 2009 @@ -1,7 +1,9 @@ <?php -/* $Id: XHTML.php,v 1.98 2009/05/05 19:09:03 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: XHTML.php,v 1.99 2009/06/19 21:48:53 cweiske Exp $ */ -class XHTMLPhDFormat extends PhDFormat { +class Format_XHTML extends Format +{ protected $elementmap = array( /* {{{ */ 'abstract' => 'format_div', /* Docbook-xsl prints "abstract"... */ 'abbrev' => 'abbr', @@ -418,8 +420,8 @@ public function transformFromMap($open, $tag, $name, $attrs, $props) { if ($open) { $idstr = ""; - if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDReader::XMLNS_XML]["id"]; + if (isset($attrs[Reader::XMLNS_XML]["id"])) { + $id = $attrs[Reader::XMLNS_XML]["id"]; $idstr = ' id="' .$id. '" name="' .$id. '"'; } return '<' .$tag. ' class="' .$name. '"' . ($props["empty"] ? '/' : "") . $idstr. '>'; @@ -502,8 +504,8 @@ public function format_literal($open, $name, $attrs) { if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[PhDReader::XMLNS_DOCBOOK]["role"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { $this->role = false; } @@ -558,9 +560,9 @@ break; case "othername": - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { /* We maight want to add support for other roles */ - switch($attrs[PhDReader::XMLNS_DOCBOOK]["role"]) { + switch($attrs[Reader::XMLNS_DOCBOOK]["role"]) { case "nickname": $class = " nickname"; break; @@ -577,7 +579,7 @@ public function format_container_chunk($open, $name, $attrs) { $this->cchunk = $this->dchunk; if ($open) { - return '<div id="' .$attrs[PhDReader::XMLNS_XML]["id"]. '" class="' .$name. '">'; + return '<div id="' .$attrs[Reader::XMLNS_XML]["id"]. '" class="' .$name. '">'; } return "</div>"; } @@ -590,13 +592,13 @@ public function format_chunk($open, $name, $attrs) { if ($open) { $this->cchunk = $this->dchunk; - if(isset($attrs[PhDReader::XMLNS_XML]["id"])) { + if(isset($attrs[Reader::XMLNS_XML]["id"])) { $class = $name; if ($name === "refentry") { //$class .= " -rel-posting"; } - $this->cchunk["chunk_id"] = $attrs[PhDReader::XMLNS_XML]["id"]; - return '<div id="' .$attrs[PhDReader::XMLNS_XML]["id"]. '" class="' .$class. '">'; + $this->cchunk["chunk_id"] = $attrs[Reader::XMLNS_XML]["id"]; + return '<div id="' .$attrs[Reader::XMLNS_XML]["id"]. '" class="' .$class. '">'; } return '<div class="' .$name. '">'; } @@ -638,10 +640,10 @@ } public function format_refsect($open, $name, $attrs) { if ($open) { - if(!isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { - $attrs[PhDReader::XMLNS_DOCBOOK]["role"] = "unknown"; + if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown"; } - $this->role = $role = $attrs[PhDReader::XMLNS_DOCBOOK]["role"]; + $this->role = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; return '<a name="' .$this->cchunk["chunk_id"]. '.' .$role. '"></a><div class="' .$name.' ' .$role. '">'; } $this->role = null; @@ -672,13 +674,13 @@ public function format_classsynopsisinfo($open, $name, $attrs) { $this->cchunk["classsynopsisinfo"] = $this->dchunk["classsynopsisinfo"]; if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"]) && $attrs[PhDReader::XMLNS_DOCBOOK]["role"] == "comment") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") { return '<div class="'.$name.' classsynopsisinfo_comment">/* '; } return '<div class="'.$name.'">'; } - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"]) && $attrs[PhDReader::XMLNS_DOCBOOK]["role"] == "comment") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") { return ' */</div>'; } $this->cchunk["classsynopsis"]["close"] = true; @@ -758,7 +760,7 @@ } public function format_methodparam_parameter($open, $name, $attrs) { if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { return ' <tt class="parameter reference">&amp;$'; } return ' <tt class="parameter">$'; @@ -773,7 +775,7 @@ } public function format_parameter($open, $name, $attrs) { if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { return '<i><tt class="parameter reference">&amp;'; } return '<i><tt class="parameter">'; @@ -790,7 +792,7 @@ if ($this->params["count"] == 0) { $content .= " ("; } - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["choice"]) && $attrs[PhDReader::XMLNS_DOCBOOK]["choice"] == "opt") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["choice"]) && $attrs[Reader::XMLNS_DOCBOOK]["choice"] == "opt") { $this->params["opt"]++; $content .= "["; } else if($this->params["opt"]) { @@ -831,7 +833,7 @@ public function format_footnoteref($open, $name, $attrs, $props) { if ($open) { - $linkend = $attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]; + $linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"]; $found = false; foreach($this->cchunk["footnote"] as $k => $note) { if ($note["id"] === $linkend) { @@ -845,7 +847,7 @@ public function format_footnote($open, $name, $attrs, $props) { if ($open) { $count = count($this->cchunk["footnote"]); - $noteid = isset($attrs[PhDReader::XMLNS_XML]["id"]) ? $attrs[PhDReader::XMLNS_XML]["id"] : $count + 1; + $noteid = isset($attrs[Reader::XMLNS_XML]["id"]) ? $attrs[Reader::XMLNS_XML]["id"] : $count + 1; $note = array("id" => $noteid, "str" => ""); $this->cchunk["footnote"][$count] = $note; if ($this->cchunk["table"]) { @@ -886,9 +888,9 @@ /* }}} */ public function format_co($open, $name, $attrs, $props) { - if (($open || $props["empty"]) && isset($attrs[PhDReader::XMLNS_XML]["id"])) { + if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"])) { $co = ++$this->cchunk["co"]; - return '<a name="'.$attrs[PhDReader::XMLNS_XML]["id"].'" id="'.$attrs[PhDReader::XMLNS_XML]["id"].'">' .str_repeat("*", $co) .'</a>'; + return '<a name="'.$attrs[Reader::XMLNS_XML]["id"].'" id="'.$attrs[Reader::XMLNS_XML]["id"].'">' .str_repeat("*", $co) .'</a>'; } /* Suppress closing tag if any */ return ""; @@ -902,7 +904,7 @@ } public function format_callout($open, $name, $attrs) { if ($open) { - return '<tr><td><a href="#'.$attrs[PhDReader::XMLNS_DOCBOOK]["arearefs"].'">' .str_repeat("*", ++$this->cchunk["callouts"]). '</a></td><td>'; + return '<tr><td><a href="#'.$attrs[Reader::XMLNS_DOCBOOK]["arearefs"].'">' .str_repeat("*", ++$this->cchunk["callouts"]). '</a></td><td>'; } return "</td></tr>\n"; } @@ -1001,8 +1003,8 @@ public function format_variablelist($open, $name, $attrs) { if ($open) { $idstr = ''; - if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { - $idstr = ' id="'. $attrs[PhDReader::XMLNS_XML]['id']. '"'; + if (isset($attrs[Reader::XMLNS_XML]["id"])) { + $idstr = ' id="'. $attrs[Reader::XMLNS_XML]['id']. '"'; } return $this->escapePara() . "<dl" . $idstr . ">\n"; } @@ -1010,7 +1012,7 @@ } public function format_varlistentry($open, $name, $attrs) { if ($open) { - return isset($attrs[PhDReader::XMLNS_XML]["id"]) ? '<dt id="'.$attrs[PhDReader::XMLNS_XML]["id"]. '" class="varlistentry">' : "<dt class=\"varlistentry\">\n"; + return isset($attrs[Reader::XMLNS_XML]["id"]) ? '<dt id="'.$attrs[Reader::XMLNS_XML]["id"]. '" class="varlistentry">' : "<dt class=\"varlistentry\">\n"; } // Listitems close the the dt themselfs @@ -1043,7 +1045,7 @@ } public function format_systemitem($open, $name, $attrs) { if ($open) { - $val = isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"]) ? $attrs[PhDReader::XMLNS_DOCBOOK]["role"] : null; + $val = isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) ? $attrs[Reader::XMLNS_DOCBOOK]["role"] : null; switch($val) { case "directive": /* FIXME: Different roles should probably be handled differently */ @@ -1067,8 +1069,8 @@ } public function format_programlisting($open, $name, $attrs) { if ($open) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[PhDReader::XMLNS_DOCBOOK]["role"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { $this->role = false; } @@ -1099,8 +1101,8 @@ public function format_admonition($open, $name, $attrs, $props) { if ($open) { $idstr = ''; - if (isset($attrs[PhDReader::XMLNS_XML]['id'])) { - $idstr = 'id="'. $attrs[PhDReader::XMLNS_XML]['id']. '" '; + if (isset($attrs[Reader::XMLNS_XML]['id'])) { + $idstr = 'id="'. $attrs[Reader::XMLNS_XML]['id']. '" '; } return '<div '. $idstr. 'class="'. $name. '">' . $this->admonition_title($name, $props['lang']); @@ -1236,8 +1238,8 @@ { if ($open) { $numeration = "1"; - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["numeration"])) { - switch($attrs[PhDReader::XMLNS_DOCBOOK]["numeration"]) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["numeration"])) { + switch($attrs[Reader::XMLNS_DOCBOOK]["numeration"]) { case "upperalpha": $numeration = "A"; break; @@ -1265,7 +1267,7 @@ $this->cchunk["table"] = false; $str = ""; if ($this->cchunk["tablefootnotes"]) { - $opts = array(PhDReader::XMLNS_DOCBOOK => array()); + $opts = array(Reader::XMLNS_DOCBOOK => array()); $str = $this->format_tbody(true, "footnote", $opts, $props); $str .= $this->format_row(true, "footnote", $opts, $props); @@ -1288,7 +1290,7 @@ } public function format_tgroup($open, $name, $attrs) { if ($open) { - PhDFormat::tgroup($attrs[PhDReader::XMLNS_DOCBOOK]); + Format::tgroup($attrs[Reader::XMLNS_DOCBOOK]); return ''; } return ''; @@ -1335,7 +1337,7 @@ } public function format_colspec($open, $name, $attrs) { if ($open) { - $str = self::parse_table_entry_attributes(PhDFormat::colspec($attrs[PhDReader::XMLNS_DOCBOOK])); + $str = self::parse_table_entry_attributes(Format::colspec($attrs[Reader::XMLNS_DOCBOOK])); return '<col '.$str. ' />'; } @@ -1343,14 +1345,14 @@ } public function format_th($open, $name, $attrs) { if ($open) { - $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); return '<' .$name. ' valign="' .$valign. '">'; } return "</$name>\n"; } public function format_tbody($open, $name, $attrs) { if ($open) { - $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); return '<tbody valign="' .$valign. '" class="' .$name. '">'; } return "</tbody>"; @@ -1358,11 +1360,11 @@ public function format_row($open, $name, $attrs) { if ($open) { $idstr = ''; - if (isset($attrs[PhDReader::XMLNS_XML]['id'])) { - $idstr = ' id="'. $attrs[PhDReader::XMLNS_XML]['id']. '"'; + if (isset($attrs[Reader::XMLNS_XML]['id'])) { + $idstr = ' id="'. $attrs[Reader::XMLNS_XML]['id']. '"'; } - PhDFormat::initRow(); - $valign = PhDFormat::valign($attrs[PhDReader::XMLNS_DOCBOOK]); + Format::initRow(); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); return '<tr'.$idstr.' valign="' .$valign. '">'; } return "</tr>\n"; @@ -1372,7 +1374,7 @@ return '<th class="empty">&nbsp;</th>'; } if ($open) { - $colspan = PhDFormat::colspan($attrs[PhDReader::XMLNS_DOCBOOK]); + $colspan = Format::colspan($attrs[Reader::XMLNS_DOCBOOK]); if ($colspan == 1) { return '<th>'; } else { @@ -1386,11 +1388,11 @@ return '<td class="empty">&nbsp;</td>'; } if ($open) { - $dbattrs = PhDFormat::getColspec($attrs[PhDReader::XMLNS_DOCBOOK]); + $dbattrs = Format::getColspec($attrs[Reader::XMLNS_DOCBOOK]); $retval = ""; if (isset($dbattrs["colname"])) { - for($i=PhDFormat::getEntryOffset($dbattrs); $i>0; --$i) { + for($i=Format::getEntryOffset($dbattrs); $i>0; --$i) { $retval .= '<td class="empty">&nbsp;</td>'; } } @@ -1402,10 +1404,10 @@ if (isset($props["colspan"])) { $colspan = $props["colspan"]; } else { - $colspan = PhDFormat::colspan($dbattrs); + $colspan = Format::colspan($dbattrs); } - $rowspan = PhDFormat::rowspan($dbattrs); + $rowspan = Format::rowspan($dbattrs); $moreattrs = self::parse_table_entry_attributes($dbattrs); $sColspan = $colspan == 1 ? '' : ' colspan="' .((int)$colspan) . '"'; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Format/Abstract/XHTML.php?r1=1.1&r2=1.2&diff_format=u Index: phd/phpdotnet/phd/Format/Abstract/XHTML.php diff -u phd/phpdotnet/phd/Format/Abstract/XHTML.php:1.1 phd/phpdotnet/phd/Format/Abstract/XHTML.php:1.2 --- phd/phpdotnet/phd/Format/Abstract/XHTML.php:1.1 Sat Jun 13 12:54:23 2009 +++ phd/phpdotnet/phd/Format/Abstract/XHTML.php Fri Jun 19 21:48:53 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -abstract class AbstractXHTMLFormat extends PhDEnterpriseFormat { +abstract class Format_Abstract_XHTML extends Format +{ private $formatname = "XHTML"; protected $title; @@ -55,8 +57,8 @@ public function transformFromMap($open, $tag, $name, $attrs, $props) { if ($open) { $idstr = ""; - if (isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if (isset($attrs[Reader::XMLNS_XML]["id"])) { + $id = $attrs[Reader::XMLNS_XML]["id"]; $idstr = ' id="' .$id. '" name="' .$id. '"'; } return '<' .$tag. ' class="' .$name. '"' . $idstr . ($props["empty"] ? '/' : "") . '>'; @@ -68,18 +70,18 @@ if ($this->appendToBuffer) { $this->buffer .= $data; return; - } elseif ($this->flags & PhDRender::CLOSE) { + } elseif ($this->flags & Render::CLOSE) { $fp = array_pop($this->fp); fwrite($fp, $data); $this->writeChunk($this->CURRENT_CHUNK, $fp); fclose($fp); - $this->flags ^= PhDRender::CLOSE; - } elseif ($this->flags & PhDRender::OPEN) { + $this->flags ^= Render::CLOSE; + } elseif ($this->flags & Render::OPEN) { $this->fp[] = $fp = fopen("php://temp/maxmemory", "r+"); fwrite($fp, $data); - $this->flags ^= PhDRender::OPEN; + $this->flags ^= Render::OPEN; } else { $fp = end($this->fp); fwrite($fp, $data); @@ -101,7 +103,7 @@ } } - public function createLink($for, &$desc = null, $type = PhDEnterpriseFormat::SDESC) { + public function createLink($for, &$desc = null, $type = Format::SDESC) { $retval = null; if (isset($this->indexes[$for])) { $rsl = $this->indexes[$for]; @@ -176,19 +178,19 @@ public function update($event, $val = null) { switch($event) { - case PhDRender::CHUNK: + case Render::CHUNK: $this->flags = $val; break; - case PhDRender::STANDALONE: + case Render::STANDALONE: if ($val) { $this->registerElementMap(static::getDefaultElementMap()); $this->registerTextMap(static::getDefaultTextMap()); } break; - case PhDRender::INIT: - $this->outputdir = $tmp = PhDConfig::output_dir() . strtolower($this->getFormatName()) . '/'; + case Render::INIT: + $this->outputdir = $tmp = Config::output_dir() . strtolower($this->getFormatName()) . '/'; if (file_exists($tmp)) { if (!is_dir($tmp)) { v("Output directory is a file?", E_USER_ERROR); @@ -199,7 +201,7 @@ } } break; - case PhDRender::VERBOSE: + case Render::VERBOSE: v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING); break; } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Package/Default/Factory.php?r1=1.1&r2=1.2&diff_format=u Index: phd/phpdotnet/phd/Package/Default/Factory.php diff -u phd/phpdotnet/phd/Package/Default/Factory.php:1.1 phd/phpdotnet/phd/Package/Default/Factory.php:1.2 --- phd/phpdotnet/phd/Package/Default/Factory.php:1.1 Sat Jun 13 12:56:59 2009 +++ phd/phpdotnet/phd/Package/Default/Factory.php Fri Jun 19 21:48:54 2009 @@ -1,12 +1,10 @@ <?php +namespace phpdotnet\phd; -require $ROOT . "/packages/Default/xhtml.php"; -//require $ROOT . "/packages/Default/bigxhtml.php"; -//require $ROOT . "/packages/Default/php.php"; - -class DefaultFactory extends PhDFormatFactory { +class Package_Default_Factory extends Format_Factory +{ public function createXhtmlFormat() { - return new DefaultXHTMLFormat(); + return new Format_Default_XHTML(); } /* public function createBigXhtmlFormat() { http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Package/Default/XHTML.php?r1=1.1&r2=1.2&diff_format=u Index: phd/phpdotnet/phd/Package/Default/XHTML.php diff -u phd/phpdotnet/phd/Package/Default/XHTML.php:1.1 phd/phpdotnet/phd/Package/Default/XHTML.php:1.2 --- phd/phpdotnet/phd/Package/Default/XHTML.php:1.1 Sat Jun 13 12:56:59 2009 +++ phd/phpdotnet/phd/Package/Default/XHTML.php Fri Jun 19 21:48:54 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -class DefaultXHTMLFormat extends AbstractXHTMLFormat { +class Format_Default_XHTML extends Format_Abstract_XHTML +{ private $formatname = "XHTML"; private $myelementmap = array( /* {{{ */ 'abstract' => 'div', /* Docbook-xsl prints "abstract"... */ @@ -383,12 +385,12 @@ $parent = array("href" => $this->getFilename($parentId) . '.' .$this->ext, "desc" => $this->getShortDescription($parentId)); } - if ($prevId = PhDEnterpriseFormat::getPrevious($id)) { - $prev = array("href" => PhDEnterpriseFormat::getFilename($prevId) . '.' .$this->ext, + if ($prevId = Format::getPrevious($id)) { + $prev = array("href" => Format::getFilename($prevId) . '.' .$this->ext, "desc" => $this->getShortDescription($prevId)); } - if ($nextId = PhDEnterpriseFormat::getNext($id)) { - $next = array("href" => PhDEnterpriseFormat::getFilename($nextId) . '.' .$this->ext, + if ($nextId = Format::getNext($id)) { + $next = array("href" => Format::getFilename($nextId) . '.' .$this->ext, "desc" => $this->getShortDescription($nextId)); } $navBar = $this->createNavBar($id); @@ -498,11 +500,11 @@ if ($open) { $link = $class = $content = ""; - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["linkend"])) { - $link = $this->createLink($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["linkend"]); + if (isset($attrs[Reader::XMLNS_DOCBOOK]["linkend"])) { + $link = $this->createLink($attrs[Reader::XMLNS_DOCBOOK]["linkend"]); } - elseif (isset($attrs[PhDEnterpriseReader::XMLNS_XLINK]["href"])) { - $link = $attrs[PhDEnterpriseReader::XMLNS_XLINK]["href"]; + elseif (isset($attrs[Reader::XMLNS_XLINK]["href"])) { + $link = $attrs[Reader::XMLNS_XLINK]["href"]; $class = " external"; $content = "&raquo; "; } @@ -518,7 +520,7 @@ public function format_xref($open, $name, $attrs, $props) { if ($open) { $desc = ""; - $link = $this->createLink($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["linkend"], $desc); + $link = $this->createLink($attrs[Reader::XMLNS_DOCBOOK]["linkend"], $desc); $ret = '<a href="' .$link. '" class="' .$name. '">' .$desc; @@ -532,8 +534,8 @@ public function format_literal($open, $name, $attrs) { if ($open) { - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { $this->role = false; } @@ -589,9 +591,9 @@ break; case "othername": - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { /* We might want to add support for other roles */ - switch($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]) { + switch($attrs[Reader::XMLNS_DOCBOOK]["role"]) { case "nickname": $class = " nickname"; break; @@ -608,21 +610,21 @@ public function format_container_chunk_top($open, $name, $attrs, $props) { $this->cchunk = $this->dchunk; $this->cchunk["name"] = $name; - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader::XMLNS_XML]["id"])) { + $id = $attrs[Reader::XMLNS_XML]["id"]; } else { $id = uniqid("phd"); } if ($open) { $this->CURRENT_CHUNK = $id; - $this->notify(PhDRender::CHUNK, PhDRender::OPEN); + $this->notify(Render::CHUNK, Render::OPEN); return '<div id="' .$id. '" class="' .$name. '">'; } $this->CURRENT_CHUNK = $id; - $this->notify(PhDRender::CHUNK, PhDRender::CLOSE); + $this->notify(Render::CHUNK, Render::CLOSE); $toc = ""; if (!in_array($id, $this->TOC_WRITTEN)) { $toc = $this->createTOC($id, $props["lang"]); @@ -646,8 +648,8 @@ public function format_container_chunk_below($open, $name, $attrs, $props) { $this->cchunk = $this->dchunk; $this->cchunk["name"] = $name; - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader::XMLNS_XML]["id"])) { + $id = $attrs[Reader::XMLNS_XML]["id"]; } else { /* FIXME: This will obviously not exist in the db.. */ $id = uniqid("phd"); @@ -655,9 +657,9 @@ if ($open) { $this->CURRENT_CHUNK = $id; - $this->notify(PhDRender::CHUNK, PhDRender::OPEN); + $this->notify(Render::CHUNK, Render::OPEN); - return '<div id="' .$attrs[PhDEnterpriseReader::XMLNS_XML]["id"]. '" class="' .$name. '">'; + return '<div id="' .$attrs[Reader::XMLNS_XML]["id"]. '" class="' .$name. '">'; } $toc = '<ol>'; @@ -668,7 +670,7 @@ $toc .= "</ol>\n"; $this->CURRENT_CHUNK = $id; - $this->notify(PhDRender::CHUNK, PhDRender::CLOSE); + $this->notify(Render::CHUNK, Render::CLOSE); return $toc . '</div>'; } public function format_exception_chunk($open, $name, $attrs, $props) { @@ -693,8 +695,8 @@ public function format_chunk($open, $name, $attrs, $props) { if ($open) { $this->cchunk = $this->dchunk; - if(isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDEnterpriseReader::XMLNS_XML]["id"]; + if(isset($attrs[Reader::XMLNS_XML]["id"])) { + $id = $attrs[Reader::XMLNS_XML]["id"]; } else { $id = uniqid("phd"); } @@ -707,10 +709,10 @@ $this->CURRENT_CHUNK = $id; $this->CURRENT_LANG = $props["lang"]; - $this->notify(PhDRender::CHUNK, PhDRender::OPEN); + $this->notify(Render::CHUNK, Render::OPEN); return '<div id="' .$id. '" class="' .$class. '">'; } - $this->notify(PhDRender::CHUNK, PhDRender::CLOSE); + $this->notify(Render::CHUNK, Render::CLOSE); $str = ""; foreach ($this->cchunk["footnote"] as $k => $note) { @@ -741,10 +743,10 @@ } public function format_refsect($open, $name, $attrs) { if ($open) { - if(!isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"])) { - $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"] = "unknown"; + if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown"; } - $this->role = $role = $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]; + $this->role = $role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; return '<div class="' .$name.' ' .$role. '">'; } $this->role = null; @@ -775,13 +777,13 @@ public function format_classsynopsisinfo($open, $name, $attrs) { $this->cchunk["classsynopsisinfo"] = $this->dchunk["classsynopsisinfo"]; if ($open) { - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]) && $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"] == "comment") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") { return '<div class="'.$name.' classsynopsisinfo_comment">/* '; } return '<div class="'.$name.'">'; } - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]) && $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"] == "comment") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") { return ' */</div>'; } $this->cchunk["classsynopsis"]["close"] = true; @@ -836,7 +838,7 @@ if ($props["empty"]) return; if ($open) { - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { return ' <tt class="parameter reference">&$'; } return ' <tt class="parameter">$'; @@ -853,7 +855,7 @@ if ($props["empty"]) return; if ($open) { - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"])) { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { return '<i><tt class="parameter reference">&'; } return '<i><tt class="parameter">'; @@ -870,7 +872,7 @@ if ($this->params["count"] == 0) { $content .= " ("; } - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["choice"]) && $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["choice"] == "opt") { + if (isset($attrs[Reader::XMLNS_DOCBOOK]["choice"]) && $attrs[Reader::XMLNS_DOCBOOK]["choice"] == "opt") { $this->params["opt"]++; $content .= "["; } else if($this->params["opt"]) { @@ -911,7 +913,7 @@ public function format_footnoteref($open, $name, $attrs, $props) { if ($open) { - $linkend = $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["linkend"]; + $linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"]; $found = false; foreach($this->cchunk["footnote"] as $k => $note) { if ($note["id"] === $linkend) { @@ -925,7 +927,7 @@ public function format_footnote($open, $name, $attrs, $props) { if ($open) { $count = count($this->cchunk["footnote"]); - $noteid = isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"]) ? $attrs[PhDEnterpriseReader::XMLNS_XML]["id"] : $count + 1; + $noteid = isset($attrs[Reader::XMLNS_XML]["id"]) ? $attrs[Reader::XMLNS_XML]["id"] : $count + 1; $note = array("id" => $noteid, "str" => ""); $this->cchunk["footnote"][$count] = $note; if ($this->cchunk["table"]) { @@ -966,9 +968,9 @@ /* }}} */ public function format_co($open, $name, $attrs, $props) { - if (($open || $props["empty"]) && isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"])) { + if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"])) { $co = ++$this->cchunk["co"]; - return '<a name="'.$attrs[PhDEnterpriseReader::XMLNS_XML]["id"].'" id="'.$attrs[PhDEnterpriseReader::XMLNS_XML]["id"].'">' .str_repeat("*", $co) .'</a>'; + return '<a name="'.$attrs[Reader::XMLNS_XML]["id"].'" id="'.$attrs[Reader::XMLNS_XML]["id"].'">' .str_repeat("*", $co) .'</a>'; } /* Suppress closing tag if any */ return ""; @@ -982,7 +984,7 @@ } public function format_callout($open, $name, $attrs) { if ($open) { - return '<tr><td><a href="#'.$attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["arearefs"].'">' .str_repeat("*", ++$this->cchunk["callouts"]). '</a></td><td>'; + return '<tr><td><a href="#'.$attrs[Reader::XMLNS_DOCBOOK]["arearefs"].'">' .str_repeat("*", ++$this->cchunk["callouts"]). '</a></td><td>'; } return "</td></tr>\n"; } @@ -1050,7 +1052,7 @@ } public function format_varlistentry($open, $name, $attrs) { if ($open) { - return isset($attrs[PhDEnterpriseReader::XMLNS_XML]["id"]) ? '<dt id="'.$attrs[PhDEnterpriseReader::XMLNS_XML]["id"]. '">' : "<dt>\n"; + return isset($attrs[Reader::XMLNS_XML]["id"]) ? '<dt id="'.$attrs[Reader::XMLNS_XML]["id"]. '">' : "<dt>\n"; } return "</dt>\n"; } @@ -1077,7 +1079,7 @@ } public function format_systemitem($open, $name, $attrs) { if ($open) { - $val = isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]) ? $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"] : null; + $val = isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) ? $attrs[Reader::XMLNS_DOCBOOK]["role"] : null; switch($val) { case "directive": /* FIXME: Different roles should probably be handled differently */ @@ -1095,8 +1097,8 @@ } public function format_programlisting($open, $name, $attrs) { if ($open) { - if (isset($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"])) { - $this->role = $attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["role"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + $this->role = $attrs[Reader::XMLNS_DOCBOOK]["role"]; } else { $this->role = false; } @@ -1195,9 +1197,9 @@ } public function format_imagedata($open, $name, $attrs) { if ($this->cchunk["mediaobject"]["alt"] !== false) { - return '<img src="' .$attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["fileref"]. '" alt="' .$this->cchunk["mediaobject"]["alt"]. '" />'; + return '<img src="' .$attrs[Reader::XMLNS_DOCBOOK]["fileref"]. '" alt="' .$this->cchunk["mediaobject"]["alt"]. '" />'; } - return '<img src="' .$attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]["fileref"]. '" />'; + return '<img src="' .$attrs[Reader::XMLNS_DOCBOOK]["fileref"]. '" />'; } public function format_table($open, $name, $attrs, $props) { @@ -1208,7 +1210,7 @@ $this->cchunk["table"] = false; $str = ""; if ($this->cchunk["tablefootnotes"]) { - $opts = array(PhDEnterpriseReader::XMLNS_DOCBOOK => array()); + $opts = array(Reader::XMLNS_DOCBOOK => array()); $str = $this->format_tbody(true, "footnote", $opts, $props); $str .= $this->format_row(true, "footnote", $opts, $props); @@ -1231,7 +1233,7 @@ } public function format_tgroup($open, $name, $attrs) { if ($open) { - PhDEnterpriseFormat::tgroup($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]); + Format::tgroup($attrs[Reader::XMLNS_DOCBOOK]); return "<colgroup>\n"; } return "</colgroup>\n"; @@ -1254,7 +1256,7 @@ } public function format_colspec($open, $name, $attrs) { if ($open) { - $str = self::parse_table_entry_attributes(PhDEnterpriseFormat::colspec($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK])); + $str = self::parse_table_entry_attributes(Format::colspec($attrs[Reader::XMLNS_DOCBOOK])); return '<col '.$str. ' />'; } @@ -1262,29 +1264,29 @@ } public function format_th($open, $name, $attrs) { if ($open) { - $valign = PhDEnterpriseFormat::valign($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); return '<' .$name. ' valign="' .$valign. '">'; } return "</$name>\n"; } public function format_tbody($open, $name, $attrs) { if ($open) { - $valign = PhDEnterpriseFormat::valign($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); return '<tbody valign="' .$valign. '" class="' .$name. '">'; } return "</tbody>"; } public function format_row($open, $name, $attrs) { if ($open) { - PhDEnterpriseFormat::initRow(); - $valign = PhDEnterpriseFormat::valign($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]); + Format::initRow(); + $valign = Format::valign($attrs[Reader::XMLNS_DOCBOOK]); return '<tr valign="' .$valign. '">'; } return "</tr>\n"; } public function format_th_entry($open, $name, $attrs) { if ($open) { - $colspan = PhDEnterpriseFormat::colspan($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]); + $colspan = Format::colspan($attrs[Reader::XMLNS_DOCBOOK]); return '<th colspan="' .((int)$colspan). '">'; } return '</th>'; @@ -1294,11 +1296,11 @@ return '<td class="empty">&nbsp;</td>'; } if ($open) { - $dbattrs = PhDEnterpriseFormat::getColspec($attrs[PhDEnterpriseReader::XMLNS_DOCBOOK]); + $dbattrs = Format::getColspec($attrs[Reader::XMLNS_DOCBOOK]); $retval = ""; if (isset($dbattrs["colname"])) { - for($i=PhDEnterpriseFormat::getEntryOffset($dbattrs); $i>0; --$i) { + for($i=Format::getEntryOffset($dbattrs); $i>0; --$i) { $retval .= '<td class="empty">&nbsp;</td>'; } } @@ -1310,10 +1312,10 @@ if (isset($props["colspan"])) { $colspan = $props["colspan"]; } else { - $colspan = PhDEnterpriseFormat::colspan($dbattrs); + $colspan = Format::colspan($dbattrs); } - $rowspan = PhDEnterpriseFormat::rowspan($dbattrs); + $rowspan = Format::rowspan($dbattrs); $moreattrs = self::parse_table_entry_attributes($dbattrs); return $retval. '<td colspan="' .((int)$colspan). '" rowspan="' .((int)$rowspan). '" ' .$moreattrs. '>'; } @@ -1326,13 +1328,13 @@ $doc->appendChild($node); $xp = new DOMXPath($doc); - $xp->registerNamespace("db", PhDEnterpriseReader::XMLNS_DOCBOOK); + $xp->registerNamespace("db", Reader::XMLNS_DOCBOOK); $questions = $xp->query("//db:qandaentry/db:question"); - $xml = '<questions xmlns="' .PhDEnterpriseReader::XMLNS_PHD. '">'; + $xml = '<questions xmlns="' .Reader::XMLNS_PHD. '">'; foreach($questions as $node) { - $id = $xp->evaluate("ancestor::db:qandaentry", $node)->item(0)->getAttributeNs(PhDEnterpriseReader::XMLNS_XML, "id"); + $id = $xp->evaluate("ancestor::db:qandaentry", $node)->item(0)->getAttributeNs(Reader::XMLNS_XML, "id"); /* FIXME: No ID? How can we create an anchor for it then? */ if (!$id) { @@ -1344,10 +1346,10 @@ } $xml .= "</questions>"; - $r = new PhDEnterpriseReader(); + $r = new Reader(); $r->XML($xml); - $render = new PhDRender; + $render = new Render; $render->attach($this); $render->render($r); } @@ -1360,7 +1362,7 @@ } public function format_phd_question($open, $name, $attrs, $props) { if ($open) { - $href = $this->createLink($attrs[PhDEnterpriseReader::XMLNS_XML]["id"]); + $href = $this->createLink($attrs[Reader::XMLNS_XML]["id"]); return '<li><a href="' .$href. '">'; } return '</a></li>'; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Reader/Legacy.php?r1=1.24&r2=1.25&diff_format=u Index: phd/phpdotnet/phd/Reader/Legacy.php diff -u phd/phpdotnet/phd/Reader/Legacy.php:1.24 phd/phpdotnet/phd/Reader/Legacy.php:1.25 --- phd/phpdotnet/phd/Reader/Legacy.php:1.24 Thu May 28 07:31:27 2009 +++ phd/phpdotnet/phd/Reader/Legacy.php Fri Jun 19 21:48:54 2009 @@ -1,8 +1,9 @@ <?php -/* $Id: Legacy.php,v 1.24 2009/05/28 07:31:27 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: Legacy.php,v 1.25 2009/06/19 21:48:54 cweiske Exp $ */ //6271 -class PhDReader extends XMLReader { +class Reader_Legacy extends \XMLReader { /* {{{ Class constants */ const XMLNS_XML = "http://www.w3.org/XML/1998/namespace"; @@ -64,10 +65,10 @@ public $isChunk = false; public function __construct($encoding = "UTF-8", $xml_opts = NULL) { /* {{{ */ - if (!XMLReader::open(PhDConfig::xml_file(), $encoding, $xml_opts)) { - throw new Exception("Cannot open " . PhDConfig::xml_file()); + if (!XMLReader::open(Config::xml_file(), $encoding, $xml_opts)) { + throw new Exception("Cannot open " . Config::xml_file()); } - $ce = PhDConfig::chunk_extra(); + $ce = Config::chunk_extra(); if (is_array($ce)) { foreach($ce as $el => $v) { $this->CHUNK_ME[$el] = $v; @@ -149,7 +150,7 @@ $this->STACK[$depth] = $name; $isChunk = $this->isChunk($name, $this->getID()); if ($isChunk) { - $this->isChunk = PhDReader::OPEN_CHUNK; + $this->isChunk = self::OPEN_CHUNK; $this->chunkDepths[] = $this->lastChunkDepth = $depth; } break; @@ -159,7 +160,7 @@ if ($this->lastChunkDepth == $depth) { array_pop($this->chunkDepths); $this->lastChunkDepth = end($this->chunkDepths); - $this->isChunk = PhDReader::CLOSE_CHUNK; + $this->isChunk = self::CLOSE_CHUNK; } $this->LAST_DEPTH = $depth; break; @@ -182,12 +183,12 @@ } /* }}} */ /* Get all attributes of current node */ public function getAttributes() { /* {{{ */ - $attrs = array(PhDReader::XMLNS_DOCBOOK => array(), PhDReader::XMLNS_XML => array()); + $attrs = array(self::XMLNS_DOCBOOK => array(), self::XMLNS_XML => array()); if ($this->hasAttributes) { XMLReader::moveToFirstAttribute(); do { $k = $this->namespaceURI; - $attrs[!empty($k) ? $k : PhDReader::XMLNS_DOCBOOK][$this->localName] = $this->value; + $attrs[!empty($k) ? $k : self::XMLNS_DOCBOOK][$this->localName] = $this->value; $attrs[$this->name] = $this->value; } while (XMLReader::moveToNextAttribute()); XMLReader::moveToElement(); @@ -207,7 +208,7 @@ $node = $this->name; } $retval = ""; - while (PhDReader::readNode($node)) { + while (self::readNode($node)) { $retval .= $this->value; } return $retval; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Reader/Partial.php?r1=1.9&r2=1.10&diff_format=u Index: phd/phpdotnet/phd/Reader/Partial.php diff -u phd/phpdotnet/phd/Reader/Partial.php:1.9 phd/phpdotnet/phd/Reader/Partial.php:1.10 --- phd/phpdotnet/phd/Reader/Partial.php:1.9 Wed Feb 11 05:08:17 2009 +++ phd/phpdotnet/phd/Reader/Partial.php Fri Jun 19 21:48:54 2009 @@ -1,21 +1,23 @@ <?php -/* $Id: Partial.php,v 1.9 2009/02/11 05:08:17 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: Partial.php,v 1.10 2009/06/19 21:48:54 cweiske Exp $ */ -class PhDPartialReader extends PhDReader { +class Reader_Partial extends Reader_Legacy +{ protected $partial = array(); protected $skip = array(); public function __construct($encoding = "UTF-8", $xml_opts = NULL) { parent::__construct($encoding, $xml_opts); - $render_ids = PhDConfig::render_ids(); + $render_ids = Config::render_ids(); if ($render_ids !== NULL) { if (is_array($render_ids)) { $this->partial = $render_ids; } else { $this->partial[$render_ids] = 1; } - $skip_ids = PhDConfig::skip_ids(); + $skip_ids = Config::skip_ids(); if ($skip_ids !== NULL) { if (is_array($skip_ids)) { $this->skip = $skip_ids; @@ -36,9 +38,9 @@ while($ret = parent::read()) { if ($this->isChunk) { - $id = $this->getAttributeNs("id", PhDReader::XMLNS_XML); + $id = $this->getAttributeNs("id", self::XMLNS_XML); if (isset($this->partial[$id])) { - if ($this->isChunk == PhDReader::CLOSE_CHUNK) { + if ($this->isChunk == self::CLOSE_CHUNK) { v("%s done", $id, VERBOSE_PARTIAL_READING); unset($this->partial[$id]); @@ -52,7 +54,7 @@ } return $ret; } elseif (isset($this->skip[$id])) { - if ($this->isChunk == PhDReader::CLOSE_CHUNK) { + if ($this->isChunk == self::CLOSE_CHUNK) { v("%s done", $id, VERBOSE_PARTIAL_READING); unset($this->skip[$id]); @@ -65,7 +67,7 @@ $ignore = true; } } elseif ($currently_skipping && $this->skip[$currently_skipping]) { - if ($this->isChunk == PhDReader::OPEN_CHUNK) { + if ($this->isChunk == self::OPEN_CHUNK) { v("Skipping child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING); } else { v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING); @@ -73,7 +75,7 @@ $ignore = true; } elseif ($currently_reading && $this->partial[$currently_reading]) { - if ($this->isChunk == PhDReader::OPEN_CHUNK) { + if ($this->isChunk == self::OPEN_CHUNK) { v("Rendering child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING); } else { v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING); http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/XHTML.php?r1=1.2&r2=1.3&diff_format=u Index: phd/phpdotnet/phd/Theme/XHTML.php diff -u phd/phpdotnet/phd/Theme/XHTML.php:1.2 phd/phpdotnet/phd/Theme/XHTML.php:1.3 --- phd/phpdotnet/phd/Theme/XHTML.php:1.2 Thu Feb 19 11:57:43 2009 +++ phd/phpdotnet/phd/Theme/XHTML.php Fri Jun 19 21:48:54 2009 @@ -1,10 +1,11 @@ <?php -/* $Id: XHTML.php,v 1.2 2009/02/19 11:57:43 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: XHTML.php,v 1.3 2009/06/19 21:48:54 cweiske Exp $ */ /** * Base class for XHTML themes */ -abstract class PhDThemeXhtml extends PhDTheme +abstract class Theme_XHTML extends Theme { /** * If we are a theme generating chunks or not @@ -16,7 +17,7 @@ /** * Media manager object * - * @var PhDMediaManager + * @var MediaManager */ public $mediamanager = null; @@ -41,7 +42,7 @@ */ public function postConstruct() { - $this->mediamanager = new PhDMediaManager(PhDConfig::xml_root()); + $this->mediamanager = new MediaManager(Config::xml_root()); if (isset($this->outputdir) && $this->outputdir) { $this->mediamanager->output_dir = $this->outputdir; @@ -67,7 +68,7 @@ */ public function createToc($id, $name, $props, $depth = 1, $header = true) { - $chunks = PhDHelper::getChildren($id); + $chunks = Helper::getChildren($id); if ($depth == 0 || !count($chunks)) { return ''; } @@ -78,8 +79,8 @@ } $content .= " <ul class=\"chunklist chunklist_$name\">\n"; foreach ($chunks as $chunkid => $junk) { - $long = $this->format->TEXT(PhDHelper::getDescription($chunkid, true)); - $short = $this->format->TEXT(PhDHelper::getDescription($chunkid, false)); + $long = $this->format->TEXT(Helper::getDescription($chunkid, true)); + $short = $this->format->TEXT(Helper::getDescription($chunkid, false)); if ($long && $short && $long != $short) { $desc = $short . '</a> -- ' . $long; } else { @@ -89,7 +90,7 @@ if ($this->chunked) { $content .= " <li><a href=\"{$chunkid}.{$this->ext}\">" . $desc; } else { - $content .= " <li><a href=\"#{$chunkid}\">" . $this->format->TEXT(PhDHelper::getDescription($chunkid, false)) . "</a>"; + $content .= " <li><a href=\"#{$chunkid}\">" . $this->format->TEXT(Helper::getDescription($chunkid, false)) . "</a>"; } if ($depth > 1) { $content .= $this->createToc($chunkid, $name, $props, $depth - 1, false); @@ -109,7 +110,7 @@ * Handle an image. */ public function format_imagedata($open, $name, $attrs) { - $file = $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]; + $file = $attrs[Reader_Legacy::XMLNS_DOCBOOK]["fileref"]; $newpath = $this->mediamanager->handleFile($file); if ($this->format->cchunk["mediaobject"]["alt"] !== false) { @@ -128,11 +129,11 @@ return '<div class="phd-toc">'; } return $this->createToc( - $attrs[PhDReader::XMLNS_PHD]['element'], + $attrs[Reader_Legacy::XMLNS_PHD]['element'], 'phd-toc', $props, - isset($attrs[PhDReader::XMLNS_PHD]['toc-depth']) - ? (int)$attrs[PhDReader::XMLNS_PHD]['toc-depth'] : 1, + isset($attrs[Reader_Legacy::XMLNS_PHD]['toc-depth']) + ? (int)$attrs[Reader_Legacy::XMLNS_PHD]['toc-depth'] : 1, false ) . "</div>\n"; } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PEAR/Base.php?r1=1.31&r2=1.32&diff_format=u Index: phd/phpdotnet/phd/Theme/PEAR/Base.php diff -u phd/phpdotnet/phd/Theme/PEAR/Base.php:1.31 phd/phpdotnet/phd/Theme/PEAR/Base.php:1.32 --- phd/phpdotnet/phd/Theme/PEAR/Base.php:1.31 Tue Feb 17 19:03:32 2009 +++ phd/phpdotnet/phd/Theme/PEAR/Base.php Fri Jun 19 21:48:54 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -abstract class peartheme extends PhDThemeXhtml { +abstract class Theme_PEAR_Base extends Theme_XHTML +{ protected $elementmap = array( 'acronym' => 'span', 'article' => 'format_container_chunk', @@ -303,8 +305,8 @@ public function format_chunk($open, $name, $attrs, $props) { $id = null; - if (isset($attrs[PhDReader::XMLNS_XML]['id'])) { - $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]['id']; + if (isset($attrs[Reader_Legacy::XMLNS_XML]['id'])) { + $this->CURRENT_ID = $id = $attrs[Reader_Legacy::XMLNS_XML]['id']; } if ($props['isChunk']) { $this->cchunk = $this->dchunk; @@ -313,8 +315,8 @@ $this->lang = $props['lang']; } if ($name == 'refentry') { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]['role'])) { - $this->cchunk['verinfo'] = !($attrs[PhDReader::XMLNS_DOCBOOK]['role'] == 'noversion'); + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]['role'])) { + $this->cchunk['verinfo'] = !($attrs[Reader_Legacy::XMLNS_DOCBOOK]['role'] == 'noversion'); } else { $this->cchunk['verinfo'] = true; } @@ -330,14 +332,14 @@ public function format_container_chunk($open, $name, $attrs, $props) { - if (!isset($attrs[PhDReader::XMLNS_XML]['id'])) { + if (!isset($attrs[Reader_Legacy::XMLNS_XML]['id'])) { if ($open) { return "<div class=\"{$name}\">"; } else { return "</div>\n"; } } - $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]['id']; + $this->CURRENT_ID = $id = $attrs[Reader_Legacy::XMLNS_XML]['id']; if (!$open) { return "</div>\n"; @@ -349,8 +351,8 @@ $toc = $this->createToc( $id, $name, $props, - isset($attrs[PhDReader::XMLNS_PHD]['toc-depth']) - ? (int)$attrs[PhDReader::XMLNS_PHD]['toc-depth'] : 1 + isset($attrs[Reader_Legacy::XMLNS_PHD]['toc-depth']) + ? (int)$attrs[Reader_Legacy::XMLNS_PHD]['toc-depth'] : 1 ); if ($toc) { $toc = "<div class=\"TOC\">\n" . $toc . "</div>\n"; @@ -382,15 +384,15 @@ */ public function format_root_chunk($open, $name, $attrs, $props) { - $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]['id']; + $this->CURRENT_ID = $id = $attrs[Reader_Legacy::XMLNS_XML]['id']; if ($open) { return "<div class=\"{$name}\">"; } $content = $this->createToc( $id, $name, $props, - isset($attrs[PhDReader::XMLNS_PHD]['toc-depth']) - ? (int)$attrs[PhDReader::XMLNS_PHD]['toc-depth'] : 1 + isset($attrs[Reader_Legacy::XMLNS_PHD]['toc-depth']) + ? (int)$attrs[Reader_Legacy::XMLNS_PHD]['toc-depth'] : 1 ); $content .= "</div>\n"; @@ -414,9 +416,9 @@ $content = $fragment = ''; $class = $name; - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]['linkend'])) { - $linkto = $attrs[PhDReader::XMLNS_DOCBOOK]['linkend']; - $id = $href = PhDHelper::getFilename($linkto); + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]['linkend'])) { + $linkto = $attrs[Reader_Legacy::XMLNS_DOCBOOK]['linkend']; + $id = $href = Helper::getFilename($linkto); if ($id != $linkto) { $fragment = "#$linkto"; @@ -424,8 +426,8 @@ if ($this->chunked) { $href .= '.'.$this->ext; } - } elseif (isset($attrs[PhDReader::XMLNS_XLINK]['href'])) { - $href = $attrs[PhDReader::XMLNS_XLINK]['href']; + } elseif (isset($attrs[Reader_Legacy::XMLNS_XLINK]['href'])) { + $href = $attrs[Reader_Legacy::XMLNS_XLINK]['href']; $class .= ' external'; } if ($name == 'xref') { @@ -439,7 +441,7 @@ $link .= $href; } } - return '<a href="' . htmlspecialchars($link). '" class="' .$class. '">' .($content.PhDHelper::getDescription($id, false)). '</a>'; + return '<a href="' . htmlspecialchars($link). '" class="' .$class. '">' .($content.Helper::getDescription($id, false)). '</a>'; } elseif ($props['empty']) { if ($this->chunked) { $link = ''; @@ -482,8 +484,8 @@ { if ($open) { $idstr = ''; - if (isset($attrs[PhDReader::XMLNS_XML]['id'])) { - $id = $attrs[PhDReader::XMLNS_XML]['id']; + if (isset($attrs[Reader_Legacy::XMLNS_XML]['id'])) { + $id = $attrs[Reader_Legacy::XMLNS_XML]['id']; $idstr = ' id="' .$id. '" name="' .$id. '"'; } return '<' .$tag. ' class="' .$name. '"' . $idstr. '>' . ($props['empty'] ? "</{$tag}>" : ''); @@ -512,9 +514,9 @@ } $text = $props['empty'] ? '' : $this->phd_pearapi_text; - $package = $attrs[PhDReader::XMLNS_PHD]['package']; - $linkend = isset($attrs[PhDReader::XMLNS_PHD]['linkend']) - ? $attrs[PhDReader::XMLNS_PHD]['linkend'] : null; + $package = $attrs[Reader_Legacy::XMLNS_PHD]['package']; + $linkend = isset($attrs[Reader_Legacy::XMLNS_PHD]['linkend']) + ? $attrs[Reader_Legacy::XMLNS_PHD]['linkend'] : null; $arLinkend = explode('::', $linkend); $class = null; $method = null; @@ -577,8 +579,8 @@ { if ($open) { $this->trim = true; - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]['role'])) { - $this->role = $attrs[PhDReader::XMLNS_DOCBOOK]['role']; + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]['role'])) { + $this->role = $attrs[Reader_Legacy::XMLNS_DOCBOOK]['role']; } else { $this->role = ''; } @@ -774,7 +776,7 @@ public function format_th_entry($open, $name, $attrs) { if ($open) { - $colspan = PhDFormat::colspan($attrs[PhDReader::XMLNS_DOCBOOK]); + $colspan = Format::colspan($attrs[Reader_Legacy::XMLNS_DOCBOOK]); return '<th colspan="' .((int)$colspan). '">'; } return '</th>'; @@ -975,7 +977,7 @@ public function format_emphasis($open, $name, $attrs) { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]['role']) && $attrs[PhDReader::XMLNS_DOCBOOK]['role'] == "bold") + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]['role']) && $attrs[Reader_Legacy::XMLNS_DOCBOOK]['role'] == "bold") $role = "b"; else $role = "i"; if ($open) { @@ -1012,7 +1014,7 @@ public function format_callout($open, $name, $attrs) { if ($open) { - return '<tr><td><a href="#'.$attrs[PhDReader::XMLNS_DOCBOOK]['arearefs'].'">(' .++$this->cchunk['callouts']. ')</a></td><td>'; + return '<tr><td><a href="#'.$attrs[Reader_Legacy::XMLNS_DOCBOOK]['arearefs'].'">(' .++$this->cchunk['callouts']. ')</a></td><td>'; } return "</td></tr>\n"; } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PEAR/BigHTML.php?r1=1.5&r2=1.6&diff_format=u Index: phd/phpdotnet/phd/Theme/PEAR/BigHTML.php diff -u phd/phpdotnet/phd/Theme/PEAR/BigHTML.php:1.5 phd/phpdotnet/phd/Theme/PEAR/BigHTML.php:1.6 --- phd/phpdotnet/phd/Theme/PEAR/BigHTML.php:1.5 Fri May 15 05:53:04 2009 +++ phd/phpdotnet/phd/Theme/PEAR/BigHTML.php Fri Jun 19 21:48:54 2009 @@ -1,7 +1,8 @@ <?php +namespace phpdotnet\phd; -require_once $ROOT . '/themes/pear/peartheme.php'; -class pearbightml extends peartheme { +class Theme_PEAR_BigHTML extends Theme_PEAR +{ /** * File to write the html to * @@ -18,7 +19,7 @@ public function __construct(array $IDs, $ext = "html") { parent::__construct($IDs, $ext, false); - $this->outputfile = PhDConfig::output_dir() . 'pear_manual_' . PhDConfig::language() . '.html'; + $this->outputfile = Config::output_dir() . 'pear_manual_' . Config::language() . '.html'; $this->stream = fopen($this->outputfile, "w"); self::header(); } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PEAR/CHM.php?r1=1.9&r2=1.10&diff_format=u Index: phd/phpdotnet/phd/Theme/PEAR/CHM.php diff -u phd/phpdotnet/phd/Theme/PEAR/CHM.php:1.9 phd/phpdotnet/phd/Theme/PEAR/CHM.php:1.10 --- phd/phpdotnet/phd/Theme/PEAR/CHM.php:1.9 Tue Feb 17 19:19:39 2009 +++ phd/phpdotnet/phd/Theme/PEAR/CHM.php Fri Jun 19 21:48:54 2009 @@ -1,7 +1,8 @@ <?php +namespace phpdotnet\phd; -require_once $ROOT . '/themes/pear/pearchunkedhtml.php'; -class pearchm extends pearchunkedhtml { +class Theme_PEAR_CHM extends Theme_PEAR_ChunkedHTML +{ const DEFAULT_FONT = "Arial,10,0"; const DEFAULT_TITLE = "PEAR Manual"; @@ -184,14 +185,14 @@ public function __construct(array $IDs, $ext = "html", $dir = "chm") { parent::__construct($IDs, $ext); - $this->chmdir = PhDConfig::output_dir() . $dir . DIRECTORY_SEPARATOR; + $this->chmdir = Config::output_dir() . $dir . 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 = PhDConfig::output_dir() . $dir . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $dir . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); - $lang = PhDConfig::language(); + $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"); @@ -217,7 +218,7 @@ protected function appendChm($name, $ref, $isChunk, $hasChild) { switch ($isChunk) { - case PhDReader::OPEN_CHUNK : + case Reader_Legacy::OPEN_CHUNK : $this->currentTocDepth++; fwrite($this->hhpStream, "{$ref}\n"); fwrite($this->hhcStream, "{$this->offset(1)}<li><object type=\"text/sitemap\">\n" . @@ -230,7 +231,7 @@ " <param name=\"Name\" value=\"" . htmlentities(self::cleanIndexName($name)) . "\">\n" . " </object>\n </li>\n"); break; - case PhDReader::CLOSE_CHUNK : + case Reader_Legacy::CLOSE_CHUNK : if ($hasChild) { fwrite($this->hhcStream, "{$this->offset(2)}</ul>\n"); } @@ -259,7 +260,7 @@ } protected function headerChm() { - $lang = PhDConfig::language(); + $lang = Config::language(); fwrite($this->hhpStream, '[OPTIONS] Compatibility=1.1 or later Compiled file=pear_manual_' . $lang . '.chm @@ -362,13 +363,13 @@ } private function collectContent($attrs) { - if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDReader::XMLNS_XML]["id"]; + if (isset($attrs[Reader_Legacy::XMLNS_XML]["id"])) { + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; $this->lastContent = array( - "name" => PhDHelper::getDescription($id), + "name" => Helper::getDescription($id), "reference" => "res\\" . - (PhDHelper::getFilename($id) ? PhDHelper::getFilename($id) : $id) . "." . $this->ext, - "hasChild" => (count(PhDHelper::getChildren($id)) > 0) + (Helper::getFilename($id) ? Helper::getFilename($id) : $id) . "." . $this->ext, + "hasChild" => (count(Helper::getChildren($id)) > 0) ); } } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PEAR/ChunkedHTML.php?r1=1.12&r2=1.13&diff_format=u Index: phd/phpdotnet/phd/Theme/PEAR/ChunkedHTML.php diff -u phd/phpdotnet/phd/Theme/PEAR/ChunkedHTML.php:1.12 phd/phpdotnet/phd/Theme/PEAR/ChunkedHTML.php:1.13 --- phd/phpdotnet/phd/Theme/PEAR/ChunkedHTML.php:1.12 Tue Feb 17 19:12:55 2009 +++ phd/phpdotnet/phd/Theme/PEAR/ChunkedHTML.php Fri Jun 19 21:48:54 2009 @@ -1,13 +1,13 @@ <?php -require_once $ROOT . '/themes/pear/pearweb.php'; +namespace phpdotnet\phd; /** * PEAR theme for the normal-html-in-many-files version * * @package PhD -* @version CVS: $Id: ChunkedHTML.php,v 1.12 2009/02/17 19:12:55 cweiske Exp $ +* @version CVS: $Id: ChunkedHTML.php,v 1.13 2009/06/19 21:48:54 cweiske Exp $ */ -class pearchunkedhtml extends pearweb +class Theme_PEAR_ChunkedHTML extends Theme_PEAR_Web { private $nav = ""; @@ -23,7 +23,7 @@ public function __construct(array $IDs, $ext = "html") { parent::__construct($IDs, $ext, true); - $this->outputdir = PhDConfig::output_dir() . $this->ext . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $this->ext . DIRECTORY_SEPARATOR; if (!file_exists($this->outputdir) || is_file($this->outputdir)) { mkdir($this->outputdir) or die("Can't create the cache directory"); } else if (file_exists($this->outputdir . 'index.html')) { @@ -43,16 +43,16 @@ */ public function header($id) { - $title = htmlspecialchars(PhDHelper::getDescription($id)); - $parent = PhDHelper::getParent($id); + $title = htmlspecialchars(Helper::getDescription($id)); + $parent = Helper::getParent($id); $this->next = $this->prev = $this->up = array(null, null); $strNext = $strPrev = ''; if ($parent) { if ($parent !== 'ROOT') { - $siblings = PhDHelper::getChildren($parent); + $siblings = Helper::getChildren($parent); } else { - $siblings = array($id => PhDHelper::getSelf($id)); + $siblings = array($id => Helper::getSelf($id)); } $this->prev = parent::createPrev($id, $parent, $siblings); if ($this->prev[0] === 'index') { @@ -65,7 +65,7 @@ if ($parent !== 'index' && $parent !== 'ROOT') { $this->up = array( $parent.".html", - htmlspecialchars(PhDHelper::getDescription($parent, false)) + htmlspecialchars(Helper::getDescription($parent, false)) ); } } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PEAR/Web.php?r1=1.14&r2=1.15&diff_format=u Index: phd/phpdotnet/phd/Theme/PEAR/Web.php diff -u phd/phpdotnet/phd/Theme/PEAR/Web.php:1.14 phd/phpdotnet/phd/Theme/PEAR/Web.php:1.15 --- phd/phpdotnet/phd/Theme/PEAR/Web.php:1.14 Sat Mar 7 19:14:02 2009 +++ phd/phpdotnet/phd/Theme/PEAR/Web.php Fri Jun 19 21:48:54 2009 @@ -1,13 +1,13 @@ <?php -require_once $ROOT . '/themes/pear/peartheme.php'; +namespace phpdotnet\phd; /** * PEAR theme for the many php files used for pearweb * * @package PhD -* @version CVS: $Id: Web.php,v 1.14 2009/03/07 19:14:02 cweiske Exp $ +* @version CVS: $Id: Web.php,v 1.15 2009/06/19 21:48:54 cweiske Exp $ */ -class pearweb extends peartheme +class Theme_PEAR_Web extends Theme_PEAR_Base { /** * Array of file resources @@ -40,7 +40,7 @@ public function __construct($IDs, $ext = "php", $chunked = true) { parent::__construct($IDs, $ext, $chunked); - $this->outputdir = PhDConfig::output_dir() . $this->ext . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $this->ext . DIRECTORY_SEPARATOR; if (!file_exists($this->outputdir) || is_file($this->outputdir)) { mkdir($this->outputdir) or die("Can't create the cache directory"); } else { @@ -90,14 +90,14 @@ * Append data to the streams. * * @param string $data Data to write - * @param PhDReader::CLOSE_CHUNK|PhDReader::OPEN_CHUNK $isChunk constant + * @param Reader_Legacy::CLOSE_CHUNK|Reader_Legacy::OPEN_CHUNK $isChunk constant * * @return int|false */ public function appendData($data, $isChunk) { switch($isChunk) { - case PhDReader::CLOSE_CHUNK: + case Reader_Legacy::CLOSE_CHUNK: $id = $this->CURRENT_ID; $stream = array_pop($this->streams); @@ -109,7 +109,7 @@ return $retval; break; - case PhDReader::OPEN_CHUNK: + case Reader_Legacy::OPEN_CHUNK: $this->streams[] = fopen("php://temp/maxmemory", "r+"); default: @@ -130,7 +130,7 @@ { $ext = "." . $this->ext; - $parent = PhDHelper::getParent($id); + $parent = Helper::getParent($id); if (!$parent || $parent == "ROOT") return '<?php @@ -148,7 +148,7 @@ // Fetch the siblings information $toc = array(); - $siblings = PhDHelper::getChildren($parent); + $siblings = Helper::getChildren($parent); foreach ($siblings as $sibling => $array) { $toc[] = array($sibling.$ext, empty($array["sdesc"]) ? $array["ldesc"] : $array["sdesc"]); } @@ -158,7 +158,7 @@ 'home' => array('index' . $ext, 'PEAR Manual'), 'prev' => $this->createPrev($id, $parent, $siblings), 'next' => $this->createNext($id, $parent, $siblings), - 'up' => array($this->getFilename($parent).$ext, PhDHelper::getDescription($parent, true)), + 'up' => array($this->getFilename($parent).$ext, Helper::getDescription($parent, true)), 'toc' => $toc ); return "<?php \n" . @@ -166,7 +166,7 @@ "setupNavigation(" . var_export($nav, true) . ");\n" . 'manualHeader("' . $this->getFilename($id).$ext . '", ' - . var_export(PhDHelper::getDescription($id, true), true) + . var_export(Helper::getDescription($id, true), true) . ');' . "\n" . "?>\n"; } @@ -183,11 +183,11 @@ public function footer($id) { $ext = '.' . $this->ext; - $parent = PhDHelper::getParent($id); + $parent = Helper::getParent($id); return '<?php manualFooter("' . $this->getFilename($id) . $ext . '", ' - . var_export(PhDHelper::getDescription($id, true), true) + . var_export(Helper::getDescription($id, true), true) . '); ?>'; } @@ -229,7 +229,7 @@ break; } - return array(PhDHelper::getFilename($parent).$ext, PhDHelper::getDescription($parent, false)); + return array(Helper::getFilename($parent).$ext, Helper::getDescription($parent, false)); } /** @@ -276,13 +276,13 @@ } // We are the end element in this chapter - $grandpa = PhDHelper::getParent($parent); + $grandpa = Helper::getParent($parent); if (!$grandpa || $grandpa == "ROOT") { // There is no next relative break; } - $siblings = PhDHelper::getChildren($grandpa); + $siblings = Helper::getChildren($grandpa); $id = $parent; $parent = $grandpa; } while (true); @@ -312,7 +312,7 @@ { if ($open) { $this->cchunk["qandaentry"] = array(); - $this->appendData(null, PhDReader::OPEN_CHUNK); + $this->appendData(null, Reader_Legacy::OPEN_CHUNK); return ''; } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/BigHTML.php?r1=1.15&r2=1.16&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/BigHTML.php diff -u phd/phpdotnet/phd/Theme/PHP/BigHTML.php:1.15 phd/phpdotnet/phd/Theme/PHP/BigHTML.php:1.16 --- phd/phpdotnet/phd/Theme/PHP/BigHTML.php:1.15 Tue Feb 17 19:03:32 2009 +++ phd/phpdotnet/phd/Theme/PHP/BigHTML.php Fri Jun 19 21:48:54 2009 @@ -1,8 +1,9 @@ <?php -/* $Id: BigHTML.php,v 1.15 2009/02/17 19:03:32 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: BigHTML.php,v 1.16 2009/06/19 21:48:54 cweiske Exp $ */ -require_once $ROOT . '/themes/php/phpdotnet.php'; -class bightml extends phpdotnet { +class Theme_PHP_BigHTML extends Theme_PHP_PHPDotNet +{ /** * File to write the html to * @@ -19,7 +20,7 @@ public function __construct(array $IDs, $filename, $ext = "html") { parent::__construct($IDs, $filename, $ext, false); - $this->outputfile = PhDConfig::output_dir() . 'bightml.html'; + $this->outputfile = Config::output_dir() . 'bightml.html'; $this->stream = fopen($this->outputfile, "w"); self::header(); } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/BigPDF.php?r1=1.3&r2=1.4&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/BigPDF.php diff -u phd/phpdotnet/phd/Theme/PHP/BigPDF.php:1.3 phd/phpdotnet/phd/Theme/PHP/BigPDF.php:1.4 --- phd/phpdotnet/phd/Theme/PHP/BigPDF.php:1.3 Wed Feb 11 05:08:17 2009 +++ phd/phpdotnet/phd/Theme/PHP/BigPDF.php Fri Jun 19 21:48:54 2009 @@ -1,10 +1,12 @@ <?php -require_once $ROOT . '/themes/php/phppdf.php'; -class phpbigpdf extends phppdf { +namespace phpdotnet\phd; + +class Theme_PHP_BigPDF extends Theme_PHP_PDF +{ public function __construct(array $IDs, array $filenames, $format = "pdf", $chunked = true) { parent::__construct($IDs, $filenames, $format, $chunked); - $this->outputdir = PhDConfig::output_dir(); + $this->outputdir = Config::output_dir(); } // Do nothing @@ -22,11 +24,11 @@ } $this->format->setPdfDoc($pdfDoc); - if (isset($attrs[PhDReader::XMLNS_XML]["base"]) && $base = $attrs[PhDReader::XMLNS_XML]["base"]) + if (isset($attrs[Reader_Legacy::XMLNS_XML]["base"]) && $base = $attrs[Reader_Legacy::XMLNS_XML]["base"]) $this->format->setChunkInfo("xml-base", $base); - $id = $attrs[PhDReader::XMLNS_XML]["id"]; + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; $this->cchunk["root-outline"] = $this->cchunk["id-to-outline"][$id] = - $pdfDoc->createOutline(PhDHelper::getDescription($id), null, true); + $pdfDoc->createOutline(Helper::getDescription($id), null, true); $this->setIdToPage($id); } else { $this->resolveLinks($this->cchunk["setname"]); http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/CHMSource.php?r1=1.17&r2=1.18&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/CHMSource.php diff -u phd/phpdotnet/phd/Theme/PHP/CHMSource.php:1.17 phd/phpdotnet/phd/Theme/PHP/CHMSource.php:1.18 --- phd/phpdotnet/phd/Theme/PHP/CHMSource.php:1.17 Wed Jun 17 12:05:29 2009 +++ phd/phpdotnet/phd/Theme/PHP/CHMSource.php Fri Jun 19 21:48:54 2009 @@ -1,8 +1,9 @@ <?php -/* $Id: CHMSource.php,v 1.17 2009/06/17 12:05:29 rquadling Exp $ */ +namespace phpdotnet\phd; +/* $Id: CHMSource.php,v 1.18 2009/06/19 21:48:54 cweiske Exp $ */ -require_once $ROOT . '/themes/php/chunkedhtml.php'; -class chmsource extends chunkedhtml { +class Theme_PHP_CHMSource extends Theme_PHP_ChunkedHTML +{ const DEFAULT_FONT = "Arial,10,0"; const DEFAULT_TITLE = "PHP Manual"; @@ -192,15 +193,15 @@ public function __construct(array $IDs, $filename, $ext = "html", $dir = "chm") { chunkedhtml::__construct($IDs, $filename, $ext); - $this->chmdir = PhDConfig::output_dir() . $dir . DIRECTORY_SEPARATOR; + $this->chmdir = Config::output_dir() . $dir . 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 = PhDConfig::output_dir() . $dir . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $dir . DIRECTORY_SEPARATOR . "res" . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); - $lang = PhDConfig::language(); + $lang = Config::language(); $this->hhpStream = fopen($this->chmdir . "php_manual_{$lang}.hhp", "w"); $this->hhcStream = fopen($this->chmdir . "php_manual_{$lang}.hhc", "w"); $this->hhkStream = fopen($this->chmdir . "php_manual_{$lang}.hhk", "w"); @@ -222,8 +223,8 @@ protected function appendChm($name, $ref, $isChunk, $hasChild) { switch ($isChunk) { - case PhDReader::OPEN_CHUNK: - $charset = $this->LANGUAGES[PhDConfig::language()]["preferred_charset"]; + case Reader_Legacy::OPEN_CHUNK: + $charset = $this->LANGUAGES[Config::language()]["preferred_charset"]; $name = htmlspecialchars(iconv('UTF-8', $charset, $name), ENT_QUOTES); $this->currentTocDepth++; @@ -238,7 +239,7 @@ " <param name=\"Name\" value=\"" . $name . "\">\n" . " </object>\n </li>\n"); break; - case PhDReader::CLOSE_CHUNK : + case Reader_Legacy::CLOSE_CHUNK : if ($hasChild) { fwrite($this->hhcStream, "{$this->offset(2)}</ul>\n"); } @@ -248,7 +249,7 @@ } protected function headerChm() { - $lang = PhDConfig::language(); + $lang = Config::language(); fwrite($this->hhpStream, '[OPTIONS] Binary TOC=Yes Compatibility=1.1 or later @@ -330,7 +331,7 @@ public function format_varlistentry($open, $name, $attrs) { $this->collectContent($attrs); - $charset = $this->LANGUAGES[PhDConfig::language()]["preferred_charset"]; + $charset = $this->LANGUAGES[Config::language()]["preferred_charset"]; $content = htmlspecialchars(iconv('UTF-8', $charset, $this->lastContent["name"]), ENT_QUOTES); fwrite($this->hhkStream, " <li><object type=\"text/sitemap\">\n" . @@ -353,13 +354,13 @@ private function collectContent($attrs) { - if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { - $id = $attrs[PhDReader::XMLNS_XML]["id"]; + if (isset($attrs[Reader_Legacy::XMLNS_XML]["id"])) { + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; $this->lastContent = array( - "name" => PhDHelper::getDescription($id), + "name" => Helper::getDescription($id), "reference" => "res" . DIRECTORY_SEPARATOR . - (PhDHelper::getFilename($id) ? PhDHelper::getFilename($id) : $id) . "." . $this->ext, - "hasChild" => (count(PhDHelper::getChildren($id)) > 0) + (Helper::getFilename($id) ? Helper::getFilename($id) : $id) . "." . $this->ext, + "hasChild" => (count(Helper::getChildren($id)) > 0) ); } } http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/ChunkedHTML.php?r1=1.17&r2=1.18&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/ChunkedHTML.php diff -u phd/phpdotnet/phd/Theme/PHP/ChunkedHTML.php:1.17 phd/phpdotnet/phd/Theme/PHP/ChunkedHTML.php:1.18 --- phd/phpdotnet/phd/Theme/PHP/ChunkedHTML.php:1.17 Wed Dec 24 11:30:16 2008 +++ phd/phpdotnet/phd/Theme/PHP/ChunkedHTML.php Fri Jun 19 21:48:54 2009 @@ -1,18 +1,19 @@ <?php -/* $Id: ChunkedHTML.php,v 1.17 2008/12/24 11:30:16 eniac2008 Exp $ */ +namespace phpdotnet\phd; +/* $Id: ChunkedHTML.php,v 1.18 2009/06/19 21:48:54 cweiske Exp $ */ -require_once $ROOT . '/themes/php/phpweb.php'; -class chunkedhtml extends phpweb { +class Theme_PHP_ChunkedHTML extends Theme_PHP_Web +{ private $nav = ""; public function __construct(array $IDs, $filename, $ext = "html") { phpdotnet::__construct($IDs, $filename, $ext, true); - $this->outputdir = PhDConfig::output_dir() . $this->ext . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $this->ext . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); elseif (file_exists($this->outputdir . 'index.html')) unlink($this->outputdir . 'index.html'); // preserve back-compat } public function header($id) { - $title = PhDHelper::getDescription($id, true); + $title = Helper::getDescription($id, true); $header = <<<HEADER <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> @@ -22,13 +23,13 @@ </head> <body> HEADER; - $parent = PhDHelper::getParent($id); + $parent = Helper::getParent($id); $next = $prev = $up = array(null, null); if ($parent && $parent != "ROOT") { - $siblings = PhDHelper::getChildren($parent); - $prev = phpweb::createPrev($id, $parent, $siblings); - $next = phpweb::createNext($id, $parent, $siblings); - $up = array($parent.".html", PhDHelper::getDescription($parent, false)); + $siblings = Helper::getChildren($parent); + $prev = parent::createPrev($id, $parent, $siblings); + $next = parent::createNext($id, $parent, $siblings); + $up = array($parent.".html", Helper::getDescription($parent, false)); } $nav = <<<NAV http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/Functions.php?r1=1.5&r2=1.6&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/Functions.php diff -u phd/phpdotnet/phd/Theme/PHP/Functions.php:1.5 phd/phpdotnet/phd/Theme/PHP/Functions.php:1.6 --- phd/phpdotnet/phd/Theme/PHP/Functions.php:1.5 Tue Feb 17 19:03:32 2009 +++ phd/phpdotnet/phd/Theme/PHP/Functions.php Fri Jun 19 21:48:54 2009 @@ -1,6 +1,8 @@ <?php +namespace phpdotnet\phd; -class phpfunctions extends PhDTheme { +class Theme_PHP_Functions extends Theme +{ const OPEN_CHUNK = 0x01; const CLOSE_CHUNK = 0x02; const OPENED_CHUNK = 0x03; @@ -53,7 +55,7 @@ public function __construct(array $IDs, array $filenames, $format = "man3", $chunked = true) { parent::__construct($IDs); $this->format = $format; - $this->outputdir = PhDConfig::output_dir() . $this->format . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $this->format . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); } @@ -132,7 +134,7 @@ } public function format_set($open, $name, $attrs, $props) { - if (isset($attrs[PhDReader::XMLNS_XML]["id"]) && $attrs[PhDReader::XMLNS_XML]["id"] == "funcref") { + if (isset($attrs[Reader_Legacy::XMLNS_XML]["id"]) && $attrs[Reader_Legacy::XMLNS_XML]["id"] == "funcref") { $this->isFunctionRefSet = $open; } return false; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/HowTo.php?r1=1.2&r2=1.3&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/HowTo.php diff -u phd/phpdotnet/phd/Theme/PHP/HowTo.php:1.2 phd/phpdotnet/phd/Theme/PHP/HowTo.php:1.3 --- phd/phpdotnet/phd/Theme/PHP/HowTo.php:1.2 Sun Oct 19 14:25:39 2008 +++ phd/phpdotnet/phd/Theme/PHP/HowTo.php Fri Jun 19 21:48:54 2009 @@ -1,26 +1,28 @@ <?php -/* $Id: HowTo.php,v 1.2 2008/10/19 14:25:39 bjori Exp $ */ +namespace phpdotnet\phd; +/* $Id: HowTo.php,v 1.3 2009/06/19 21:48:54 cweiske Exp $ */ -require_once $ROOT . '/themes/php/phpweb.php'; -class howto extends phpweb { + +class Theme_PHP_HowTo extends Theme_PHP_Web +{ private $tmp = ""; public function __construct(array $IDs, $filename, $ext = "php") { phpdotnet::__construct($IDs, array(), $ext, true); - $this->outputdir = PhDConfig::output_dir() . 'howto' . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . 'howto' . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) { mkdir($this->outputdir) or die("Can't create the cache directory"); } } public function header($id) { - $title = PhDHelper::getDescription($id, true); - $parent = PhDHelper::getParent($id); + $title = Helper::getDescription($id, true); + $parent = Helper::getParent($id); $next = $prev = $up = array(null, null); if ($parent && $parent != "ROOT") { - $siblings = PhDHelper::getChildren($parent); - $prev = phpweb::createPrev($id, $parent, $siblings); - $next = phpweb::createNext($id, $parent, $siblings); - $up = array($parent.".php", PhDHelper::getDescription($parent, false)); + $siblings = Helper::getChildren($parent); + $prev = parent::createPrev($id, $parent, $siblings); + $next = parent::createNext($id, $parent, $siblings); + $up = array($parent.".php", Helper::getDescription($parent, false)); } $this->tmp = <<< NAV http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/KDevelop.php?r1=1.4&r2=1.5&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/KDevelop.php diff -u phd/phpdotnet/phd/Theme/PHP/KDevelop.php:1.4 phd/phpdotnet/phd/Theme/PHP/KDevelop.php:1.5 --- phd/phpdotnet/phd/Theme/PHP/KDevelop.php:1.4 Wed Feb 11 05:08:17 2009 +++ phd/phpdotnet/phd/Theme/PHP/KDevelop.php Fri Jun 19 21:48:54 2009 @@ -1,7 +1,8 @@ <?php +namespace phpdotnet\phd; -require_once $ROOT . '/themes/php/chunkedhtml.php'; -class phpkdevelop extends PhDTheme { +class Theme_PHP_KDevelop extends Theme +{ const DEFAULT_TITLE = "PHP Manual"; const DEFAULT_HREF = "http://www.php.net/manual/en/"; @@ -78,7 +79,7 @@ public function __construct(array $IDs, $filename, $ext = "php") { parent::__construct($IDs, $ext); - $this->tocDir = PhDConfig::output_dir(); + $this->tocDir = Config::output_dir(); $this->ext = $ext; @@ -113,12 +114,12 @@ } public function format_tocsect1($open, $name, $attrs) { - if (!isset($attrs[PhDReader::XMLNS_XML]["id"])) return ""; - $id = $attrs[PhDReader::XMLNS_XML]["id"]; - $hasChild = (count(PhDHelper::getChildren($id)) > 0); + if (!isset($attrs[Reader_Legacy::XMLNS_XML]["id"])) return ""; + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; + $hasChild = (count(Helper::getChildren($id)) > 0); if ($open) { - $name = htmlspecialchars(PhDHelper::getDescription($id), ENT_QUOTES, 'UTF-8'); - $url = (PhDHelper::getFilename($id) ? PhDHelper::getFilename($id) : $id) . "." . $this->ext; + $name = htmlspecialchars(Helper::getDescription($id), ENT_QUOTES, 'UTF-8'); + $url = (Helper::getFilename($id) ? Helper::getFilename($id) : $id) . "." . $this->ext; fwrite($this->tocStream, "<tocsect1 name=\"{$name}\" url=\"{$url}\"" . ($hasChild ? "" : "/") . ">\n"); } else { if ($hasChild) @@ -128,25 +129,25 @@ } public function format_tocsect2($open, $name, $attrs) { - if (!isset($attrs[PhDReader::XMLNS_XML]["id"])) return ""; - $id = $attrs[PhDReader::XMLNS_XML]["id"]; - $hasChild = (count(PhDHelper::getChildren($id)) > 0); + if (!isset($attrs[Reader_Legacy::XMLNS_XML]["id"])) return ""; + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; + $hasChild = (count(Helper::getChildren($id)) > 0); if ($open) { - $name = htmlspecialchars(PhDHelper::getDescription($id), ENT_QUOTES, 'UTF-8'); - $url = (PhDHelper::getFilename($id) ? PhDHelper::getFilename($id) : $id) . "." . $this->ext; + $name = htmlspecialchars(Helper::getDescription($id), ENT_QUOTES, 'UTF-8'); + $url = (Helper::getFilename($id) ? Helper::getFilename($id) : $id) . "." . $this->ext; fwrite($this->tocStream, " <tocsect2 name=\"{$name}\" url=\"{$url}\"/>\n"); } return ""; } public function format_refentry($open, $name, $attrs) { - if (!isset($attrs[PhDReader::XMLNS_XML]["id"])) return ""; - $id = $attrs[PhDReader::XMLNS_XML]["id"]; + if (!isset($attrs[Reader_Legacy::XMLNS_XML]["id"])) return ""; + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; if ($open) { $this->currentEntryName = null; } if (!$open && $this->currentEntryName) { - $url = (PhDHelper::getFilename($id) ? PhDHelper::getFilename($id) : $id) . "." . $this->ext; + $url = (Helper::getFilename($id) ? Helper::getFilename($id) : $id) . "." . $this->ext; $this->index[$this->currentEntryName] = $url; } return ""; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/PDF.php?r1=1.9&r2=1.10&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/PDF.php diff -u phd/phpdotnet/phd/Theme/PHP/PDF.php:1.9 phd/phpdotnet/phd/Theme/PHP/PDF.php:1.10 --- phd/phpdotnet/phd/Theme/PHP/PDF.php:1.9 Sat Jan 24 21:50:08 2009 +++ phd/phpdotnet/phd/Theme/PHP/PDF.php Fri Jun 19 21:48:54 2009 @@ -1,7 +1,9 @@ <?php -/* $Id: PDF.php,v 1.9 2009/01/24 21:50:08 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: PDF.php,v 1.10 2009/06/19 21:48:54 cweiske Exp $ */ -class phppdf extends PhDTheme { +class Theme_PHP_PDF extends Theme +{ protected $elementmap = array( 'article' => 'format_tocnode_newpage', @@ -104,7 +106,7 @@ parent::__construct($IDs); $this->format = $format; if (!class_exists("HaruDoc")) die ("PDF output needs libharu & haru/pecl extensions... Please install them and start PhD again.\n"); - $this->outputdir = PhDConfig::output_dir() . $this->format . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $this->format . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory.\n"); } @@ -129,12 +131,12 @@ v("PDF Compression failed, you need to compile libharu with Zlib...", E_USER_WARNING); } $this->format->setPdfDoc($pdfDoc); - if (isset($attrs[PhDReader::XMLNS_XML]["base"]) && $base = $attrs[PhDReader::XMLNS_XML]["base"]) + if (isset($attrs[Reader_Legacy::XMLNS_XML]["base"]) && $base = $attrs[Reader_Legacy::XMLNS_XML]["base"]) $this->format->setChunkInfo("xml-base", $base); - $id = $attrs[PhDReader::XMLNS_XML]["id"]; + $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; $this->cchunk["root-outline"] = $this->cchunk["id-to-outline"][$id] = - $pdfDoc->createOutline(PhDHelper::getDescription($id), null, true); + $pdfDoc->createOutline(Helper::getDescription($id), null, true); $this->setIdToPage($id); } else { $this->resolveLinks($this->cchunk["bookname"]); @@ -164,17 +166,17 @@ else $this->format->getPdfDoc()->add(PdfWriter::LINE_JUMP); - if (isset($attrs[PhDReader::XMLNS_XML]["base"]) && $base = $attrs[PhDReader::XMLNS_XML]["base"]) + if (isset($attrs[Reader_Legacy::XMLNS_XML]["base"]) && $base = $attrs[Reader_Legacy::XMLNS_XML]["base"]) $this->format->setChunkInfo("xml-base", $base); - if (isset($attrs[PhDReader::XMLNS_XML]["id"]) && $id = $attrs[PhDReader::XMLNS_XML]["id"]) { - $parentId = PhDHelper::getParent($id); + if (isset($attrs[Reader_Legacy::XMLNS_XML]["id"]) && $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]) { + $parentId = Helper::getParent($id); if (isset($this->cchunk["id-to-outline"][$parentId])) { $this->cchunk["id-to-outline"][$id] = $this->format->getPdfDoc()->createOutline - (PhDHelper::getDescription($id), $this->cchunk["id-to-outline"][$parentId], false); + (Helper::getDescription($id), $this->cchunk["id-to-outline"][$parentId], false); } else { $this->cchunk["id-to-outline"][$id] = $this->format->getPdfDoc()->createOutline - (PhDHelper::getDescription($id), $this->cchunk["root-outline"], false); + (Helper::getDescription($id), $this->cchunk["root-outline"], false); } $this->setIdToPage($id); } @@ -258,7 +260,7 @@ break; default: /* Check if its a classname. */ - $href = PhDTheme::getFilename("class.$t"); + $href = Theme::getFilename("class.$t"); } $this->format->getPdfDoc()->setFont(PdfWriter::FONT_NORMAL, 12, array(0, 0, 1)); // blue @@ -281,7 +283,7 @@ } public function format_collect_id($open, $name, $attrs, $props, $newpage = false) { - if ($open && isset($attrs[PhDReader::XMLNS_XML]["id"]) && $id = $attrs[PhDReader::XMLNS_XML]["id"]) { + if ($open && isset($attrs[Reader_Legacy::XMLNS_XML]["id"]) && $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]) { $this->setIdToPage($id); } return false; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/PHPDotNet.php?r1=1.69&r2=1.70&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/PHPDotNet.php diff -u phd/phpdotnet/phd/Theme/PHP/PHPDotNet.php:1.69 phd/phpdotnet/phd/Theme/PHP/PHPDotNet.php:1.70 --- phd/phpdotnet/phd/Theme/PHP/PHPDotNet.php:1.69 Thu Feb 26 08:18:56 2009 +++ phd/phpdotnet/phd/Theme/PHP/PHPDotNet.php Fri Jun 19 21:48:54 2009 @@ -1,7 +1,9 @@ <?php -/* $Id: PHPDotNet.php,v 1.69 2009/02/26 08:18:56 philip Exp $ */ +namespace phpdotnet\phd; +/* $Id: PHPDotNet.php,v 1.70 2009/06/19 21:48:54 cweiske Exp $ */ -abstract class phpdotnet extends PhDThemeXhtml { +abstract class Theme_PHP_PHPDotNet extends Theme_XHTML +{ protected $elementmap = array( 'acronym' => 'format_suppressed_tags', 'function' => 'format_suppressed_tags', @@ -242,9 +244,9 @@ $content = $fragment = ""; $class = $name; - if(isset($attrs[PhDReader::XMLNS_DOCBOOK]["linkend"])) { - $linkto = $attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]; - $id = $href = PhDHelper::getFilename($linkto); + if(isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]["linkend"])) { + $linkto = $attrs[Reader_Legacy::XMLNS_DOCBOOK]["linkend"]; + $id = $href = Helper::getFilename($linkto); if ($id != $linkto) { $fragment = "#$linkto"; @@ -252,8 +254,8 @@ if ($this->chunked) { $href .= ".".$this->ext; } - } elseif(isset($attrs[PhDReader::XMLNS_XLINK]["href"])) { - $href = $attrs[PhDReader::XMLNS_XLINK]["href"]; + } elseif(isset($attrs[Reader_Legacy::XMLNS_XLINK]["href"])) { + $href = $attrs[Reader_Legacy::XMLNS_XLINK]["href"]; $content = "&raquo; "; $class .= " external"; } @@ -268,7 +270,7 @@ $link .= $href; } } - return '<a href="' .$link. '" class="' .$class. '">' .($content.PhDHelper::getDescription($id, false)). '</a>'; + return '<a href="' .$link. '" class="' .$class. '">' .($content.Helper::getDescription($id, false)). '</a>'; } elseif ($props["empty"]) { if ($this->chunked) { $link = ""; @@ -296,9 +298,9 @@ public function format_fieldsynopsis_varname($open, $name, $attrs) { if ($open) { $href = ""; - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["linkend"])) { - $linkto = $attrs[PhDReader::XMLNS_DOCBOOK]["linkend"]; - $href = PhDHelper::getFilename($linkto); + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]["linkend"])) { + $linkto = $attrs[Reader_Legacy::XMLNS_DOCBOOK]["linkend"]; + $href = Helper::getFilename($linkto); if ($this->chunked) { if ($href != $linkto) { @@ -322,7 +324,7 @@ } return ' <var class="'.$name.'">'.$href.'$'; } - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["linkend"])) { + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]["linkend"])) { return '</a></var>'; } return '</var>'; @@ -389,8 +391,8 @@ return false; } public function format_chunk($open, $name, $attrs, $props) { - if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { - $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]["id"]; + if (isset($attrs[Reader_Legacy::XMLNS_XML]["id"])) { + $this->CURRENT_ID = $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; } if ($props["isChunk"]) { $this->cchunk = $this->dchunk; @@ -399,8 +401,8 @@ $this->lang = $props["lang"]; } if ($name == "refentry") { - if (isset($attrs[PhDReader::XMLNS_DOCBOOK]["role"])) { - $this->cchunk["verinfo"] = !($attrs[PhDReader::XMLNS_DOCBOOK]["role"] == "noversion"); + if (isset($attrs[Reader_Legacy::XMLNS_DOCBOOK]["role"])) { + $this->cchunk["verinfo"] = !($attrs[Reader_Legacy::XMLNS_DOCBOOK]["role"] == "noversion"); } else { $this->cchunk["verinfo"] = true; } @@ -425,22 +427,22 @@ } public function format_container_chunk($open, $name, $attrs, $props) { - $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]["id"]; + $this->CURRENT_ID = $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; if ($open) { if ($props["isChunk"]) { $this->cchunk = $this->dchunk; } if ($name != "reference") { - $chunks = PhDHelper::getChildren($id); + $chunks = Helper::getChildren($id); if (!count($chunks)) { return "<div>"; } $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_'.$name.'">'; foreach($chunks as $chunkid => $junk) { if ($this->chunked) { - $content .= '<li><a href="'.$chunkid. '.' .$this->ext. '">' .(PhDHelper::getDescription($chunkid, true)). '</a></li>'; + $content .= '<li><a href="'.$chunkid. '.' .$this->ext. '">' .(Helper::getDescription($chunkid, true)). '</a></li>'; } else { - $content .= '<li><a href="#'.$chunkid. '">' .(PhDHelper::getDescription($chunkid, true)). '</a></li>'; + $content .= '<li><a href="#'.$chunkid. '">' .(Helper::getDescription($chunkid, true)). '</a></li>'; } } $content .= "</ul>\n"; @@ -451,14 +453,14 @@ $content = ""; if ($name == "reference") { - $chunks = PhDHelper::getChildren($id); + $chunks = Helper::getChildren($id); if (count($chunks)) { $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_reference">'; foreach($chunks as $chunkid => $junk) { if ($this->chunked) { - $content .= '<li><a href="'.$chunkid. '.' .$this->ext. '">' .(PhDHelper::getDescription($chunkid, false)). '</a> — ' .(PhDHelper::getDescription($chunkid, true)). '</li>'; + $content .= '<li><a href="'.$chunkid. '.' .$this->ext. '">' .(Helper::getDescription($chunkid, false)). '</a> — ' .(Helper::getDescription($chunkid, true)). '</li>'; } else { - $content .= '<li><a href="#'.$chunkid.'">' .(PhDHelper::getDescription($chunkid, false)). '</a> — ' .(PhDHelper::getDescription($chunkid, true)). '</li>'; + $content .= '<li><a href="#'.$chunkid.'">' .(Helper::getDescription($chunkid, false)). '</a> — ' .(Helper::getDescription($chunkid, true)). '</li>'; } } $content .= "</ul>\n"; @@ -487,29 +489,29 @@ return "</h1>\n" .$ret; } public function format_root_chunk($open, $name, $attrs) { - $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]["id"]; + $this->CURRENT_ID = $id = $attrs[Reader_Legacy::XMLNS_XML]["id"]; if ($open) { return "<div>"; } - $chunks = PhDHelper::getChildren($id); + $chunks = Helper::getChildren($id); $content = '<ul class="chunklist chunklist_'.$name.'">'; foreach($chunks as $chunkid => $junk) { $href = $this->chunked ? $chunkid .'.'. $this->ext : "#$chunkid"; - $long = PhDHelper::getDescription($chunkid, true); - $short = PhDHelper::getDescription($chunkid, false); + $long = Helper::getDescription($chunkid, true); + $short = Helper::getDescription($chunkid, false); if ($long && $short && $long != $short) { $content .= '<li><a href="' .$href. '">' .$short. '</a> — ' .$long; } else { $content .= '<li><a href="' .$href. '">' .($long ? $long : $short). '</a>'; } - $children = PhDHelper::getChildren($chunkid); + $children = Helper::getChildren($chunkid); if (count($children)) { $content .= '<ul class="chunklist chunklist_'.$name.' chunklist_children">'; - foreach(PhDHelper::getChildren($chunkid) as $childid => $junk) { + foreach(Helper::getChildren($chunkid) as $childid => $junk) { $href = $this->chunked ? $childid .'.'. $this->ext : "#$childid"; - $long = PhDHelper::getDescription($childid, true); - $short = PhDHelper::getDescription($childid, false); + $long = Helper::getDescription($childid, true); + $short = Helper::getDescription($childid, false); if ($long && $short && $long != $short) { $content .= '<li><a href="' .$href. '">' .$short. '</a> — ' .$long. '</li>'; } else { @@ -546,7 +548,7 @@ $rel = $desc = ""; if ($this->format->role == "seealso") { $rel = ' rel="rdfs-seeAlso"'; - $desc = " - " . PhDHelper::getDescription($filename, true); + $desc = " - " . Helper::getDescription($filename, true); } if ($this->chunked) { @@ -615,7 +617,7 @@ break; default: /* Check if its a classname. */ - $href = PhDTheme::getFilename("class.$t"); + $href = Theme::getFilename("class.$t"); } if ($href && $this->chunked) { @@ -665,7 +667,7 @@ } public function format_qandaentry($open, $name, $attrs) { if ($open) { - $this->cchunk["qandaentry"][] = $attrs[PhDReader::XMLNS_XML]["id"]; + $this->cchunk["qandaentry"][] = $attrs[Reader_Legacy::XMLNS_XML]["id"]; return '<dl>'; } return '</dl>'; http://cvs.php.net/viewvc.cgi/phd/phpdotnet/phd/Theme/PHP/Web.php?r1=1.30&r2=1.31&diff_format=u Index: phd/phpdotnet/phd/Theme/PHP/Web.php diff -u phd/phpdotnet/phd/Theme/PHP/Web.php:1.30 phd/phpdotnet/phd/Theme/PHP/Web.php:1.31 --- phd/phpdotnet/phd/Theme/PHP/Web.php:1.30 Tue Feb 10 22:35:21 2009 +++ phd/phpdotnet/phd/Theme/PHP/Web.php Fri Jun 19 21:48:54 2009 @@ -1,8 +1,10 @@ <?php -/* $Id: Web.php,v 1.30 2009/02/10 22:35:21 cweiske Exp $ */ +namespace phpdotnet\phd; +/* $Id: Web.php,v 1.31 2009/06/19 21:48:54 cweiske Exp $ */ -require_once $ROOT . '/themes/php/phpdotnet.php'; -class phpweb extends phpdotnet { + +class Theme_PHP_Web extends Theme_PHP_PHPDotNet +{ protected $streams = array(); protected $writeit = false; public $outputdir = ''; @@ -10,7 +12,7 @@ public function __construct($IDs, $filename, $ext = "php", $chunked = true) { parent::__construct($IDs, $filename, $ext, $chunked); - $this->outputdir = PhDConfig::output_dir() . $this->ext . DIRECTORY_SEPARATOR; + $this->outputdir = Config::output_dir() . $this->ext . DIRECTORY_SEPARATOR; if (!file_exists($this->outputdir) || is_file($this->outputdir)) { mkdir($this->outputdir) or die("Can't create the cache directory"); } else { @@ -48,7 +50,7 @@ } public function appendData($data, $isChunk) { switch($isChunk) { - case PhDReader::CLOSE_CHUNK: + case Reader_Legacy::CLOSE_CHUNK: $id = $this->CURRENT_ID; $stream = array_pop($this->streams); @@ -60,7 +62,7 @@ return $retval; break; - case PhDReader::OPEN_CHUNK: + case Reader_Legacy::OPEN_CHUNK: $this->streams[] = fopen("php://temp/maxmemory", "r+"); default: @@ -71,14 +73,14 @@ } public function header($id) { $ext = '.' .$this->ext; - $parent = PhDHelper::getParent($id); + $parent = Helper::getParent($id); $filename = "toc" . DIRECTORY_SEPARATOR . $parent . ".inc"; $up = array(null, null); $incl = ''; $next = $prev = array(null, null); if ($parent && $parent != "ROOT") { - $siblings = PhDHelper::getChildren($parent); + $siblings = Helper::getChildren($parent); /* TODO: * Maybe this isn't worth it.. but this, in theory, allows you * to easily add new pages without needing to rebuild the entire @@ -93,8 +95,8 @@ $parents = array(); $p = $parent; - while (($p = PhDHelper::getParent($p)) && $p != "ROOT") { - $parents[] = array($p.$ext, PhDHelper::getDescription($p, true)); + while (($p = Helper::getParent($p)) && $p != "ROOT") { + $parents[] = array($p.$ext, Helper::getDescription($p, true)); } $content = '<?php @@ -107,7 +109,7 @@ } $incl = 'include_once dirname(__FILE__) ."/toc/' .$parent. '.inc";'; - $up = array($this->getFilename($parent).$ext, PhDHelper::getDescription($parent, true)); + $up = array($this->getFilename($parent).$ext, Helper::getDescription($parent, true)); $prev = $this->createPrev($id, $parent, $siblings); $next = $this->createNext($id, $parent, $siblings); @@ -116,7 +118,7 @@ $setup = array( "home" => array('index'.$ext, "PHP Manual"), "head" => array("UTF-8", $this->lang), - "this" => array($id.$ext, PhDHelper::getDescription($id)), + "this" => array($id.$ext, Helper::getDescription($id)), "up" => $up, "prev" => $prev, "next" => $next, @@ -166,7 +168,7 @@ break; } - return array(PhDHelper::getFilename($parent).$ext, PhDHelper::getDescription($parent, false)); + return array(Helper::getFilename($parent).$ext, Helper::getDescription($parent, false)); } protected function createNext($id, $parent, $siblings) { $ext = '.' .$this->ext; @@ -196,13 +198,13 @@ } // We are the end element in this chapter - $grandpa = PhDHelper::getParent($parent); + $grandpa = Helper::getParent($parent); if (!$grandpa || $grandpa == "ROOT") { // There is no next relative break; } - $siblings = PhDHelper::getChildren($grandpa); + $siblings = Helper::getChildren($grandpa); $id = $parent; $parent = $grandpa; } while(true); @@ -216,7 +218,7 @@ public function format_qandaset($open, $name, $attrs) { if ($open) { $this->cchunk["qandaentry"] = array(); - $this->appendData(null, PhDReader::OPEN_CHUNK); + $this->appendData(null, Reader_Legacy::OPEN_CHUNK); return ''; }
« previous php.doc.cvs (#4167) next »