cvs: phd /include PhDReader.class.php
| From: | Christian Weiske | Date: | Thu, 30 Oct 2008 05:16:45 +0000 |
| Subject: | cvs: phd /include PhDReader.class.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2341@lists.php.net to get a copy of this message | ||
cweiske Thu Oct 30 05:16:45 2008 UTC
Modified files:
/phd/include PhDReader.class.php
Log:
Implement request #46411: Allow random chunking depths
We can use phd:chunk="true" in any element with an ID now to get a chunk of
it. Preferably <section> and other elements that are prepared to be chunked
:)
http://cvs.php.net/viewvc.cgi/phd/include/PhDReader.class.php?r1=1.19&r2=1.20&diff_format=u
Index: phd/include/PhDReader.class.php
diff -u phd/include/PhDReader.class.php:1.19 phd/include/PhDReader.class.php:1.20
--- phd/include/PhDReader.class.php:1.19 Sun Oct 19 16:39:58 2008
+++ phd/include/PhDReader.class.php Thu Oct 30 05:16:45 2008
@@ -1,5 +1,5 @@
<?php
-/* $Id: PhDReader.class.php,v 1.19 2008/10/19 16:39:58 bjori Exp $ */
+/* $Id: PhDReader.class.php,v 1.20 2008/10/30 05:16:45 cweiske Exp $ */
//6271
class PhDReader extends XMLReader {
@@ -109,6 +109,21 @@
return "";
} /* }}} */
+ /**
+ * Check if the element wants to be chunked.
+ * Reads the element's 'phd:chunk="true"' attribute
+ *
+ * @return boolean true if the element shall be chunked
+ */
+ public function getWantsToBeChunked() { /* {{{ */
+ if ($this->hasAttributes && XMLReader::moveToAttributeNs("chunk",
self::XMLNS_PHD)) {
+ $isChunk = $this->value == 'true';
+ XMLReader::moveToElement();
+ return $isChunk;
+ }
+ return false;
+ } /* }}} */
+
public function getParentTagName() { /* {{{ */
return $this->STACK[$this->depth-1];
} /* }}} */
@@ -205,6 +220,8 @@
public function isChunk($tag, $id) { /* {{{ */
if (!$id) {
return false;
+ } else if ($this->getWantsToBeChunked()) {
+ return true;
} else if (isset($this->CHUNK_ME[$tag])) {
$isChunk = $this->CHUNK_ME[$tag];
if (is_array($isChunk)) {