svn: /phd/trunk/phpdotnet/phd/Package/PEAR/ Web.php

From: Date: Tue, 13 Oct 2009 18:24:29 +0000
Subject: svn: /phd/trunk/phpdotnet/phd/Package/PEAR/ Web.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-5141@lists.php.net to get a copy of this message
cweiske Tue, 13 Oct 2009 18:24:29 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=289618 Log: Part of pear bug #2390: link toc feeds from pearweb php files Bug: http://pear.php.net/bugs/2390 (unknown) Changed paths: U phd/trunk/phpdotnet/phd/Package/PEAR/Web.php Modified: phd/trunk/phpdotnet/phd/Package/PEAR/Web.php =================================================================== --- phd/trunk/phpdotnet/phd/Package/PEAR/Web.php 2009-10-13 17:14:55 UTC (rev 289617) +++ phd/trunk/phpdotnet/phd/Package/PEAR/Web.php 2009-10-13 18:24:29 UTC (rev 289618) @@ -2,14 +2,28 @@ namespace phpdotnet\phd; /* $Id$ */ -class Package_PEAR_Web extends Package_PEAR_ChunkedXHTML { - public function __construct() { +/** + * Renders the pear documentation visible on the PEAR website. + * + * @category PhD + * @package PhD_PEAR + * @author Christian Weiske <cweiske@php.net> + * @author Moacir de Oliveira Miranda Júnior <moacir@php.net> + * @author Rudy Nappée <loudi@php.net> + * @license http://www.opensource.org/licenses/bsd-license.php BSD Style + * @link http://doc.php.net/phd/ + */ +class Package_PEAR_Web extends Package_PEAR_ChunkedXHTML +{ + public function __construct() + { parent::__construct(); - $this->registerFormatName("PEAR-Web"); - $this->setExt("php"); + $this->registerFormatName('PEAR-Web'); + $this->setExt('php'); } - public function __destruct() { + public function __destruct() + { parent::close(); } @@ -22,11 +36,16 @@ */ public function header($id) { - $ext = "." . $this->ext; + $ext = '.' . $this->ext; $parent = Format::getParent($id); - if (!$parent || $parent == "ROOT") + //we link toc feeds + $extraHeader = <<<XML +<link rel="alternate" type="application/atom+xml" title="Live Bookmarks" href="feeds/{$id}.atom" /> +XML; + + if (!$parent || $parent == "ROOT") { return '<?php sendManualHeaders("UTF-8","en"); setupNavigation(array( @@ -36,9 +55,13 @@ "up" => array("#", ""), "toc" => array( array("#", "")))); -manualHeader("index.php", "'.addslashes($this->title).'"); +manualHeader("index.php"' + . ', ' . var_export($this->title, true) + . ', ' . var_export($extraHeader, true) + . '); ?> '; + } // Fetch the siblings information $toc = array(); @@ -46,15 +69,18 @@ $siblings = array(); foreach ($siblingIDs as $sid) { $siblings[$sid] = array( - "filename" => Format::getFilename($sid), - "parent" => Format::getParent($sid), - "sdesc" => Format::getShortDescription($sid), - "ldesc" => Format::getLongDescription($sid), - "children" => $this->createChildren($sid), + 'filename' => Format::getFilename($sid), + 'parent' => Format::getParent($sid), + 'sdesc' => Format::getShortDescription($sid), + 'ldesc' => Format::getLongDescription($sid), + 'children' => $this->createChildren($sid), ); } foreach ((array)$siblings as $sibling => $array) { - $toc[] = array($sibling.$ext, empty($array["sdesc"]) ? $array["ldesc"] : $array["sdesc"]); + $toc[] = array( + $sibling . $ext, + empty($array['sdesc']) ? $array['ldesc'] : $array['sdesc'] + ); } $prev = $next = array(null, null); @@ -75,15 +101,19 @@ 'home' => array('index' . $ext, $this->title), 'prev' => $prev, 'next' => $next, - 'up' => array($this->getFilename($parent).$ext, Format::getLongDescription($parent)), + 'up' => array( + $this->getFilename($parent) . $ext, + Format::getLongDescription($parent) + ), 'toc' => $toc ); return "<?php \n" . "sendManualHeaders(\"UTF-8\", \"{$this->lang}\");\n" . "setupNavigation(" . var_export($nav, true) . ");\n" . 'manualHeader("' - . $this->getFilename($id).$ext . '", ' - . var_export(Format::getLongDescription($id), true) + . $this->getFilename($id).$ext . '"' + . ', ' . var_export(Format::getLongDescription($id), true) + . ', ' . var_export($extraHeader, true) . ');' . "\n" . "?>\n"; }

« previous php.doc.cvs (#5141) next »