]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sun, 3 Apr 2011 16:48:52 +0000 (16:48 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sun, 3 Apr 2011 16:48:52 +0000 (16:48 +0000)
inc/ws/Util/class.ws.swf2html.php

index dff7881d7f1da2efeb51522952afb4ec3eba1072..42ed1c3304f8b0c5a39f8bad6243959356f78f4e 100644 (file)
@@ -7,13 +7,11 @@ class wsSWF2HTML {
        public $tags = array();\r
 \r
        protected $currentTag;\r
-\r
        protected $processed = false;\r
 \r
        public function __construct($dump)\r
        {\r
                $this->lines = explode("\n", $dump);\r
-               $this->lastIndex = count($this->lines)-1;\r
        }\r
 \r
        public function process()\r
@@ -22,19 +20,23 @@ class wsSWF2HTML {
                        return;\r
                }\r
 \r
-               foreach($lines as $line) {\r
+               foreach($this->lines as $line) {\r
                        if (preg_match('|^\[([0-9A-Z]{3})\]\s+(.*)$|i', $line, $matches)) {\r
-                               $currentTag = $this->addTag($matches[1], $matches[2]);\r
-                       } else {\r
-                               $currentTag->addLine($line);\r
+                               $this->currentTag = $this->addTag($matches[1], $matches[2]);\r
+                       } elseif (!is_null($this->currentTag)) {\r
+                               $this->currentTag->addLine($line);\r
                        }\r
                }\r
+\r
+               $this->lines = null;\r
        }\r
 \r
        protected function addTag($tag, $line)\r
        {\r
                $tag = wsSWF2HTMLTag::factory($tag, $line);\r
-               $this->tags[] = $tag;\r
+               if (!is_null($tag)) {\r
+                       $this->tags[] = $tag;\r
+               }\r
                return $tag;\r
        }\r
 \r
@@ -57,7 +59,7 @@ class wsSWF2HTMLTag {
                } else if ($tag == wsSWF2HTML::TEXT_TAG) {\r
                        return new wsSWF2HTMLParagraph($line);\r
                } else {\r
-                       return new wsSWF2HTMLTag($line);\r
+                       return null;\r
                }\r
        }\r
        public $complete = false;\r
@@ -69,8 +71,7 @@ class wsSWF2HTMLTag {
 \r
        public function addLine($line)\r
        {\r
-               $line = trim($line);\r
-               return $line;\r
+               return ltrim($line);\r
        }\r
 }\r
 \r
@@ -122,16 +123,18 @@ class wsSWF2HTMLParagraph extends wsSWF2HTMLTag {
        {\r
                $line = parent::addLine($line);\r
                if (substr($line, 0, 1) == '|') {\r
-                       if (preg_match('|^\|\s([0-9.]*)\s([0-9.]*)\s([0-9.]*)$|i', $line, $m)) {\r
+                       if (preg_match('|\|\s([0-9.-]+)\s([0-9.-]+)\s([0-9.-]+)|i', $line, $m)) {\r
                                if (is_null($this->matrix->a)) {\r
-                                       $this->matrix->a = parseFloat($m[1]);\r
-                                       $this->matrix->c = parseFloat($m[2]);\r
-                                       $this->matrix->tx = parseFloat($m[3]);\r
+                                       $this->matrix->a = floatval($m[1]);\r
+                                       $this->matrix->c = floatval($m[2]);\r
+                                       $this->matrix->tx = floatval($m[3]);\r
                                } else {\r
-                                       $this->matrix->b = parseFloat($m[1]);\r
-                                       $this->matrix->d = parseFloat($m[2]);\r
-                                       $this->matrix->ty = parseFloat($m[3]);\r
+                                       $this->matrix->b = floatval($m[1]);\r
+                                       $this->matrix->d = floatval($m[2]);\r
+                                       $this->matrix->ty = floatval($m[3]);\r
                                }\r
+                       }else{\r
+                               fb($line);\r
                        }\r
                } else if (substr($line, 0, 1) == '<') {\r
                        $text = new wsSWF2HTMLText($line);\r
@@ -153,7 +156,7 @@ class wsSWF2HTMLText {
        public $valid = false;\r
        public function __construct($line)\r
        {\r
-               if (preg_match('|^\<\d+ glyphs in font (\d+) size (\d+), color (#[0-9a-f]+) at ([0-9.]+),([0-9.]+)\>\s(.*)|i', $line, $matches)) {\r
+               if (preg_match('|^\<\s?\d+ glyphs in font (\d+) size (\d+), color (#[0-9a-f]+) at ([0-9.-]+),([0-9.-]+)\>\s(.*)|ui', $line, $matches)) {\r
                        $this->font = intval($matches[1]);\r
                        $this->size = intval($matches[2]);\r
                        $this->color = $matches[3];\r
@@ -163,6 +166,7 @@ class wsSWF2HTMLText {
                        $this->valid = true;\r
                } else {\r
                        $this->valid = false;\r
+                       fb($line,'invalid text');\r
                }\r
        }\r
 }\r