svn: /phd/trunk/phpdotnet/phd/ Format.php Index.php ObjectStorage.php Package/Generic/XHTML.php ReaderKeeper.php Render.php
| From: | Christian Weiske | Date: | Fri, 16 Oct 2009 17:43:56 +0000 |
| Subject: | svn: /phd/trunk/phpdotnet/phd/ Format.php Index.php ObjectStorage.php Package/Generic/XHTML.php ReaderKeeper.php Render.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-5155@lists.php.net to get a copy of this message | ||
cweiske Fri, 16 Oct 2009 17:43:56 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289703
Log:
remove legacy code that is not needed anymore; move Reader storage to ReaderKeeper
Changed paths:
U phd/trunk/phpdotnet/phd/Format.php
U phd/trunk/phpdotnet/phd/Index.php
U phd/trunk/phpdotnet/phd/ObjectStorage.php
U phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php
A phd/trunk/phpdotnet/phd/ReaderKeeper.php
U phd/trunk/phpdotnet/phd/Render.php
Modified: phd/trunk/phpdotnet/phd/Format.php
===================================================================
--- phd/trunk/phpdotnet/phd/Format.php 2009-10-16 16:51:34 UTC (rev 289702)
+++ phd/trunk/phpdotnet/phd/Format.php 2009-10-16 17:43:56 UTC (rev 289703)
@@ -191,10 +191,6 @@
final public function notify($event, $val = null)
{
$this->update($event, $val);
- //FIXME: the following code is not necessary anymore
- foreach($this as $format) {
- $format->update($event, $val);
- }
}
public function setTitle($title) {
Modified: phd/trunk/phpdotnet/phd/Index.php
===================================================================
--- phd/trunk/phpdotnet/phd/Index.php 2009-10-16 16:51:34 UTC (rev 289702)
+++ phd/trunk/phpdotnet/phd/Index.php 2009-10-16 17:43:56 UTC (rev 289703)
@@ -328,14 +328,14 @@
if ($open) {
if (empty($this->nfo[$this->currentid]["ldesc"])) {
/* FIXME: How can I mark that node with "reparse" flag? */
- $s = htmlentities(trim($this->getReader()->readContent()), ENT_COMPAT,
"UTF-8");
+ $s = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT,
"UTF-8");
$this->nfo[$this->currentid]["ldesc"] = $s;
}
}
}
public function format_sdesc($open, $name, $attrs, $props) {
if ($open) {
- $s = htmlentities(trim($this->getReader()->readContent()), ENT_COMPAT,
"UTF-8");
+ $s = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT,
"UTF-8");
if (empty($this->nfo[$this->currentid]["sdesc"])) {
/* FIXME: How can I mark that node with "reparse" flag? */
$this->nfo[$this->currentid]["sdesc"] = $s;
Modified: phd/trunk/phpdotnet/phd/ObjectStorage.php
===================================================================
--- phd/trunk/phpdotnet/phd/ObjectStorage.php 2009-10-16 16:51:34 UTC (rev 289702)
+++ phd/trunk/phpdotnet/phd/ObjectStorage.php 2009-10-16 17:43:56 UTC (rev 289703)
@@ -4,8 +4,6 @@
class ObjectStorage extends \SplObjectStorage
{
- protected static $r = array();
-
public function attach($obj, $inf = array()) {
if (!($obj instanceof Format)) {
throw new InvalidArgumentException(
@@ -21,15 +19,6 @@
parent::attach($obj, $inf);
return $obj;
}
- final protected static function setReader(Reader $r) {
- self::$r[] = $r;
- }
- final protected function getReader() {
- return end(self::$r);
- }
- final protected function popReader() {
- return array_pop(self::$r);
- }
}
Modified: phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php
===================================================================
--- phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php 2009-10-16 16:51:34 UTC (rev 289702)
+++ phd/trunk/phpdotnet/phd/Package/Generic/XHTML.php 2009-10-16 17:43:56 UTC (rev 289703)
@@ -1440,7 +1440,7 @@
}
public function format_qandaset($open, $name, $attrs, $props) {
if ($open) {
- $node = $this->getReader()->expand();
+ $node = ReaderKeeper::getReader()->expand();
$doc = new \DOMDocument;
$doc->appendChild($node);
Added: phd/trunk/phpdotnet/phd/ReaderKeeper.php
===================================================================
--- phd/trunk/phpdotnet/phd/ReaderKeeper.php (rev 0)
+++ phd/trunk/phpdotnet/phd/ReaderKeeper.php 2009-10-16 17:43:56 UTC (rev 289703)
@@ -0,0 +1,52 @@
+<?php
+namespace phpdotnet\phd;
+/* $Id: ObjectStorage.php 286561 2009-07-30 16:56:01Z bjori $ */
+
+class ReaderKeeper
+{
+ /**
+ * Array of reader objects.
+ *
+ * @var array
+ */
+ protected static $r = array();
+
+ /**
+ * Appends a reader object to the stack.
+ *
+ * @param Reader $r Reader to append
+ *
+ * @return void
+ */
+ public static function setReader(Reader $r)
+ {
+ self::$r[] = $r;
+ }
+
+ /**
+ * Returns the reader from the top of the stack.
+ *
+ * @return Reader Reader object
+ */
+ public static function getReader()
+ {
+ return end(self::$r);
+ }
+
+ /**
+ * Removes the reader from the top of the stack.
+ *
+ * @return void
+ */
+ public static function popReader()
+ {
+ return array_pop(self::$r);
+ }
+}
+
+
+/*
+* vim600: sw=4 ts=4 syntax=php et
+* vim<600: sw=4 ts=4
+*/
+
Modified: phd/trunk/phpdotnet/phd/Render.php
===================================================================
--- phd/trunk/phpdotnet/phd/Render.php 2009-10-16 16:51:34 UTC (rev 289702)
+++ phd/trunk/phpdotnet/phd/Render.php 2009-10-16 17:43:56 UTC (rev 289703)
@@ -40,7 +40,7 @@
} /* }}} */
public function execute(Reader $r) { /* {{{ */
- ObjectStorage::setReader($r);
+ ReaderKeeper::setReader($r);
foreach($this as $format) {
$format->notify(Render::INIT, true);
@@ -112,26 +112,6 @@
$data = $retval = $format->{$tag}($open, $name, $attrs, $props);
}
$format->appendData($data);
-
- foreach($format as $theme) {
- $map = $format[$theme][\XMLReader::ELEMENT];
- if (isset($map[$name])) {
- $tag = $map[$name];
-
- if (is_array($tag)) {
- $tag = $this->notXPath($tag, $depth);
- }
-
- if ($tag !== false) {
- $retval = $theme->{$tag}($open, $name, $attrs, $props);
-
- if ($retval !== false) {
- $data = $retval;
- }
- }
- }
- $theme->appendData($data);
- }
}
$lastdepth = $depth;
@@ -166,25 +146,6 @@
} else {
$format->appendData($data);
}
-
- foreach($format as $theme) {
- $map = $format[$theme][\XMLReader::TEXT];
- if (isset($map[$name])) {
- $tag = $map[$name];
-
- if (is_array($tag)) {
- $tag = $this->notXPath($tag, $eldepth);
- }
-
- if ($tag !== false) {
- $retval = $format->{$tag}($value, $name);
- if ($retval !== false) {
- $data = $retval;
- }
- }
- }
- $theme->appendData($data);
- }
}
break;
/* }}} */
@@ -195,9 +156,6 @@
foreach($this as $format) {
$retval = $format->CDATA($value);
$format->appendData($retval);
- foreach($format as $theme) {
- $theme->appendData($retval);
- }
}
break;
/* }}} */
@@ -208,9 +166,6 @@
$retval = $r->value;
foreach($this as $format) {
$format->appendData($retval);
- foreach($format as $theme) {
- $theme->appendData($retval);
- }
}
break;
/* }}} */
@@ -231,7 +186,7 @@
}
$r->close();
- ObjectStorage::popReader();
+ ReaderKeeper::popReader();
} /* }}} */