From c229d273581954ae8fd18e3d3e1c16f80fbffc8d Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Sun, 3 Apr 2011 16:48:52 +0000 Subject: [PATCH] --- inc/ws/Util/class.ws.swf2html.php | 40 +++++++++++++++++-------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/inc/ws/Util/class.ws.swf2html.php b/inc/ws/Util/class.ws.swf2html.php index dff7881d7..42ed1c330 100644 --- a/inc/ws/Util/class.ws.swf2html.php +++ b/inc/ws/Util/class.ws.swf2html.php @@ -7,13 +7,11 @@ class wsSWF2HTML { public $tags = array(); protected $currentTag; - protected $processed = false; public function __construct($dump) { $this->lines = explode("\n", $dump); - $this->lastIndex = count($this->lines)-1; } public function process() @@ -22,19 +20,23 @@ class wsSWF2HTML { return; } - foreach($lines as $line) { + foreach($this->lines as $line) { if (preg_match('|^\[([0-9A-Z]{3})\]\s+(.*)$|i', $line, $matches)) { - $currentTag = $this->addTag($matches[1], $matches[2]); - } else { - $currentTag->addLine($line); + $this->currentTag = $this->addTag($matches[1], $matches[2]); + } elseif (!is_null($this->currentTag)) { + $this->currentTag->addLine($line); } } + + $this->lines = null; } protected function addTag($tag, $line) { $tag = wsSWF2HTMLTag::factory($tag, $line); - $this->tags[] = $tag; + if (!is_null($tag)) { + $this->tags[] = $tag; + } return $tag; } @@ -57,7 +59,7 @@ class wsSWF2HTMLTag { } else if ($tag == wsSWF2HTML::TEXT_TAG) { return new wsSWF2HTMLParagraph($line); } else { - return new wsSWF2HTMLTag($line); + return null; } } public $complete = false; @@ -69,8 +71,7 @@ class wsSWF2HTMLTag { public function addLine($line) { - $line = trim($line); - return $line; + return ltrim($line); } } @@ -122,16 +123,18 @@ class wsSWF2HTMLParagraph extends wsSWF2HTMLTag { { $line = parent::addLine($line); if (substr($line, 0, 1) == '|') { - if (preg_match('|^\|\s([0-9.]*)\s([0-9.]*)\s([0-9.]*)$|i', $line, $m)) { + if (preg_match('|\|\s([0-9.-]+)\s([0-9.-]+)\s([0-9.-]+)|i', $line, $m)) { if (is_null($this->matrix->a)) { - $this->matrix->a = parseFloat($m[1]); - $this->matrix->c = parseFloat($m[2]); - $this->matrix->tx = parseFloat($m[3]); + $this->matrix->a = floatval($m[1]); + $this->matrix->c = floatval($m[2]); + $this->matrix->tx = floatval($m[3]); } else { - $this->matrix->b = parseFloat($m[1]); - $this->matrix->d = parseFloat($m[2]); - $this->matrix->ty = parseFloat($m[3]); + $this->matrix->b = floatval($m[1]); + $this->matrix->d = floatval($m[2]); + $this->matrix->ty = floatval($m[3]); } + }else{ + fb($line); } } else if (substr($line, 0, 1) == '<') { $text = new wsSWF2HTMLText($line); @@ -153,7 +156,7 @@ class wsSWF2HTMLText { public $valid = false; public function __construct($line) { - if (preg_match('|^\<\d+ glyphs in font (\d+) size (\d+), color (#[0-9a-f]+) at ([0-9.]+),([0-9.]+)\>\s(.*)|i', $line, $matches)) { + if (preg_match('|^\<\s?\d+ glyphs in font (\d+) size (\d+), color (#[0-9a-f]+) at ([0-9.-]+),([0-9.-]+)\>\s(.*)|ui', $line, $matches)) { $this->font = intval($matches[1]); $this->size = intval($matches[2]); $this->color = $matches[3]; @@ -163,6 +166,7 @@ class wsSWF2HTMLText { $this->valid = true; } else { $this->valid = false; + fb($line,'invalid text'); } } } -- 2.39.5