From e03d9bf23dd563715e068cd36bc93e5a9b180c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 19 Apr 2013 14:28:18 +0200 Subject: [PATCH] Update to latest version --- epub.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/epub.php b/epub.php index 46b5804..f0aabb8 100644 --- a/epub.php +++ b/epub.php @@ -85,7 +85,7 @@ class EPub { $this->toc->loadXML($data); $this->toc_xpath = new EPubDOMXPath($this->toc); $rootNamespace = $this->toc->lookupNamespaceUri($this->toc->namespaceURI); - $this->toc_xpath->registerNamespace('x', $rootNamespace); + $this->toc_xpath->registerNamespace('x', $rootNamespace); } /** @@ -160,8 +160,17 @@ class EPub { } $data = $this->zip->FileRead($path); + $data = preg_replace ("/src=[\"']([\w\/\.]*?)[\"']/", "src='epubfs.php?comp=$1'", $data); + $data = preg_replace ("/href=[\"']([\w\/\.]*?)[\"']/", "href='epubfs.php?comp=$1'", $data); return $data; } + + /** + * Get the component content type + */ + public function componentContentType($comp) { + return $this->xpath->query("//opf:manifest/opf:item[@href='$comp']")->item(0)->getAttribute('media-type'); + } /** * Get the Epub content (TOC) as an array