Fixed a bug into PHPePub with special caracters

This commit is contained in:
tcit 2014-04-24 03:08:31 +02:00
parent 87090d8ae7
commit 72a857158c

View file

@ -343,6 +343,7 @@ class EPub {
} }
$fileName = Zip::getRelativePath($fileName); $fileName = Zip::getRelativePath($fileName);
$fileName = preg_replace('#^[/\.]+#i', "", $fileName); $fileName = preg_replace('#^[/\.]+#i', "", $fileName);
$fileName = $this->sanitizeFileName($fileName);
$chapter = $chapterData; $chapter = $chapterData;
if ($autoSplit && is_string($chapterData) && mb_strlen($chapterData) > $this->splitDefaultSize) { if ($autoSplit && is_string($chapterData) && mb_strlen($chapterData) > $this->splitDefaultSize) {
@ -1699,7 +1700,7 @@ class EPub {
while (list($chapterName, $navPoint) = each($this->ncx->chapterList)) { while (list($chapterName, $navPoint) = each($this->ncx->chapterList)) {
$fileName = $navPoint->getContentSrc(); $fileName = $navPoint->getContentSrc();
$level = $navPoint->getLevel() -2; $level = $navPoint->getLevel() -2;
$tocData .= "\t<p>" . str_repeat(" &#160; &#160; &#160;", $level) . "<a href=\"" . $fileName . "\">" . $chapterName . "</a></p>\n"; $tocData .= "\t<p>" . str_repeat(" &#160; &#160; &#160;", $level) . "<a href=\"" . $this->sanitizeFileName($fileName) . "\">" . $chapterName . "</a></p>\n";
} }
} else if ($this->tocAddReferences === TRUE) { } else if ($this->tocAddReferences === TRUE) {
if (array_key_exists($item, $this->ncx->referencesList)) { if (array_key_exists($item, $this->ncx->referencesList)) {