cvs: phd(PHD_0_4) /themes/pear pearchunkedhtml.php peartheme.php pearweb.php

From: Date: Sun, 19 Oct 2008 13:55:05 +0000
Subject: cvs: phd(PHD_0_4) /themes/pear pearchunkedhtml.php peartheme.php pearweb.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2256@lists.php.net to get a copy of this message
bjori Sun Oct 19 13:55:05 2008 UTC Modified files: (Branch: PHD_0_4) /phd/themes/pear pearchunkedhtml.php peartheme.php pearweb.php Log: MFH: Bunch of fixes and WS changes by Christian

http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearchunkedhtml.php?r1=1.5.2.2&r2=1.5.2.2.2.1&diff_format=u Index: phd/themes/pear/pearchunkedhtml.php diff -u phd/themes/pear/pearchunkedhtml.php:1.5.2.2 phd/themes/pear/pearchunkedhtml.php:1.5.2.2.2.1 --- phd/themes/pear/pearchunkedhtml.php:1.5.2.2 Thu Oct 16 15:43:46 2008 +++ phd/themes/pear/pearchunkedhtml.php Sun Oct 19 13:55:05 2008 @@ -1,33 +1,63 @@ <?php - require_once $ROOT . '/themes/pear/pearweb.php'; -class pearchunkedhtml extends pearweb { + +/** +* PEAR theme for the normal-html-in-many-files version +* +* @package PhD +* @version CVS: $Id: pearchunkedhtml.php,v 1.5.2.2.2.1 2008/10/19 13:55:05 bjori Exp $ +*/ +class pearchunkedhtml extends pearweb +{ private $nav = ""; - public function __construct(array $IDs, $ext = "html") { + public function __construct(array $IDs, $ext = "html") + { parent::__construct($IDs, $ext, true); $this->outputdir = $GLOBALS['OPTIONS']['output_dir'] . $this->ext . DIRECTORY_SEPARATOR; - if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); - elseif (file_exists($this->outputdir . 'index.html')) unlink($this->outputdir . 'index.html'); // preserve back-compat + if (!file_exists($this->outputdir) || is_file($this->outputdir)) { + mkdir($this->outputdir) or die("Can't create the cache directory"); + } else if (file_exists($this->outputdir . 'index.html')) { + unlink($this->outputdir . 'index.html'); // preserve back-compat + } } - public function header($id) { + + + + /** + * Generates the header HTML for the given ID. + * Full doctype, html head, begin of body tag and top navigation. + * + * @param string $id Page ID + * + * @return string Header HTML + */ + public function header($id) + { $title = PhDHelper::getDescription($id, true); $parent = PhDHelper::getParent($id); $this->next = $this->prev = $this->up = array(null, null); - if ($parent && $parent != "ROOT") { - $siblings = PhDHelper::getChildren($parent); - $this->prev = pearweb::createPrev($id, $parent, $siblings); - if ($this->prev[0] == 'index') { + $strNext = $strPrev = ''; + + if ($parent) { + if ($parent !== 'ROOT') { + $siblings = PhDHelper::getChildren($parent); + } else { + $siblings = array($id => PhDHelper::getSelf($id)); + } + $this->prev = parent::createPrev($id, $parent, $siblings); + if ($this->prev[0] === 'index') { $this->prev = array(null, null); } - $this->next = pearweb::createNext($id, $parent, $siblings); - if ($this->next[0] == 'index') { + $this->next = parent::createNext($id, $parent, $siblings); + if ($this->next[0] === 'index') { $this->next = array(null, null); } - if ($parent != 'index') { + if ($parent !== 'index' && $parent !== 'ROOT') { $this->up = array($parent.".html", PhDHelper::getDescription($parent, false)); } } + $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> @@ -36,26 +66,33 @@ <meta name="generator" content="PhD" /> <link rel="start" href="index.html" title="PEAR Manual" /> '; - if ($this->up[0]) - $header .= ' <link rel="up" href="'.$this->up[0].'" title="'.$this->up[1].'" /> + if ($this->up[0]) { + $header .= ' <link rel="up" href="'.$this->up[0].'" title="'.$this->up[1].'" /> '; - if ($this->prev[0]) - $header .= ' <link rel="prev" href="'.$this->prev[0].'" title="'.$this->prev[1].'" /> + } + if ($this->prev[0]) { + $strPrev = '<a href="' . $this->prev[0] . '">Prev</a>'; + $header .= ' <link rel="prev" href="' . $this->prev[0] . '" title="' . $this->prev[1] . '" /> '; - if ($this->next[0]) - $header .= ' <link rel="next" href="'.$this->next[0].'" title="'.$this->next[1].'" /> + } + if ($this->next[0]) { + $strNext = '<a href="' . $this->next[0] . '">Next</a>'; + $header .= ' <link rel="next" href="' . $this->next[0] . '" title="' . $this->next[1] . '" /> '; -$header .= ' </head> + } + + $header .= ' </head> <body> '; + $nav = <<<NAV <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">{$title}</th></tr> <tr> - <td width="40%" align="left"><a href="{$this->prev[0]}">Prev</a></td> + <td width="40%" align="left">{$strPrev}</td> <td width="20%"></td> - <td width="40%" align="right"><a href="{$this->next[0]}">Next</a></td> + <td width="40%" align="right">{$strNext}</td> </tr> </table> <hr/> @@ -66,20 +103,41 @@ return $header; } - public function footer($id) { - //FIXME: don't print empty links + + + /** + * Create the footer HTML for the given page id and return it. + * + * @param string $id Page ID + * + * @return string Footer HTML + */ + public function footer($id) + { + $strPrev = $strNext = $strUp = ''; + if ($this->up[0]) { + $strUp = '<a accesskey="h" href="' . $this->up[0] . '">' . $this->up[1] . '</a>'; + } + if ($this->prev[0]) { + $strPrev = '<a accesskey="p" href="' . $this->prev[0] . '">Prev</a>'; + } + if ($this->next[0]) { + $strNext = '<a accesskey="n" href="' . $this->next[0] . '">Next</a>'; + } + $strHome = $id !== 'index' ? '<a accesskey="h" href="index.html">PEAR Manual</a>' : ''; + $nav = <<<NAV <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> - <td width="40%" align="left"><a accesskey="p" href="{$this->prev[0]}">Prev</a></td> - <td width="20%" align="center"><a accesskey="h" href="{$this->up[0]}">{$this->up[1]}</a></td> - <td width="40%" align="right"><a accesskey="n" href="{$this->next[0]}">Next</a></td> + <td width="40%" align="left">{$strPrev}</td> + <td width="20%" align="center">{$strUp}</td> + <td width="40%" align="right">{$strNext}</td> </tr> <tr> <td width="40%" align="left" valign="top">{$this->prev[1]}</td> - <td width="20%" align="center"><a accesskey="h" href="index.html">PEAR Manual</a></td> + <td width="20%" align="center">{$strHome}</td> <td width="40%" align="right" valign="top">{$this->next[1]}</td> </tr> </table> @@ -88,9 +146,16 @@ NAV; return "</div>\n$nav</body></html>\n"; } - public function __destruct() { - if (file_exists($this->outputdir . "guide.html") && !file_exists($this->outputdir . 'index.html')) { + + + + public function __destruct() + { + if (file_exists($this->outputdir . "guide.html") + && !file_exists($this->outputdir . 'index.html') + ) { copy($this->outputdir . "guide.html", $this->outputdir . "index.html"); } } + } http://cvs.php.net/viewvc.cgi/phd/themes/pear/peartheme.php?r1=1.8.2.2&r2=1.8.2.2.2.1&diff_format=u Index: phd/themes/pear/peartheme.php diff -u phd/themes/pear/peartheme.php:1.8.2.2 phd/themes/pear/peartheme.php:1.8.2.2.2.1 --- phd/themes/pear/peartheme.php:1.8.2.2 Thu Oct 16 15:43:46 2008 +++ phd/themes/pear/peartheme.php Sun Oct 19 13:55:05 2008 @@ -6,7 +6,10 @@ 'article' => 'format_container_chunk', 'answer' => 'format_answer', 'appendix' => 'format_container_chunk', - 'author' => 'format_suppressed_tags', + 'author' => array( + /* DEFAULT */ 'format_editedby', + 'authorgroup' => 'format_suppressed_tags', + ), 'authorgroup' => 'format_editedby', 'bibliography' => array( /* DEFAULT */ false, @@ -122,7 +125,7 @@ 'warning' => 'format_warning_para', ), 'subtitle' => 'format_subtitle', - 'surname' => 'format_suppressed_tags', + 'surname' => 'format_surname', 'synopsis' => 'format_programlisting', 'table' => 'format_table', 'title' => array( @@ -481,6 +484,11 @@ return ""; } + public function format_surname($open, $name, $attrs) { + /* Add a space before it, so firstname and surname are separated */ + return ' '; + } + public function format_subtitle($open, $name, $attrs) { if ($open) return '<p><font color="red">'; http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearweb.php?r1=1.1.6.2&r2=1.1.6.2.2.1&diff_format=u Index: phd/themes/pear/pearweb.php diff -u phd/themes/pear/pearweb.php:1.1.6.2 phd/themes/pear/pearweb.php:1.1.6.2.2.1 --- phd/themes/pear/pearweb.php:1.1.6.2 Thu Oct 16 15:43:46 2008 +++ phd/themes/pear/pearweb.php Sun Oct 19 13:55:05 2008 @@ -68,9 +68,9 @@ public function header($id) { $ext = "." . $this->ext; $parent = PhDHelper::getParent($id); - + if (!$parent || $parent == "ROOT") - return '<?php + return '<?php sendManualHeaders("UTF-8","en"); setupNavigation(array( "home" => array("index.php", "PEAR Manual"), @@ -82,14 +82,14 @@ manualHeader("PEAR Manual","index.php"); ?> '; - + // Fetch the siblings information $toc = array(); $siblings = PhDHelper::getChildren($parent); foreach($siblings as $sibling => $array) { $toc[] = array($sibling.$ext, empty($array["sdesc"]) ? $array["ldesc"] : $array["sdesc"]); } - + // Build the PEAR navigation table $nav = array( 'home' => array('index' . $ext, 'PEAR Manual'), @@ -104,22 +104,22 @@ 'manualHeader("' . $this->getFilename($id).$ext . '", "' . PhDHelper::getDescription($id, true) . '");' . "\n" . "?>\n"; } - + public function footer($id) { $ext = $this->ext . "."; $parent = PhDHelper::getParent($id); - + return '<?php manualFooter("' . $this->getFilename($id).$ext . '", "' . PhDHelper::getDescription($id, true) . '"); ?>\n'; } - + protected function createPrev($id, $parent, $siblings) { - $ext = '.' .$this->ext; - if (!isset($siblings[$id])) { + if (!isset($siblings[$id]) || $parent == 'ROOT') { return array(null, null); } + $ext = '.' .$this->ext; // Seek to $id - while(list($tmp,) = each($siblings)) { + while (list($tmp,) = each($siblings)) { if ($tmp == $id) { // Set the internal pointer back to $id prev($siblings); @@ -182,7 +182,7 @@ copy($this->outputdir . "guide.php", $this->outputdir . "index.php"); } } - + public function format_qandaset($open, $name, $attrs) { if ($open) { $this->cchunk["qandaentry"] = array(); @@ -194,5 +194,5 @@ rewind($stream); return parent::qandaset($stream); } - + }
« previous php.doc.cvs (#2256) next »