';
+ return '
';
}
- array_pop($this->role);
+ $this->popRole();
return "
\n";
}
@@ -1495,13 +1491,13 @@ public function format_step($open, $name, $attrs) {
public function format_variablelist($open, $name, $attrs, $props) {
if ($open) {
if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
- $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"];
+ $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"]);
}
$classStr = $headerStr = $idStr = '';
if (isset($attrs[Reader::XMLNS_XML]["id"])) {
$idStr = ' id="' . $attrs[Reader::XMLNS_XML]["id"] . '"';
}
- if (end($this->role) === 'constant_list') {
+ if ($this->getRole() === 'constant_list') {
$tagName = 'table';
$classStr = ' class="doctable table"';
$headerStr = "\n" . $this->indent($props["depth"] + 1) . "
\n"
@@ -1515,8 +1511,8 @@ public function format_variablelist($open, $name, $attrs, $props) {
}
return '<' . $tagName . $idStr . $classStr . '>' . $headerStr;
}
- $tagName = (end($this->role) === 'constant_list') ? 'table' : 'dl';
- array_pop($this->role);
+ $tagName = ($this->getRole() === 'constant_list') ? 'table' : 'dl';
+ $this->popRole();
return "" . $tagName . ">";
}
public function format_varlistentry($open, $name, $attrs) {
@@ -1526,12 +1522,12 @@ public function format_varlistentry($open, $name, $attrs) {
} else {
unset($this->cchunk['varlistentry']['id']);
}
- return (end($this->role) === 'constant_list') ? '
' : '';
+ return ($this->getRole() === 'constant_list') ? '
' : '';
}
- return (end($this->role) === 'constant_list') ? '
' : '';
+ return ($this->getRole() === 'constant_list') ? '' : '';
}
public function format_varlistentry_term($open, $name, $attrs, $props) {
- $tagName = (end($this->role) === 'constant_list') ? 'td' : 'dt';
+ $tagName = ($this->getRole() === 'constant_list') ? 'td' : 'dt';
if ($open) {
if (isset($this->cchunk['varlistentry']['id'])) {
$id = $this->cchunk['varlistentry']['id'];
@@ -1544,7 +1540,7 @@ public function format_varlistentry_term($open, $name, $attrs, $props) {
return "" . $tagName . ">";
}
public function format_varlistentry_listitem($open, $name, $attrs) {
- $tagName = (end($this->role) === 'constant_list') ? 'td' : 'dd';
+ $tagName = ($this->getRole() === 'constant_list') ? 'td' : 'dd';
if ($open) {
return "<" . $tagName . ">";
}
@@ -1591,15 +1587,10 @@ public function format_example_content($open, $name, $attrs) {
}
public function format_programlisting($open, $name, $attrs) {
if ($open) {
- if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) {
- $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]["role"];
- } else {
- $this->role[] = null;
- }
-
+ $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"] ?? null);
return '
';
}
- array_pop($this->role);
+ $this->popRole();
return "
\n";
}
public function format_programlisting_text($value, $tag) {
@@ -1690,9 +1681,9 @@ public function format_table_title($open, $name, $attrs, $props)
}
public function format_variablelist_title($open, $name, $attrs, $props) {
if ($open) {
- return (end($this->role) === 'constant_list') ? "
" : "";
+ return ($this->getRole() === 'constant_list') ? "" : "";
}
- return (end($this->role) === 'constant_list') ? "" : "";
+ return ($this->getRole() === 'constant_list') ? "" : "";
}
public function format_mediaobject($open, $name, $attrs) {
diff --git a/phpdotnet/phd/Package/PEAR/XHTML.php b/phpdotnet/phd/Package/PEAR/XHTML.php
index 0616fa93..fdfef226 100755
--- a/phpdotnet/phd/Package/PEAR/XHTML.php
+++ b/phpdotnet/phd/Package/PEAR/XHTML.php
@@ -683,16 +683,12 @@ public function format_programlisting($open, $name, $attrs)
{
if ($open) {
$this->trim = true;
- if (isset($attrs[Reader::XMLNS_DOCBOOK]['role'])) {
- $this->role[] = $attrs[Reader::XMLNS_DOCBOOK]['role'];
- } else {
- $this->role[] = '';
- }
+ $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]['role'] ?? '');
- return '
getRole() ? $this->getRole() . 'code' : 'programlisting')
. '">';
}
- array_pop($this->role);
+ $this->popRole();
$this->trim = false;
return '
';
@@ -710,7 +706,7 @@ public function format_programlisting($open, $name, $attrs)
*/
public function format_programlisting_text($value, $tag)
{
- switch(end($this->role)) {
+ switch($this->getRole()) {
case 'php':
if (strrpos($value, '')) {
return $this->highlight(trim($value), 'php', 'xhtml');
@@ -719,7 +715,7 @@ public function format_programlisting_text($value, $tag)
}
break;
default:
- return $this->highlight(trim($value), end($this->role), 'xhtml');
+ return $this->highlight(trim($value), $this->getRole(), 'xhtml');
}
}
@@ -760,26 +756,26 @@ public function CDATA($str)
if ($this->trim) {
$str = rtrim($str);
}
- if (!end($this->role)) {
+ if (!$this->getRole()) {
return str_replace(
array("\n", ' '), array('
', ' '),
htmlspecialchars($str, ENT_QUOTES, 'UTF-8')
);
}
- switch (end($this->role)) {
+ switch ($this->getRole()) {
case 'php':
if (strrpos($str, '')) {
- $str = $this->highlight(trim($str), end($this->role), 'xhtml');
+ $str = $this->highlight(trim($str), $this->getRole(), 'xhtml');
} else {
- $str = $this->highlight("", end($this->role), 'xhtml');
+ $str = $this->highlight("", $this->getRole(), 'xhtml');
}
break;
case '':
$str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
break;
default:
- $str = $this->highlight($str, end($this->role), 'xhtml');
+ $str = $this->highlight($str, $this->getRole(), 'xhtml');
break;
}
diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php
index 5d3c7257..6e4ba5a4 100644
--- a/phpdotnet/phd/Package/PHP/XHTML.php
+++ b/phpdotnet/phd/Package/PHP/XHTML.php
@@ -843,7 +843,7 @@ public function format_function_text($value, $tag, $display_value = null) {
if ($filename !== null) {
if ($this->CURRENT_ID !== $filename) {
$rel = $desc = "";
- if (end($this->role) == "seealso") {
+ if ($this->getRole() === "seealso") {
$rel = ' rel="rdfs-seeAlso"';
$desc = " - " . Format::getLongDescription($filename);
}