public function testAnchorOnly() { $data = getComponentContent(self::$book, "main10.xml", self::$add); $src = ""; if (preg_match("/href\\='(.*?)' title=\"Link to anchor\"/", $data, $matches)) { $src = $matches[1]; } $this->assertEquals('#anchor', $src); }
$data = preg_replace_callback("/(src\\s*:\\s*url\\()(.*?)\\)/", $callback, $data); return $data; } if (php_sapi_name() === 'cli') { return; } $idData = getURLParam("data", NULL); $add = "data={$idData}&"; if (!is_null(GetUrlParam(DB))) { $add .= DB . "=" . GetUrlParam(DB) . "&"; } $myBook = Book::getBookByDataId($idData); $book = new EPub($myBook->getFilePath("EPUB", $idData)); $book->initSpineComponent(); if (!isset($_GET["comp"])) { notFound(); return; } $component = $_GET["comp"]; try { $data = getComponentContent($book, $component, $add); $expires = 60 * 60 * 24 * 14; header("Pragma: public"); header("Cache-Control: maxage=" . $expires); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); header("Content-Type: " . $book->componentContentType($component)); echo $data; } catch (Exception $e) { error_log($e); notFound(); }