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

From: Date: Wed, 14 Oct 2009 17:35:16 +0000
Subject: svn: /phd/trunk/phpdotnet/phd/Package/PEAR/ Web.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-5145@lists.php.net to get a copy of this message
cweiske Wed, 14 Oct 2009 17:35:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=289633 Log: link live bookmarks only when there are actually children entries 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-14 17:34:01 UTC (rev 289632) +++ phd/trunk/phpdotnet/phd/Package/PEAR/Web.php 2009-10-14 17:35:16 UTC (rev 289633) @@ -40,12 +40,17 @@ $parent = Format::getParent($id); - //we link toc feeds - $extraHeader = <<<XML -<link rel="alternate" type="application/atom+xml" title="Live Bookmarks" href="feeds/{$id}.atom" /> + //we link toc feeds if there are children + if (count($this->getChildren($id)) > 0) { + $extraHeader = <<<XML + <link rel="alternate" type="application/atom+xml" title="Live Bookmarks" href="feeds/{$id}.atom" /> + XML; + } else { + $extraHeader = ''; + } - if (!$parent || $parent == "ROOT") { + if (!$parent || $parent == 'ROOT') { return '<?php sendManualHeaders("UTF-8","en"); setupNavigation(array( @@ -63,25 +68,16 @@ '; } - // Fetch the siblings information - $toc = array(); + $toc = array(); $siblingIDs = Format::getChildren($parent); - $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), + $sdesc = Format::getShortDescription($sid); + $ldesc = Format::getLongDescription($sid); + $toc[] = array( + $sid . $ext, + empty($sdesc) ? $ldesc : $sdesc ); } - foreach ((array)$siblings as $sibling => $array) { - $toc[] = array( - $sibling . $ext, - empty($array['sdesc']) ? $array['ldesc'] : $array['sdesc'] - ); - } $prev = $next = array(null, null); if ($prevID = Format::getPrevious($id)) { @@ -138,20 +134,6 @@ . '); ?>'; } - protected function createChildren($id) { - if (!Format::getChildren($id)) { - return array(); - } - $children = array($id => array( - "filename" => Format::getFilename($id), - "parent" => Format::getParent($id), - "sdesc" => Format::getShortDescription($id), - "ldesc" => Format::getLongDescription($id), - )); - foreach (Format::getChildren($id) as $child) { - $children["children"] = $this->createChildren($child); - } - } } /*

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