svn: /phd/trunk/phpdotnet/phd/ Index.php Package/Generic/ChunkedXHTML.php

From: Date: Tue, 01 Sep 2009 04:47:10 +0000
Subject: svn: /phd/trunk/phpdotnet/phd/ Index.php Package/Generic/ChunkedXHTML.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4812@lists.php.net to get a copy of this message
moacir Tue, 01 Sep 2009 04:47:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=287934 Log: improving the dbhtml filename support Changed paths: U phd/trunk/phpdotnet/phd/Index.php U phd/trunk/phpdotnet/phd/Package/Generic/ChunkedXHTML.php Modified: phd/trunk/phpdotnet/phd/Index.php =================================================================== --- phd/trunk/phpdotnet/phd/Index.php 2009-09-01 01:23:56 UTC (rev 287933) +++ phd/trunk/phpdotnet/phd/Index.php 2009-09-01 04:47:10 UTC (rev 287934) @@ -272,6 +272,7 @@ return $this->format_chunk($open, $name, $attrs, $props); } public function format_chunk($open, $name, $attrs, $props) { + $this->processFilename(); if ($open) { if(isset($attrs[Reader::XMLNS_XML]["id"])) { $id = $attrs[Reader::XMLNS_XML]["id"]; @@ -286,20 +287,13 @@ $this->chunks[] = $id; $this->currentchunk = $id; $this->storeInfo($name, $id, $id); - $this->notify(Render::CHUNK, Render::OPEN); } return false; } if (array_pop($this->isChunk)) { $lastchunk = array_pop($this->chunks); $this->currentchunk = end($this->chunks); - $dbhtml = $this->getPIHandler("dbhtml"); - if ($dbhtml->getAttribute("filename")) { - $this->nfo[$lastchunk]["filename"] = $dbhtml->getAttribute("filename"); - $dbhtml->setAttribute("filename", false); - } $this->appendID(); - $this->notify(Render::CHUNK, Render::CLOSE); } return false; } @@ -333,6 +327,18 @@ $this->commit = $this->commitAfter = null; } } + + public function processFilename() { + static $dbhtml = null; + if ($dbhtml == null) { + $dbhtml = $this->getPIHandler("dbhtml"); + } + $filename = $dbhtml->getAttribute("filename"); + if ($filename) { + $this->nfo[end($this->chunks)]["filename"] = $filename; + $dbhtml->setAttribute("filename", false); + } + } } Modified: phd/trunk/phpdotnet/phd/Package/Generic/ChunkedXHTML.php =================================================================== --- phd/trunk/phpdotnet/phd/Package/Generic/ChunkedXHTML.php 2009-09-01 01:23:56 UTC (rev 287933) +++ phd/trunk/phpdotnet/phd/Package/Generic/ChunkedXHTML.php 2009-09-01 04:47:10 UTC (rev 287934) @@ -39,13 +39,7 @@ } public function writeChunk($id, $fp) { - $dbhtml = $this->getPIHandler("dbhtml"); - if ($dbhtml->getAttribute("filename")) { - $filename = $this->getOutputDir() . $dbhtml->getAttribute("filename") . "." . $this->getExt(); - $dbhtml->setAttribute("filename", false); - } else { - $filename = $this->getOutputDir() . $id . '.' . $this->getExt(); - } + $filename = $this->getOutputDir() . Format::getFilename($id) . '.' . $this->getExt(); rewind($fp); file_put_contents($filename, $this->header($id));

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