svn: /phd/trunk/phpdotnet/phd/ PI/DBHTMLHandler.php PIHandler.php
| From: | Moacir de Oliveira Miranda Júnior | Date: | Tue, 28 Jul 2009 05:35:48 +0000 |
| Subject: | svn: /phd/trunk/phpdotnet/phd/ PI/DBHTMLHandler.php PIHandler.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-4531@lists.php.net to get a copy of this message | ||
moacir Tue, 28 Jul 2009 05:35:48 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286436
Log:
adding PI suport
Changed paths:
A phd/trunk/phpdotnet/phd/PI/
A phd/trunk/phpdotnet/phd/PI/DBHTMLHandler.php
A phd/trunk/phpdotnet/phd/PIHandler.php
Added: phd/trunk/phpdotnet/phd/PI/DBHTMLHandler.php
===================================================================
--- phd/trunk/phpdotnet/phd/PI/DBHTMLHandler.php (rev 0)
+++ phd/trunk/phpdotnet/phd/PI/DBHTMLHandler.php 2009-07-28 05:35:48 UTC (rev 286436)
@@ -0,0 +1,62 @@
+<?php
+namespace phpdotnet\phd;
+
+class PI_DBHTMLHandler extends PIHandler {
+ private $attrs = array(
+ "background-color" => "",
+ "bgcolor" => "",
+ "cellpadding" => "",
+ "cellspacing" => "",
+ "class" => "",
+ "dir" => "",
+ "filename" => "",
+ "funcsynopsis-style" => "",
+ "img.src.path" => "",
+ "label-width" => "",
+ "linenumbering.everyNth" => "",
+ "linenumbering.separator" => "",
+ "linenumbering.width" => "",
+ "list-presentation" => "",
+ "list-width" => "",
+ "row-height" => "",
+ "start" => "",
+ "stop-chunking" => "",
+ "table-summary" => "",
+ "table-width" => "",
+ "term-presentation" => "",
+ "term-separator" => "",
+ "term-width" => "",
+ "toc" => "",
+ );
+
+ public function __construct($format) {
+ parent::__construct($format);
+ }
+
+ public function parse($target, $data) {
+ $pattern =
"/(?<attr>[\w]+[\w\-\.]*)[\s]*=[\s]*\"(?<value>[^\"]*)\"/";
+ preg_match_all($pattern, $data, $matches);
+ for ($i = 0; $i < count($matches["attr"]); $i++) {
+ $attr = trim($matches["attr"][$i]);
+ $value = trim($matches["value"][$i]);
+ $this->setAttribute($attr, $value);
+ }
+ //Hack for stop-chunking
+ if ($data == "stop-chunking") {
+ $this->setAttribute("stop-chunking", true);
+ }
+ }
+
+ public function setAttribute($attr, $value) {
+ if (isset($this->attrs[$attr])) {
+ $this->attrs[$attr] = $value;
+ }
+ }
+
+ public function getAttribute($attr) {
+ return isset($this->attrs[$attr]) ? $this->attrs[$attr] : false;
+ }
+
+}
+
+?>
Property changes on: phd/trunk/phpdotnet/phd/PI/DBHTMLHandler.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Added: phd/trunk/phpdotnet/phd/PIHandler.php
===================================================================
--- phd/trunk/phpdotnet/phd/PIHandler.php (rev 0)
+++ phd/trunk/phpdotnet/phd/PIHandler.php 2009-07-28 05:35:48 UTC (rev 286436)
@@ -0,0 +1,15 @@
+<?php
+namespace phpdotnet\phd;
+
+abstract class PIHandler {
+ protected $format;
+
+ public function __construct($format) {
+ $this->format = $format;
+ }
+
+ public abstract function parse($target, $data);
+
+}
+
+?>
Property changes on: phd/trunk/phpdotnet/phd/PIHandler.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native