예제 #1
0
파일: Index.php 프로젝트: philip/phd
 public function format_sdesc($open, $name, $attrs, $props)
 {
     if ($open) {
         $s = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT, "UTF-8");
         if (empty($this->nfo[$this->currentid]["sdesc"])) {
             /* FIXME: How can I mark that node with "reparse" flag? */
             $this->nfo[$this->currentid]["sdesc"] = $s;
         } else {
             if (!is_array($this->nfo[$this->currentid]["sdesc"])) {
                 $this->nfo[$this->currentid]["sdesc"] = (array) $this->nfo[$this->currentid]["sdesc"];
             }
             //In the beginning of the array to stay compatible with 0.4
             array_unshift($this->nfo[$this->currentid]["sdesc"], $s);
         }
     }
 }
예제 #2
0
 public function format_entry($open, $name, $attrs, $props)
 {
     if ($open) {
         if ($this->inChangelog) {
             /* FIXME: How can I mark that node with "reparse" flag? */
             $this->currentChangelog[] = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT, "UTF-8");
         }
     }
 }
예제 #3
0
파일: XHTML.php 프로젝트: philip/phd
 public function format_qandaset($open, $name, $attrs, $props)
 {
     if ($open) {
         $node = ReaderKeeper::getReader()->expand();
         $doc = new \DOMDocument();
         $doc->appendChild($node);
         $xp = new \DOMXPath($doc);
         $xp->registerNamespace("db", Reader::XMLNS_DOCBOOK);
         $questions = $xp->query("//db:qandaentry/db:question");
         $retval = '<div class="qandaset"><ol class="qandaset_questions">';
         foreach ($questions as $node) {
             $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) {
                 $id = uniqid("phd");
             }
             $retval .= '<li><a href="#' . $id . '">' . htmlentities($node->textContent, ENT_QUOTES, "UTF-8") . '</a></li>';
         }
         $retval .= "</ol></div>";
         return $retval;
     }
 }
예제 #4
0
파일: Base.php 프로젝트: TazeTSchnitzel/phd
 public function format_changelog_entry($open, $name, $attrs, $props)
 {
     if ($this->isChangelogRow && $open) {
         $entryType = $this->cchunk['changelog']['entry'] == 'version' ? 'change' : 'version';
         $this->cchunk['changelog'][$entryType] = trim(ReaderKeeper::getReader()->readString());
         $this->cchunk['changelog']['entry'] = $entryType;
     }
 }