cvs: phd / mktoc.php

From: Date: Mon, 22 Oct 2007 14:10:35 +0000
Subject: cvs: phd / mktoc.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-258@lists.php.net to get a copy of this message
bjori Mon Oct 22 14:10:35 2007 UTC Modified files: /phd mktoc.php Log: Improve performance http://cvs.php.net/viewvc.cgi/phd/mktoc.php?r1=1.6&r2=1.7&diff_format=u Index: phd/mktoc.php diff -u phd/mktoc.php:1.6 phd/mktoc.php:1.7 --- phd/mktoc.php:1.6 Thu Oct 11 08:28:43 2007 +++ phd/mktoc.php Mon Oct 22 14:10:35 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: mktoc.php,v 1.6 2007/10/11 08:28:43 bjori Exp $ */ +/* $Id: mktoc.php,v 1.7 2007/10/22 14:10:35 bjori Exp $ */ $r = new PhDReader($OPTIONS); $FILENAMES = array(); $CURRENT_FILENAME = $LAST_CHUNK = ""; @@ -11,23 +11,17 @@ while($r->read()) { if (!($id = $r->getID())) { $name = $r->name; - if (in_array($name, array("refname", "titleabbrev")) && empty($IDs[$lastid]["sdesc"])) { - switch($name) { - case "refname": + if (empty($IDs[$lastid]["sdesc"])) { + $name = $r->name; + if ($name == "refname" || $name == "titleabbrev") { $IDs[$lastid]["sdesc"] = trim($r->readContent($name)); - continue 2; - case "titleabbrev": - $IDs[$lastid]["sdesc"] = trim($r->readContent($name)); - continue 2; + continue; } - } else if (in_array($name, array("title", "refpurpose")) && empty($IDs[$lastid]["ldesc"])) { - switch($name) { - case "title": - $IDs[$lastid]["ldesc"] = trim($r->readContent($name)); - continue 2; - case "refpurpose": + } + if (empty($IDs[$lastid]["ldesc"])) { + $name = $r->name; + if ($name == "title" || $name == "refpurpose") { $IDs[$lastid]["ldesc"] = trim($r->readContent($name)); - continue 2; } } @@ -54,14 +48,13 @@ $IDs[$id] = array( "filename" => $CURRENT_FILENAME, - "parent" => $r->isChunk ? $PARENTS[$r->depth-1] : end($FILENAMES), + "parent" => $r->isChunk ? $PARENTS[$r->depth-1] : $CURRENT_FILENAME, "sdesc" => null, "ldesc" => null, "children" => array(), ); $lastid = $id; - } /*

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