mirror of
https://github.com/php/phd.git
synced 2026-03-23 22:52:05 +01:00
Remove some dead code (#163)
This commit is contained in:
@@ -173,7 +173,7 @@ class Config
|
||||
self::$optionArray['color_output'] = $color_output;
|
||||
}
|
||||
|
||||
public static function set_color_output($color_output)
|
||||
public static function set_color_output()
|
||||
{
|
||||
trigger_error('Use setColor_output()', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,6 @@ abstract class Format extends ObjectStorage
|
||||
|
||||
/* Buffer where append data instead of the standard stream (see format's appendData()) */
|
||||
final public function parse($xml) {
|
||||
$parsed = "";
|
||||
$reader = new Reader();
|
||||
$render = new Render();
|
||||
|
||||
@@ -468,7 +467,7 @@ abstract class Format extends ObjectStorage
|
||||
}
|
||||
public function getEntryOffset(array $attrs) {
|
||||
$curr = $this->TABLE["next_colnum"];
|
||||
foreach($this->TABLE["colspec"] as $col => $spec) {
|
||||
foreach($this->TABLE["colspec"] as $spec) {
|
||||
if ($spec["colname"] == $attrs["colname"]) {
|
||||
$colnum = $spec["colnum"];
|
||||
$this->TABLE["next_colnum"] += $colnum-$curr;
|
||||
@@ -479,7 +478,7 @@ abstract class Format extends ObjectStorage
|
||||
}
|
||||
public function colspan(array $attrs) {
|
||||
if (isset($attrs["namest"])) {
|
||||
foreach($this->TABLE["colspec"] as $colnum => $spec) {
|
||||
foreach($this->TABLE["colspec"] as $spec) {
|
||||
if ($spec["colname"] == $attrs["namest"]) {
|
||||
$from = $spec["colnum"];
|
||||
continue;
|
||||
|
||||
@@ -79,7 +79,6 @@ class PdfWriter {
|
||||
const LINE_SPACING = 2; // nb of points between two lines
|
||||
const INDENT_SPACING = 10; // nb of points for indent
|
||||
const DEFAULT_SHIFT = 20; // default value (points) for shifted paragraph
|
||||
private $SCALE; // nb of points for 1 centimeter
|
||||
private $PAGE_WIDTH; // in points
|
||||
private $PAGE_HEIGHT; // in points
|
||||
|
||||
@@ -94,7 +93,6 @@ class PdfWriter {
|
||||
private $currentFontColor;
|
||||
private $fonts;
|
||||
private $oldFonts = array();
|
||||
private $text;
|
||||
|
||||
private $vOffset = 0;
|
||||
private $hOffset = 0;
|
||||
@@ -142,9 +140,9 @@ class PdfWriter {
|
||||
$this->haruDoc->setPagesConfiguration(2);
|
||||
|
||||
// Page format
|
||||
$this->SCALE = 72/25.4;
|
||||
$this->PAGE_WIDTH = $pageWidth * $this->SCALE;
|
||||
$this->PAGE_HEIGHT = $pageHeight * $this->SCALE;
|
||||
$scale = 72/25.4;
|
||||
$this->PAGE_WIDTH = $pageWidth * $scale;
|
||||
$this->PAGE_HEIGHT = $pageHeight * $scale;
|
||||
|
||||
// Set fonts
|
||||
$this->fonts["Helvetica"] = $this->haruDoc->getFont("Helvetica", "WinAnsiEncoding");
|
||||
|
||||
@@ -343,7 +343,7 @@ class Index extends Format
|
||||
return false;
|
||||
}
|
||||
if (array_pop($this->isChunk)) {
|
||||
$lastchunk = array_pop($this->chunks);
|
||||
array_pop($this->chunks);
|
||||
$this->currentchunk = end($this->chunks);
|
||||
$this->appendID();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class MediaManager
|
||||
);
|
||||
|
||||
$foundfile = false;
|
||||
foreach($sourcefilenames as $pathoffset => $filenameinfo) {
|
||||
foreach($sourcefilenames as $filenameinfo) {
|
||||
// Look for current language specific file.
|
||||
if (file_exists($testingfile = $this->relative_source_path . $filenameinfo[0] . $filenameinfo[1])) {
|
||||
$foundfile = $testingfile;
|
||||
|
||||
@@ -74,7 +74,7 @@ class Options_Handler implements Options_Interface
|
||||
public function option_format(string $k, mixed $v): array
|
||||
{
|
||||
$formats = [];
|
||||
foreach((array)$v as $i => $val) {
|
||||
foreach((array)$v as $val) {
|
||||
if (!in_array($val, $formats)) {
|
||||
$formats[] = $val;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class Options_Handler implements Options_Interface
|
||||
public function option_skip(string $k, mixed $v): array
|
||||
{
|
||||
$skip_ids = $this->config->skip_ids();
|
||||
foreach((array)$v as $i => $val) {
|
||||
foreach((array)$v as $val) {
|
||||
$recursive = true;
|
||||
if (strpos($val, "=") !== false) {
|
||||
list($val, $recursive) = explode("=", $val);
|
||||
@@ -370,7 +370,7 @@ class Options_Handler implements Options_Interface
|
||||
{
|
||||
static $verbose = 0;
|
||||
|
||||
foreach((array)$v as $i => $val) {
|
||||
foreach((array)$v as $val) {
|
||||
foreach(explode("|", $val) as $const) {
|
||||
if (defined($const)) {
|
||||
$verbose |= (int)constant($const);
|
||||
@@ -452,7 +452,7 @@ class Options_Handler implements Options_Interface
|
||||
public function option_css(string $k, mixed $v): array
|
||||
{
|
||||
$styles = [];
|
||||
foreach((array)$v as $key => $val) {
|
||||
foreach((array)$v as $val) {
|
||||
if (!in_array($val, $styles)) {
|
||||
$styles[] = $val;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ class Options_Handler implements Options_Interface
|
||||
public function option_packagedir(string $k, mixed $v): array
|
||||
{
|
||||
$packages = $this->config->package_dirs();
|
||||
foreach((array)$v as $key => $val) {
|
||||
foreach((array)$v as $val) {
|
||||
if ($path = realpath($val)) {
|
||||
if (!in_array($path, $packages)) {
|
||||
$packages[] = $path;
|
||||
|
||||
@@ -26,7 +26,6 @@ class PI_PHPDOCHandler extends PIHandler {
|
||||
case "function":
|
||||
case "refentry":
|
||||
$tmp = $this->format->getRefs();
|
||||
$ret = "";
|
||||
$refs = array();
|
||||
$info = array();
|
||||
foreach($tmp as $id) {
|
||||
|
||||
@@ -771,7 +771,6 @@ abstract class Package_Generic_PDF extends Format_Abstract_PDF {
|
||||
if ($open) {
|
||||
$dbattrs = Format::getColspec($attrs[Reader::XMLNS_DOCBOOK]);
|
||||
$align = (isset($dbattrs["align"]) ? $dbattrs["align"] : $align);
|
||||
$retval = "";
|
||||
if (isset($dbattrs["colname"])) {
|
||||
for($i=Format::getEntryOffset($dbattrs); $i>0; --$i) {
|
||||
$this->pdfDoc->add(PdfWriter::TABLE_ENTRY, array(1, 1, $align));
|
||||
@@ -995,7 +994,6 @@ abstract class Package_Generic_PDF extends Format_Abstract_PDF {
|
||||
public function format_footnoteref($open, $name, $attrs, $props) {
|
||||
if ($open) {
|
||||
$linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"];
|
||||
$found = false;
|
||||
foreach($this->cchunk["footnote"] as $k => $note) {
|
||||
if ($note["id"] === $linkend) {
|
||||
$this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0,0,1));
|
||||
@@ -1031,7 +1029,7 @@ abstract class Package_Generic_PDF extends Format_Abstract_PDF {
|
||||
}
|
||||
|
||||
public function format_co($open, $name, $attrs, $props) {
|
||||
if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"]) && $id = $attrs[Reader::XMLNS_XML]["id"]) {
|
||||
if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"]) && $attrs[Reader::XMLNS_XML]["id"]) {
|
||||
$co = ++$this->cchunk["co"];
|
||||
$this->pdfDoc->setFont(PdfWriter::FONT_NORMAL, 12, array(0,0,1));
|
||||
if (isset($attrs[Reader::XMLNS_DOCBOOK]["linkends"]) && $linkends = $attrs[Reader::XMLNS_DOCBOOK]["linkends"]) {
|
||||
|
||||
@@ -357,7 +357,7 @@ abstract class Package_Generic_TocFeed extends Format
|
||||
|
||||
$toc = '';
|
||||
$date = $this->date;
|
||||
foreach ($chunks as $junk => $chunkid) {
|
||||
foreach ($chunks as $chunkid) {
|
||||
$long = $this->getLongDescription($chunkid);
|
||||
$short = $this->getShortDescription($chunkid);
|
||||
$id = $this->idprefix . $chunkid;
|
||||
|
||||
@@ -676,7 +676,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
|
||||
}
|
||||
|
||||
public function format_link($open, $name, $attrs, $props) {
|
||||
$link = null;
|
||||
if ($open) {
|
||||
$link = $class = $content = "";
|
||||
|
||||
@@ -855,7 +854,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
|
||||
}
|
||||
|
||||
$toc = '<ol>';
|
||||
$desc = "";
|
||||
if (!in_array($id, $this->TOC_WRITTEN ?? [])) {
|
||||
$toc = $this->createTOC($id, $name, $props);
|
||||
}
|
||||
@@ -1419,7 +1417,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
|
||||
public function format_footnoteref($open, $name, $attrs, $props) {
|
||||
if ($open) {
|
||||
$linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"];
|
||||
$found = false;
|
||||
foreach($this->cchunk["footnote"] as $k => $note) {
|
||||
if ($note["id"] === $linkend) {
|
||||
return '<a href="#fnid' .$note["id"]. '"><sup>[' .($k + 1). ']</sup></a>';
|
||||
|
||||
@@ -100,7 +100,6 @@ class Package_PEAR_ChunkedXHTML extends Package_PEAR_XHTML {
|
||||
*/
|
||||
public function header($id) {
|
||||
$title = $this->getShortDescription($id);
|
||||
$lang = $this->config->language();
|
||||
static $cssLinks = null;
|
||||
if ($cssLinks === null) {
|
||||
$cssLinks = $this->createCSSLinks();
|
||||
|
||||
@@ -124,7 +124,6 @@ manualHeader("index.php"'
|
||||
public function footer($id)
|
||||
{
|
||||
$ext = $this->ext;
|
||||
$parent = Format::getParent($id);
|
||||
|
||||
return '<?php manualFooter("'
|
||||
. $this->getFilename($id) . $ext . '", '
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
namespace phpdotnet\phd;
|
||||
|
||||
class Package_PHP_ChunkedXHTML extends Package_PHP_Web {
|
||||
private $nav = "";
|
||||
|
||||
public function __construct(Config $config) {
|
||||
parent::__construct($config);
|
||||
$this->registerFormatName("PHP-Chunked-XHTML");
|
||||
@@ -30,7 +28,6 @@ class Package_PHP_ChunkedXHTML extends Package_PHP_Web {
|
||||
</head>
|
||||
<body class="docs">
|
||||
HEADER;
|
||||
$next = $prev = $up = array("href" => null, "desc" => null);
|
||||
$nextLink = $prevLink = $upLink = '';
|
||||
if ($prevId = Format::getPrevious($id)) {
|
||||
$prev = array(
|
||||
|
||||
@@ -40,7 +40,6 @@ class Package_PHP_HowTo extends Package_PHP_Web {
|
||||
$parent = Format::getParent($id);
|
||||
$next = $prev = $up = array(null, null);
|
||||
if ($parent && $parent != "ROOT") {
|
||||
$siblings = Format::getChildren($parent);
|
||||
if ($nextId = Format::getNext($id)) {
|
||||
$next = array(
|
||||
Format::getFilename($nextId) . $this->getExt(),
|
||||
|
||||
@@ -139,7 +139,6 @@ class Package_PHP_KDevelop extends Format {
|
||||
public function format_tocsect2($open, $name, $attrs) {
|
||||
if (!isset($attrs[Reader::XMLNS_XML]["id"])) return "";
|
||||
$id = $attrs[Reader::XMLNS_XML]["id"];
|
||||
$hasChild = (count(Format::getChildren($id)) > 0);
|
||||
if ($open) {
|
||||
$name = htmlspecialchars(Format::getShortDescription($id), ENT_QUOTES, 'UTF-8');
|
||||
$url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt();
|
||||
|
||||
@@ -73,7 +73,7 @@ class Package_PHP_Manpage extends Package_Generic_Manpage {
|
||||
public function format_chunk($open, $name, $attrs, $props) {
|
||||
return parent::format_chunk($open, $name, $attrs, $props);
|
||||
}
|
||||
public function format_class_title_text($value, $tag) {
|
||||
public function format_class_title_text($value) {
|
||||
$this->cchunk["funcname"][] = $this->toValidName(trim($value));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,6 @@ class Package_PHP_PDF extends Package_Generic_PDF {
|
||||
|
||||
);
|
||||
|
||||
private $acronyms = array();
|
||||
|
||||
/* Common properties for all functions pages */
|
||||
protected $bookName = "";
|
||||
|
||||
@@ -253,10 +251,9 @@ class Package_PHP_PDF extends Package_Generic_PDF {
|
||||
}
|
||||
}
|
||||
|
||||
public function format_type_text($type, $tagname) {
|
||||
public function format_type_text($type) {
|
||||
$type = trim(preg_replace('/[ \n\t]+/', ' ', $type));
|
||||
$t = strtolower($type);
|
||||
$href = $fragment = "";
|
||||
|
||||
switch($t) {
|
||||
case "bool":
|
||||
@@ -284,7 +281,6 @@ class Package_PHP_PDF extends Package_Generic_PDF {
|
||||
break;
|
||||
case "mixed":
|
||||
$href = "language.types.declarations";
|
||||
$fragment = "language.types.declarations.$t";
|
||||
break;
|
||||
default:
|
||||
/* Check if its a classname. */
|
||||
@@ -304,15 +300,15 @@ class Package_PHP_PDF extends Package_Generic_PDF {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function format_type_if_object_or_pseudo_text($type, $tagname) {
|
||||
public function format_type_if_object_or_pseudo_text($type) {
|
||||
if (in_array(strtolower($type), array("bool", "int", "double", "boolean", "integer", "float", "string", "array", "object", "resource", "null"))) {
|
||||
parent::getPdfDoc()->appendText(" " . $type);
|
||||
return false;
|
||||
}
|
||||
return self::format_type_text($type, $tagname);
|
||||
return self::format_type_text($type);
|
||||
}
|
||||
|
||||
public function format_collect_id($open, $name, $attrs, $props, $newpage = false) {
|
||||
public function format_collect_id($open, $name, $attrs) {
|
||||
if ($open && isset($attrs[Reader::XMLNS_XML]["id"]) && $id = $attrs[Reader::XMLNS_XML]["id"]) {
|
||||
$this->setIdToPage($id);
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML {
|
||||
|
||||
public function format_type_text($type, $tagname) {
|
||||
$t = strtr(strtolower($type), ["_" => "-", "\\" => "-"]);
|
||||
$href = $fragment = "";
|
||||
$fragment = "";
|
||||
|
||||
switch($t) {
|
||||
case "void":
|
||||
|
||||
@@ -48,7 +48,7 @@ class Render extends ObjectStorage
|
||||
$lastdepth = -1;
|
||||
while($r->read()) {
|
||||
$type = $r->nodeType;
|
||||
$data = $retval = $name = $open = false;
|
||||
$open = false;
|
||||
|
||||
switch($type) {
|
||||
case \XMLReader::ELEMENT: /* {{{ */
|
||||
|
||||
@@ -56,7 +56,7 @@ function term_color($text, $color)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ The PhD errorhandler */
|
||||
function errh($errno, $msg, $file, $line, $ctx = null) {
|
||||
function errh($errno, $msg, $file, $line) {
|
||||
static $err = array(
|
||||
// PHP Triggered Errors
|
||||
E_DEPRECATED => 'E_DEPRECATED ',
|
||||
|
||||
Reference in New Issue
Block a user