Last In First Out stack of roles */ private array $role = []; /** @var array Last In First Out stack of annotations */ private array $annotations = []; /* XHTMLPhDFormat */ protected $openPara = 0; protected $escapedPara = array(); /* PhDThemeXhtml */ protected $mediamanager = null; protected $lang = 'en'; public function __construct( Config $config, OutputHandler $outputHandler ) { parent::__construct($config, $outputHandler); } public function transformFromMap($open, $tag, $name, $attrs, $props) { if ($open) { $idstr = ""; if (isset($attrs[Reader::XMLNS_XML]["id"])) { $id = $attrs[Reader::XMLNS_XML]["id"]; $idstr = ' id="' .$id. '"'; } return '<' .$tag. ' class="' .$name. '"' . $idstr . ($props["empty"] ? '/' : "") . '>'; } return '' .$tag. '>'; } public function TEXT($value) { return htmlspecialchars($value, ENT_QUOTES, "UTF-8"); } public function UNDEF($open, $name, $attrs, $props) { if ($open) { trigger_error("No mapper found for '{$name}'", E_USER_WARNING); } } public function CDATA($value) { $annotations = $this->getAnnotations(); $annotationsStr = ''; if (count($annotations) > 0) { $annotationsStr = 'annotation-' . join(' annotation-', $annotations) . ' '; } switch($this->getRole()) { case '': return '
'
. htmlspecialchars($value, ENT_QUOTES, "UTF-8")
. ''; } else { --$this->escapedPara[$this->openPara]; return ''; } } protected function pushRole(?string $role): void { $this->role[] = $role; } protected function getRole(): ?string { return end($this->role); } protected function popRole(): ?string { return array_pop($this->role); } protected function pushAnnotations(?string $annotations): void { $this->annotations[] = ($annotations != null ? explode(' ', $annotations) : []); } protected function getAnnotations() : ?array { $top = end($this->annotations); if ($top === false) { $top = []; } return $top; } protected function popAnnotations() : ?array { return array_pop($this->annotations); } }