diff --git a/package.xml b/package.xml
index de14264d..85a290cd 100644
--- a/package.xml
+++ b/package.xml
@@ -122,17 +122,19 @@
+
+
-
+
diff --git a/phpdotnet/phd/ErrorHandler.php b/phpdotnet/phd/ErrorHandler.php
new file mode 100644
index 00000000..f59f7b39
--- /dev/null
+++ b/phpdotnet/phd/ErrorHandler.php
@@ -0,0 +1,72 @@
+ 'E_DEPRECATED ',
+ E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR ',
+ E_STRICT => 'E_STRICT ',
+ E_WARNING => 'E_WARNING ',
+ E_NOTICE => 'E_NOTICE ',
+
+ // User Triggered Errors
+ E_USER_ERROR => 'E_USER_ERROR ',
+ E_USER_WARNING => 'E_USER_WARNING ',
+ E_USER_NOTICE => 'E_USER_NOTICE ',
+ E_USER_DEPRECATED => 'E_USER_DEPRECATED ',
+ ];
+
+ private bool $recursive = false;
+
+ public function __construct(
+ private OutputHandler $outputHandler
+ ) {}
+
+ public function handleError($errno, $msg, $file, $line) {
+ // Respect the error_reporting setting
+ if (!(error_reporting() & $errno)) {
+ return false;
+ }
+
+ // Recursive protection
+ if ($this->recursive) {
+ // Thats bad.. lets print a backtrace right away
+ debug_print_backtrace();
+ // Fallback to the default errorhandler
+ return false;
+ }
+ $this->recursive = true;
+
+ switch($errno) {
+ // User triggered errors
+ case E_USER_ERROR:
+ case E_USER_WARNING:
+ case E_USER_NOTICE:
+ $this->outputHandler->printUserError($msg, $file, $line, self::ERROR_MAP[$errno]);
+ break;
+
+ // PHP triggered errors
+ case E_DEPRECATED:
+ case E_RECOVERABLE_ERROR:
+ case E_STRICT:
+ case E_WARNING:
+ case E_NOTICE:
+ $this->outputHandler->printPhpError($msg, $file, $line, self::ERROR_MAP[$errno]);
+ break;
+
+ default:
+ $this->recursive = false;
+ return false;
+ }
+
+ // Abort on fatal errors
+ if ($errno & (E_USER_ERROR|E_RECOVERABLE_ERROR)) {
+ exit(1);
+ }
+
+ $this->recursive = false;
+ return true;
+ }
+}
diff --git a/phpdotnet/phd/Format.php b/phpdotnet/phd/Format.php
index 215c932e..1375138f 100644
--- a/phpdotnet/phd/Format.php
+++ b/phpdotnet/phd/Format.php
@@ -22,6 +22,7 @@ abstract class Format extends ObjectStorage
const LDESC = 2;
protected Config $config;
+ protected OutputHandler $outputHandler;
private $elementmap = array();
private $textmap = array();
@@ -64,8 +65,9 @@ abstract class Format extends ObjectStorage
*/
protected $CURRENT_ID = "";
- public function __construct(Config $config) {
+ public function __construct(Config $config, OutputHandler $outputHandler) {
$this->config = $config;
+ $this->outputHandler = $outputHandler;
if ($this->config->indexcache()) {
$this->indexRepository = $this->config->indexcache();
if (!($this instanceof Index)) {
@@ -312,7 +314,7 @@ public function getFormatName() {
/* Buffer where append data instead of the standard stream (see format's appendData()) */
final public function parse($xml) {
- $reader = new Reader();
+ $reader = new Reader($this->outputHandler);
$render = new Render();
$reader->XML("" . $xml . "");
diff --git a/phpdotnet/phd/Format/Abstract/Manpage.php b/phpdotnet/phd/Format/Abstract/Manpage.php
index 9e940279..85c72725 100644
--- a/phpdotnet/phd/Format/Abstract/Manpage.php
+++ b/phpdotnet/phd/Format/Abstract/Manpage.php
@@ -4,8 +4,11 @@
abstract class Format_Abstract_Manpage extends Format {
public $role = false;
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler,
+ ) {
+ parent::__construct($config, $outputHandler);
}
public function UNDEF($open, $name, $attrs, $props) {
@@ -55,5 +58,3 @@ public function createLink($for, &$desc = null, $type = Format::SDESC) {
}
}
-
-
diff --git a/phpdotnet/phd/Format/Abstract/XHTML.php b/phpdotnet/phd/Format/Abstract/XHTML.php
index ef1cc3ac..d07f13ce 100644
--- a/phpdotnet/phd/Format/Abstract/XHTML.php
+++ b/phpdotnet/phd/Format/Abstract/XHTML.php
@@ -14,8 +14,11 @@ abstract class Format_Abstract_XHTML extends Format {
protected $mediamanager = null;
protected $lang = 'en';
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
}
public function transformFromMap($open, $tag, $name, $attrs, $props) {
diff --git a/phpdotnet/phd/Index.php b/phpdotnet/phd/Index.php
index 620da3c4..39deaca6 100644
--- a/phpdotnet/phd/Index.php
+++ b/phpdotnet/phd/Index.php
@@ -107,10 +107,11 @@ class Index extends Format
public function __construct(
IndexRepository $indexRepository,
- Config $config
+ Config $config,
+ OutputHandler $outputHandler
) {
$this->indexRepository = $indexRepository;
- parent::__construct($config);
+ parent::__construct($config, $outputHandler);
}
public function transformFromMap($open, $tag, $name, $attrs, $props) {
diff --git a/phpdotnet/phd/Options/Handler.php b/phpdotnet/phd/Options/Handler.php
index 6f7e2bc3..48bf0d0c 100644
--- a/phpdotnet/phd/Options/Handler.php
+++ b/phpdotnet/phd/Options/Handler.php
@@ -5,7 +5,8 @@ class Options_Handler implements Options_Interface
{
public function __construct(
private Config $config,
- private Format_Factory $formatFactory
+ private Format_Factory $formatFactory,
+ private OutputHandler $outputHandler
) {}
/**
@@ -211,11 +212,11 @@ public function option_output(string $k, mixed $v): array
trigger_error("Only a single output location can be supplied", E_USER_ERROR);
}
if (!file_exists($v)) {
- v("Creating output directory..", VERBOSE_MESSAGES);
+ $this->outputHandler->v("Creating output directory..", VERBOSE_MESSAGES);
if (!mkdir($v, 0777, true)) {
trigger_error(vsprintf("Can't create output directory : %s", [$v]), E_USER_ERROR);
}
- v("Output directory created", VERBOSE_MESSAGES);
+ $this->outputHandler->v("Output directory created", VERBOSE_MESSAGES);
} elseif (!is_dir($v)) {
trigger_error("Output directory is a file?", E_USER_ERROR);
}
@@ -510,17 +511,14 @@ public function option_xinclude(string $k, mixed $v): array
*/
public function option_version(string $k, mixed $v): never
{
- $color = $this->config->phd_info_color();
- $output = $this->config->phd_info_output();
- fprintf($output, "%s\n", term_color('PhD Version: ' . $this->config::VERSION, $color));
-
+ $this->outputHandler->printPhdInfo('PhD Version: ' . $this->config::VERSION);
$packageList = $this->config->getSupportedPackages();
foreach ($packageList as $package) {
$version = $this->formatFactory::createFactory($package)->getPackageVersion();
- fprintf($output, "\t%s: %s\n", term_color($package, $color), term_color($version, $color));
+ $this->outputHandler->printPhdInfo("\t$package: $version");
}
- fprintf($output, "%s\n", term_color('PHP Version: ' . phpversion(), $color));
- fprintf($output, "%s\n", term_color($this->config->copyright(), $color));
+ $this->outputHandler->printPhdInfo('PHP Version: ' . phpversion());
+ $this->outputHandler->printPhdInfo($this->config->copyright());
exit(0);
}
diff --git a/phpdotnet/phd/OutputHandler.php b/phpdotnet/phd/OutputHandler.php
new file mode 100644
index 00000000..0f623076
--- /dev/null
+++ b/phpdotnet/phd/OutputHandler.php
@@ -0,0 +1,117 @@
+ 'Indexing ',
+ VERBOSE_FORMAT_RENDERING => 'Rendering Format ',
+ VERBOSE_THEME_RENDERING => 'Rendering Theme ',
+ VERBOSE_RENDER_STYLE => 'Rendering Style ',
+ VERBOSE_PARTIAL_READING => 'Partial Reading ',
+ VERBOSE_PARTIAL_CHILD_READING => 'Partial Child Reading ',
+ VERBOSE_TOC_WRITING => 'Writing TOC ',
+ VERBOSE_CHUNK_WRITING => 'Writing Chunk ',
+ VERBOSE_MESSAGES => 'Heads up ',
+
+ // PhD warnings
+ VERBOSE_NOVERSION => 'No version information',
+ VERBOSE_BROKEN_LINKS => 'Broken links ',
+ VERBOSE_OLD_LIBXML => 'Old libxml2 ',
+ VERBOSE_MISSING_ATTRIBUTES => 'Missing attributes ',
+ ];
+
+ public function __construct(
+ private Config $config
+ ) {}
+
+ /**
+ * Method to get a color escape sequence
+ */
+ private function term_color(string $text, string|false $color): string {
+ return $this->config->color_output() && $color !== false ? "\033[" . $color . "m" . $text . "\033[m" : $text;
+ }
+
+ public function printPhdInfo(string $msg, string $info = ""): int {
+ $color = $this->config->phd_info_color();
+ $outputStream = $this->config->phd_info_output();
+
+ return $this->print($msg, $outputStream, $color, $info);
+ }
+
+ private function printPhdWarning(string $msg, string $warning = ""): int {
+ $color = $this->config->phd_warning_color();
+ $outputStream = $this->config->phd_warning_output();
+
+ return $this->print($msg, $outputStream, $color, $warning);
+ }
+
+ public function printUserError(string $msg, string $file, int $line, string $error = ""): int {
+ $color = $this->config->user_error_color();
+ $outputStream = $this->config->user_error_output();
+ $data = \sprintf("%s:%d\n\t%s", $file, $line, $msg);
+
+ return $this->print($data, $outputStream, $color, $error);
+ }
+
+ public function printPhpError(string $msg, string $file, int $line, string $error = ""): int {
+ $color = $this->config->php_error_color();
+ $outputStream = $this->config->php_error_output();
+ $data = \sprintf("%s:%d\n\t%s", $file, $line, $msg);
+
+ return $this->print($data, $outputStream, $color, $error);
+ }
+
+ private function print(string $msg, $outputStream, string|false $color = false, string $infoOrErrorString = ""): int {
+ if ($infoOrErrorString === "") {
+ $colorMsg = $this->term_color(\sprintf("%s", $msg), $color);
+
+ return \fprintf($outputStream, "%s\n", $colorMsg);
+ }
+
+ $time = \date($this->config->date_format());
+ $timestamp = $this->term_color(\sprintf("[%s - %s]", $time, $infoOrErrorString), $color);
+
+ return \fprintf($outputStream, "%s %s\n", $timestamp, $msg);
+ }
+
+ /**
+ * Print info messages: v("printf-format-text" [, $arg1, ...], $verbose-level)
+ */
+ public function v(...$args): bool {
+ $messageCategory = \array_pop($args);
+ $msg = \vsprintf(\array_shift($args), $args);
+
+ // Respect the error_reporting setting
+ if (!(\error_reporting() & $messageCategory)) {
+ return false;
+ }
+
+ switch($messageCategory) {
+ case VERBOSE_INDEXING:
+ case VERBOSE_FORMAT_RENDERING:
+ case VERBOSE_THEME_RENDERING:
+ case VERBOSE_RENDER_STYLE:
+ case VERBOSE_PARTIAL_READING:
+ case VERBOSE_PARTIAL_CHILD_READING:
+ case VERBOSE_TOC_WRITING:
+ case VERBOSE_CHUNK_WRITING:
+ case VERBOSE_MESSAGES:
+ $this->printPhdInfo($msg, self::CONSTANT_TO_MESSAGE_CATEGORY_MAP[$messageCategory]);
+ break;
+
+ case VERBOSE_NOVERSION:
+ case VERBOSE_BROKEN_LINKS:
+ case VERBOSE_OLD_LIBXML:
+ case VERBOSE_MISSING_ATTRIBUTES:
+ $this->printPhdWarning($msg, self::CONSTANT_TO_MESSAGE_CATEGORY_MAP[$messageCategory]);
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/phpdotnet/phd/Package/Generic/BigXHTML.php b/phpdotnet/phd/Package/Generic/BigXHTML.php
index 5bbaf627..f58447b4 100644
--- a/phpdotnet/phd/Package/Generic/BigXHTML.php
+++ b/phpdotnet/phd/Package/Generic/BigXHTML.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_Generic_BigXHTML extends Package_Generic_XHTML {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("Big-XHTML");
$this->setTitle("Index");
$this->setChunked(false);
@@ -94,7 +97,7 @@ public function update($event, $value = null) {
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -113,5 +116,3 @@ public function createLink($for, &$desc = null, $type = self::SDESC) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/Generic/ChunkedXHTML.php b/phpdotnet/phd/Package/Generic/ChunkedXHTML.php
index a07fd12d..d0da3395 100644
--- a/phpdotnet/phd/Package/Generic/ChunkedXHTML.php
+++ b/phpdotnet/phd/Package/Generic/ChunkedXHTML.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_Generic_ChunkedXHTML extends Package_Generic_XHTML {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("Chunked-XHTML");
$this->setTitle("Index");
$this->setChunked(true);
@@ -86,7 +89,7 @@ public function update($event, $value = null) {
}
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -207,5 +210,3 @@ protected function createNavBar($id) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/Generic/Manpage.php b/phpdotnet/phd/Package/Generic/Manpage.php
index 04621192..be5c3d21 100644
--- a/phpdotnet/phd/Package/Generic/Manpage.php
+++ b/phpdotnet/phd/Package/Generic/Manpage.php
@@ -256,8 +256,11 @@ class Package_Generic_Manpage extends Format_Abstract_Manpage {
"firstrefname" => true,
);
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("Generic Unix Manual Pages");
$this->setExt($this->config->ext() === null ? ".3.gz" : $this->config->ext());
@@ -321,7 +324,7 @@ public function update($event, $value = null) {
}
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -354,7 +357,7 @@ public function writeChunk($stream) {
gzwrite($gzfile, $this->header($index));
gzwrite($gzfile, stream_get_contents($stream));
gzclose($gzfile);
- v("Wrote %s", $this->getOutputDir() . $filename, VERBOSE_CHUNK_WRITING);
+ $this->outputHandler->v("Wrote %s", $this->getOutputDir() . $filename, VERBOSE_CHUNK_WRITING);
/* methods/functions with the same name */
while(isset($this->cchunk["funcname"][++$index])) {
@@ -370,7 +373,7 @@ public function writeChunk($stream) {
gzwrite($gzfile, $content);
gzclose($gzfile);
- v("Wrote %s", $this->getOutputDir() . $filename, VERBOSE_CHUNK_WRITING);
+ $this->outputHandler->v("Wrote %s", $this->getOutputDir() . $filename, VERBOSE_CHUNK_WRITING);
}
}
@@ -788,5 +791,3 @@ public function format_pubdate_text($value, $tag) {
return false;
}
}
-
-
diff --git a/phpdotnet/phd/Package/Generic/PDF.php b/phpdotnet/phd/Package/Generic/PDF.php
index a829b104..bf58aa06 100644
--- a/phpdotnet/phd/Package/Generic/PDF.php
+++ b/phpdotnet/phd/Package/Generic/PDF.php
@@ -296,8 +296,11 @@ abstract class Package_Generic_PDF extends Format_Abstract_PDF {
"callouts" => 0,
);
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->setExt($this->config->ext() === null ? ".pdf" : $this->config->ext());
$this->pdfDoc = new PdfWriter();
}
@@ -1138,5 +1141,3 @@ public function format_imagedata($open, $name, $attrs, $props) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/Generic/TocFeed.php b/phpdotnet/phd/Package/Generic/TocFeed.php
index c987672e..3165f934 100644
--- a/phpdotnet/phd/Package/Generic/TocFeed.php
+++ b/phpdotnet/phd/Package/Generic/TocFeed.php
@@ -131,9 +131,11 @@ abstract class Package_Generic_TocFeed extends Format
/**
* Creates a new instance.
*/
- public function __construct(Config $config)
- {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName($this->formatName);
$this->setTitle('Index');
$this->setChunked(true);
@@ -232,7 +234,7 @@ public function update($event, $value = null)
break;
case Render::VERBOSE:
- v(
+ $this->outputHandler->v(
'Starting %s rendering',
$this->getFormatName(), VERBOSE_FORMAT_RENDERING
);
@@ -524,5 +526,3 @@ public function createTargetLink($id)
}
}
-
-
diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php
index 0cf6e97e..2268fecb 100644
--- a/phpdotnet/phd/Package/Generic/XHTML.php
+++ b/phpdotnet/phd/Package/Generic/XHTML.php
@@ -537,8 +537,11 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
protected int $exampleCounter = 0;
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerPIHandlers($this->pihandlers);
$this->setExt($this->config->ext() === null ? ".html" : $this->config->ext());
}
@@ -1891,10 +1894,10 @@ public function format_imagedata($open, $name, $attrs) {
// Generate warnings when only 1 dimension supplied or alt is not supplied.
if (!$width xor !$height) {
- v('Missing %s attribute for %s', (!$width ? 'width' : 'height'), $file, VERBOSE_MISSING_ATTRIBUTES);
+ $this->outputHandler->v('Missing %s attribute for %s', (!$width ? 'width' : 'height'), $file, VERBOSE_MISSING_ATTRIBUTES);
}
if (false === $this->cchunk["mediaobject"]["alt"]) {
- v('Missing alt attribute for %s', $file, VERBOSE_MISSING_ATTRIBUTES);
+ $this->outputHandler->v('Missing alt attribute for %s', $file, VERBOSE_MISSING_ATTRIBUTES);
}
return '
';
diff --git a/phpdotnet/phd/Package/IDE/Base.php b/phpdotnet/phd/Package/IDE/Base.php
index 7a4ad17f..211eb893 100644
--- a/phpdotnet/phd/Package/IDE/Base.php
+++ b/phpdotnet/phd/Package/IDE/Base.php
@@ -76,8 +76,11 @@ abstract class Package_IDE_Base extends Format {
'seealso' => array(),
);
- public function __construct(Config $config){
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
}
public function createLink($for, &$desc = null, $type = Format::SDESC) {}
@@ -139,7 +142,7 @@ public function FINALIZE($value) {
}
public function VERBOSE($value) {
- v('Starting %s rendering', $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v('Starting %s rendering', $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
}
public function update($event, $value = null) {
@@ -199,7 +202,7 @@ public function versionInfo($funcname) {
if(isset($this->versions[$funcname])) {
return $this->versions[$funcname];
}
- v('No version info for %s', $funcname, VERBOSE_NOVERSION);
+ $this->outputHandler->v('No version info for %s', $funcname, VERBOSE_NOVERSION);
return false;
}
@@ -458,5 +461,3 @@ public function toValidName($functionName) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/IDE/Funclist.php b/phpdotnet/phd/Package/IDE/Funclist.php
index f6f938f3..9022f821 100644
--- a/phpdotnet/phd/Package/IDE/Funclist.php
+++ b/phpdotnet/phd/Package/IDE/Funclist.php
@@ -14,8 +14,11 @@ class Package_IDE_Funclist extends Format {
protected $isRefname = false;
protected $buffer = "";
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("IDE-Funclist");
$this->setExt($this->config->ext() === null ? ".txt" : $this->config->ext());
}
@@ -43,7 +46,7 @@ public function update($event, $value = null) {
file_put_contents($filename, $this->buffer);
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -68,5 +71,3 @@ public function format_refname_text($value, $tag) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/IDE/JSON.php b/phpdotnet/phd/Package/IDE/JSON.php
index 66c0d6e4..a01f9efb 100644
--- a/phpdotnet/phd/Package/IDE/JSON.php
+++ b/phpdotnet/phd/Package/IDE/JSON.php
@@ -3,8 +3,11 @@
class Package_IDE_JSON extends Package_IDE_Base {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName('IDE-JSON');
$this->setExt($this->config->ext() === null ? ".json" : $this->config->ext());
}
@@ -14,5 +17,3 @@ public function parseFunction() {
}
}
-
-
diff --git a/phpdotnet/phd/Package/IDE/PHP.php b/phpdotnet/phd/Package/IDE/PHP.php
index fbf86da9..c309956a 100644
--- a/phpdotnet/phd/Package/IDE/PHP.php
+++ b/phpdotnet/phd/Package/IDE/PHP.php
@@ -3,8 +3,11 @@
class Package_IDE_PHP extends Package_IDE_Base {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName('IDE-PHP');
$this->setExt($this->config->ext() === null ? ".php" : $this->config->ext());
}
@@ -17,5 +20,3 @@ public function parseFunction() {
}
}
-
-
diff --git a/phpdotnet/phd/Package/IDE/PHPStub.php b/phpdotnet/phd/Package/IDE/PHPStub.php
index 172e1a9c..14180613 100644
--- a/phpdotnet/phd/Package/IDE/PHPStub.php
+++ b/phpdotnet/phd/Package/IDE/PHPStub.php
@@ -1,9 +1,13 @@
registerFormatName('IDE-PHPStub');
$this->setExt($this->config->ext() === null ? ".php" : $this->config->ext());
}
@@ -81,5 +85,3 @@ private function renderParamBody() {
return implode(", ", $result);
}
}
-
-
diff --git a/phpdotnet/phd/Package/IDE/SQLite.php b/phpdotnet/phd/Package/IDE/SQLite.php
index 964f242f..3a4e6645 100644
--- a/phpdotnet/phd/Package/IDE/SQLite.php
+++ b/phpdotnet/phd/Package/IDE/SQLite.php
@@ -6,8 +6,11 @@ class Package_IDE_SQLite extends Package_IDE_Base {
private $sql = array();
private $db = null;
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName('IDE-SQLite');
$this->setExt($this->config->ext() === null ? ".sqlite" : $this->config->ext());
}
@@ -148,5 +151,3 @@ function_name TEXT,
}
}
-
-
diff --git a/phpdotnet/phd/Package/IDE/XML.php b/phpdotnet/phd/Package/IDE/XML.php
index 4801b565..badc04c7 100644
--- a/phpdotnet/phd/Package/IDE/XML.php
+++ b/phpdotnet/phd/Package/IDE/XML.php
@@ -3,8 +3,11 @@
class Package_IDE_XML extends Package_IDE_Base {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName('IDE-XML');
$this->setExt($this->config->ext() === null ? ".xml" : $this->config->ext());
}
@@ -86,5 +89,3 @@ protected function cdata_str($data) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/PEAR/BigXHTML.php b/phpdotnet/phd/Package/PEAR/BigXHTML.php
index c5052d90..ed413497 100755
--- a/phpdotnet/phd/Package/PEAR/BigXHTML.php
+++ b/phpdotnet/phd/Package/PEAR/BigXHTML.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_PEAR_BigXHTML extends Package_PEAR_XHTML {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PEAR-BigXHTML");
$this->setTitle("PEAR Manual");
$this->setExt($this->config->ext() === null ? ".html" : $this->config->ext());
@@ -102,7 +105,7 @@ public function update($event, $value = null) {
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -120,6 +123,3 @@ public function createLink($for, &$desc = null, $type = self::SDESC) {
return $retval;
}
}
-
-
-
diff --git a/phpdotnet/phd/Package/PEAR/CHM.php b/phpdotnet/phd/Package/PEAR/CHM.php
index 489662d1..8a924f68 100755
--- a/phpdotnet/phd/Package/PEAR/CHM.php
+++ b/phpdotnet/phd/Package/PEAR/CHM.php
@@ -194,8 +194,11 @@ class Package_PEAR_CHM extends Package_PEAR_ChunkedXHTML {
// Project files Output directory
protected $chmdir;
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PEAR-CHM");
}
@@ -424,5 +427,3 @@ public function format_link($open, $name, $attrs, $props) {
return $link;
}
}
-
-
diff --git a/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php b/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php
index 85774aa3..39a247a8 100755
--- a/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php
+++ b/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_PEAR_ChunkedXHTML extends Package_PEAR_XHTML {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PEAR-Chunked-XHTML");
$this->setTitle("PEAR Manual");
$this->setExt($this->config->ext() === null ? ".html" : $this->config->ext());
@@ -84,7 +87,7 @@ public function update($event, $value = null) {
}
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -200,5 +203,3 @@ public function footer($id) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/PEAR/TocFeed.php b/phpdotnet/phd/Package/PEAR/TocFeed.php
index 34362d8c..9039e806 100644
--- a/phpdotnet/phd/Package/PEAR/TocFeed.php
+++ b/phpdotnet/phd/Package/PEAR/TocFeed.php
@@ -84,9 +84,11 @@ class Package_PEAR_TocFeed extends Package_Generic_TocFeed
/**
* Create new instance.
*/
- public function __construct(Config $config)
- {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$language = $this->config->language();
$variables = array('targetBaseUri', 'feedBaseUri', 'idprefix');
diff --git a/phpdotnet/phd/Package/PEAR/Web.php b/phpdotnet/phd/Package/PEAR/Web.php
index e8508891..b366c400 100755
--- a/phpdotnet/phd/Package/PEAR/Web.php
+++ b/phpdotnet/phd/Package/PEAR/Web.php
@@ -14,9 +14,11 @@
*/
class Package_PEAR_Web extends Package_PEAR_ChunkedXHTML
{
- public function __construct(Config $config)
- {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName('PEAR-Web');
$this->setExt($this->config->ext() === null ? '.php' : $this->config->ext());
}
@@ -132,5 +134,3 @@ public function footer($id)
}
}
-
-
diff --git a/phpdotnet/phd/Package/PEAR/XHTML.php b/phpdotnet/phd/Package/PEAR/XHTML.php
index 5cdd5990..b7fd627b 100755
--- a/phpdotnet/phd/Package/PEAR/XHTML.php
+++ b/phpdotnet/phd/Package/PEAR/XHTML.php
@@ -405,8 +405,11 @@ abstract class Package_PEAR_XHTML extends Package_Generic_XHTML {
/**
* Constructor
*/
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->myelementmap = array_merge(parent::getDefaultElementMap(), $this->getDefaultElementMap());
$this->mytextmap = array_merge(parent::getDefaultTextMap(), $this->getDefaultTextMap());
$this->dchunk = array_merge(parent::getDefaultChunkInfo(), $this->getDefaultChunkInfo());
@@ -1129,5 +1132,3 @@ public function format_div($open, $name, $attrs, $props)
return '';
}
}
-
-
diff --git a/phpdotnet/phd/Package/PHP/BigPDF.php b/phpdotnet/phd/Package/PHP/BigPDF.php
index 2b13be8e..4e7e0561 100644
--- a/phpdotnet/phd/Package/PHP/BigPDF.php
+++ b/phpdotnet/phd/Package/PHP/BigPDF.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_PHP_BigPDF extends Package_PHP_PDF {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PHP-BigPDF");
}
@@ -21,7 +24,7 @@ public function update($event, $value = null) {
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -50,7 +53,7 @@ public function format_root_set($open, $name, $attrs, $props) {
} else {
$this->resolveLinks($this->cchunk["setname"]);
$pdfDoc = parent::getPdfDoc();
- v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING);
+ $this->outputHandler->v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING);
$filename = $this->getOutputDir();
if ($this->config->output_filename()) {
@@ -73,5 +76,3 @@ public function format_book($open, $name, $attrs, $props) {
return $this->format_tocnode_newpage($open, $name, $attrs, $props);
}
}
-
-
diff --git a/phpdotnet/phd/Package/PHP/BigXHTML.php b/phpdotnet/phd/Package/PHP/BigXHTML.php
index 7fe771b6..d0380b98 100644
--- a/phpdotnet/phd/Package/PHP/BigXHTML.php
+++ b/phpdotnet/phd/Package/PHP/BigXHTML.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_PHP_BigXHTML extends Package_PHP_XHTML {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PHP-BigXHTML");
$this->setTitle("PHP Manual");
$this->setChunked(false);
@@ -98,7 +101,7 @@ public function update($event, $value = null) {
break;
case Render::VERBOSE:
- v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
+ $this->outputHandler->v("Starting %s rendering", $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
break;
}
}
@@ -117,5 +120,3 @@ public function createLink($for, &$desc = null, $type = self::SDESC) {
}
}
-
-
diff --git a/phpdotnet/phd/Package/PHP/CHM.php b/phpdotnet/phd/Package/PHP/CHM.php
index ebe64ab2..5fbef332 100644
--- a/phpdotnet/phd/Package/PHP/CHM.php
+++ b/phpdotnet/phd/Package/PHP/CHM.php
@@ -202,8 +202,11 @@ class Package_PHP_CHM extends Package_PHP_ChunkedXHTML
// Project files Output directory
protected $chmdir;
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PHP-CHM");
}
@@ -446,5 +449,3 @@ public function format_link($open, $name, $attrs, $props) {
return $link;
}
}
-
-
diff --git a/phpdotnet/phd/Package/PHP/ChunkedXHTML.php b/phpdotnet/phd/Package/PHP/ChunkedXHTML.php
index 5fecfea7..8e134363 100644
--- a/phpdotnet/phd/Package/PHP/ChunkedXHTML.php
+++ b/phpdotnet/phd/Package/PHP/ChunkedXHTML.php
@@ -2,8 +2,11 @@
namespace phpdotnet\phd;
class Package_PHP_ChunkedXHTML extends Package_PHP_Web {
- public function __construct(Config $config) {
- parent::__construct($config);
+ public function __construct(
+ Config $config,
+ OutputHandler $outputHandler
+ ) {
+ parent::__construct($config, $outputHandler);
$this->registerFormatName("PHP-Chunked-XHTML");
$this->setExt($this->config->ext() === null ? ".html" : $this->config->ext());
}
@@ -81,5 +84,3 @@ public function footer($id)
return '