Options +FollowSymlinks\r
\r
-RewriteEngine on\r
-RewriteBase /\r
+#Charset\r
+AddDefaultCharset UTF-8\r
+AddCharset UTF-8 log\r
\r
# Static\r
-ExpiresActive On\r
-ExpiresDefault "modification plus 1 month"\r
-#RequestHeader edit "If-None-Match" "^(.*)-gzip$" "$1"\r
-#Header edit "ETag" "^(.*[^g][^z][^i][^p])$" "$1-gzip"\r
-\r
-# Favicon\r
-RewriteCond %{HTTP_HOST} cubedesigners\r
-RewriteRule ^favicon.ico$ images/extranet/favicon.ico [L]\r
-\r
-RewriteCond %{HTTP_HOST} fluidbook\r
-RewriteRule ^favicon.ico$ images/ws/favicon.ico [L]\r
-\r
-# Skip\r
-RewriteRule ^phpMyAdmin - [L]\r
-#RewriteRule ^books - [L]\r
-#RewriteRule ^docs - [L]\r
-\r
-RewriteRule ^ajax/supprimeFichier/([0-9]+)/(.*)$ index.php/ajax/supprimeFichier/$1/$2 [L]\r
-RewriteRule ^telecharger/([0-9]+)/(.*)$ index.php/telecharger/$1/$2 [L]\r
-RewriteRule ^([-_a-zA-Z0-9/]+)$ index.php/$1 [L]\r
-\r
-RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3/index [L]\r
-RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/index.swf [L]\r
-RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/player.swf [L]\r
-RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
-\r
-RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ vieweru/$1_$2_$3/index [L]\r
-RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_unprotected/index.swf [L]\r
-RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/_unprotected/player.swf [L]\r
-RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
-\r
-RewriteRule ^viewerp/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewerp/$1_$2_$3/index [L]\r
-RewriteRule ^viewerp/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_standalone/player.swf [L]\r
-RewriteRule ^viewerp/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]
\ No newline at end of file
+<IfModule mod_expires.c>\r
+ ExpiresActive On\r
+ ExpiresDefault "modification plus 1 month"\r
+</IfModule>\r
+\r
+<IfModule mod_rewrite.c>\r
+ RewriteEngine on\r
+ RewriteBase /\r
+\r
+ # Favicon\r
+ RewriteCond %{HTTP_HOST} cubedesigners\r
+ RewriteRule ^favicon.ico$ images/extranet/favicon.ico [L]\r
+\r
+ RewriteCond %{HTTP_HOST} fluidbook\r
+ RewriteRule ^favicon.ico$ images/ws/favicon.ico [L]\r
+\r
+ # Skip\r
+ RewriteRule ^phpMyAdmin - [L]\r
+ #RewriteRule ^books - [L]\r
+ #RewriteRule ^docs - [L]\r
+\r
+ RewriteRule ^ajax/supprimeFichier/([0-9]+)/(.*)$ index.php/ajax/supprimeFichier/$1/$2 [L]\r
+ RewriteRule ^telecharger/([0-9]+)/(.*)$ index.php/telecharger/$1/$2 [L]\r
+ RewriteRule ^([-_a-zA-Z0-9/]+)$ index.php/$1 [L]\r
+\r
+ RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewer/$1_$2_$3/index [L]\r
+ RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/index.swf [L]\r
+ RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/player.swf [L]\r
+ RewriteRule ^viewer/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
+\r
+ RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ vieweru/$1_$2_$3/index [L]\r
+ RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_unprotected/index.swf [L]\r
+ RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/player.swf$ fluidbook/compile/_unprotected/player.swf [L]\r
+ RewriteRule ^vieweru/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
+\r
+ RewriteRule ^viewerp/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.html$ viewerp/$1_$2_$3/index [L]\r
+ RewriteRule ^viewerp/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/index.swf$ fluidbook/compile/_standalone/player.swf [L]\r
+ RewriteRule ^viewerp/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/final/$1/$4 [L]\r
+</IfModule>
\ No newline at end of file
\r
public $lines;\r
public $tags = array();\r
+ public $fonts = array();\r
\r
protected $currentTag;\r
protected $processed = false;\r
\r
foreach($this->lines as $line) {\r
if (preg_match('|^\[([0-9A-Z]{3})\]\s+(.*)$|i', $line, $matches)) {\r
+ $this->rangeCurrentTag();\r
+\r
$this->currentTag = $this->addTag($matches[1], $matches[2]);\r
} elseif (!is_null($this->currentTag)) {\r
$this->currentTag->addLine($line);\r
$this->lines = null;\r
}\r
\r
+ protected function rangeCurrentTag()\r
+ {\r
+ if (is_null($this->currentTag)) {\r
+ return;\r
+ }\r
+\r
+ if ($this->currentTag instanceof wsSWF2HTMLFont) {\r
+ $this->fonts[$this->currentTag->id] = $this->currentTag;\r
+ }\r
+ }\r
+\r
protected function addTag($tag, $line)\r
{\r
- $tag = wsSWF2HTMLTag::factory($tag, $line);\r
+ $tag = wsSWF2HTMLTag::factory($tag, $line, $this);\r
if (!is_null($tag)) {\r
$this->tags[] = $tag;\r
}\r
}\r
\r
class wsSWF2HTMLTag {\r
- public static function factory($tag, $line)\r
+ public static function factory($tag, $line, &$converter)\r
{\r
if ($tag == wsSWF2HTML::FONT_TAG) {\r
- return new wsSWF2HTMLFont($line);\r
+ return new wsSWF2HTMLFont($line, $converter);\r
} else if ($tag == wsSWF2HTML::TEXT_TAG) {\r
- return new wsSWF2HTMLParagraph($line);\r
+ return new wsSWF2HTMLParagraph($line, $converter);\r
} else {\r
return null;\r
}\r
}\r
public $complete = false;\r
+ public $converter;\r
\r
- public function __construct($line)\r
+ public function __construct($line, &$converter)\r
{\r
+ $this->converter = $converter;\r
$this->addLine($line);\r
}\r
\r
class wsSWF2HTMLFont extends wsSWF2HTMLTag {\r
public $id = null;\r
public $name = null;\r
+ public $chars = array();\r
\r
- public function __construct($line)\r
+ public function __construct($line, &$converter)\r
{\r
- parent::__construct($line);\r
+ parent::__construct($line, $converter);\r
}\r
\r
public function addLine($line)\r
{\r
$line = parent::addLine($line);\r
$e = explode(':', $line);\r
- if (count($e) < 2) {\r
- return;\r
- }\r
+\r
if ($e[0] == 'ID') {\r
$this->id = trim($e[1]);\r
- $this->testComplete();\r
} elseif ($e[0] == 'name') {\r
$ef = explode('-', trim($e[1]));\r
array_pop($ef);\r
array_pop($ef);\r
$this->name = implode('-', $ef);\r
- $this->testComplete();\r
+ } else if (substr($e[0], 0, 2) == '==') {\r
+ fb($line);\r
+ if (preg_match('|== Glyph \d+: advance=\d+ encoding=(\d+) \'(.*)\' ==|i', $line, $m)) {\r
+ $this->addChar($m[1], $m[2]);\r
+ }\r
}\r
}\r
\r
- protected function testComplete()\r
+ public function addChar($encoding, $char)\r
{\r
- $this->complete = !is_null($this->id) && !is_null($this->name);\r
+ $e = cubeText::uchr($encoding);\r
+ $c = $char;\r
+ if ($e == $c) {\r
+ return;\r
+ }\r
+ $this->chars[$c] = $e;\r
}\r
}\r
\r
public $matrix;\r
public $textes = array();\r
\r
- public function __construct($line)\r
+ public function __construct($line, &$converter)\r
{\r
+ parent::__construct($line, $converter);\r
$this->matrix = new wsSWF2HTMLMatrix();\r
- parent::__construct($line);\r
}\r
\r
public function addLine($line)\r
{\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 = floatval($m[1]);\r
$this->matrix->c = floatval($m[2]);\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
+ $text = new wsSWF2HTMLText($line, $this->converter);\r
if ($text->valid) {\r
$this->textes[] = $text;\r
}\r
}\r
\r
class wsSWF2HTMLText {\r
+ public $converter;\r
+\r
public $x;\r
public $y;\r
public $color;\r
public $font;\r
public $size;\r
+ public $origText;\r
public $text;\r
+ public $readableText;\r
\r
public $valid = false;\r
- public function __construct($line)\r
+ public function __construct($line, &$converter)\r
{\r
+ $this->converter = $converter;\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
$this->x = floatval($matches[4]);\r
$this->y = floatval($matches[5]);\r
- $this->text = $matches[6];\r
+ $this->origText=$matches[6];\r
+ $this->text = preg_replace_callback('|\\\\x([0-9a-f]{2})|i', array($this, 'replaceUnicode') , $matches[6]);\r
+ $this->readableText = strtr($this->text, $this->converter->fonts[$this->font]->chars);\r
$this->valid = true;\r
} else {\r
$this->valid = false;\r
- fb($line,'invalid text');\r
}\r
}\r
+\r
+ protected function replaceUnicode($m)\r
+ {\r
+ return cubeText::uchr(hexdec($m[1]));\r
+ }\r
}\r
\r
class wsSWF2HTMLMatrix {\r