Working with cops

--HG--
extra : rebase_source : 66639c415fc1286e8df50c255d83b0e8f92777d3
Bu işleme şunda yer alıyor:
Sébastien Lucas 2013-08-30 15:52:28 +02:00
ebeveyn 30f801443e
işleme ea3da650de
3 değiştirilmiş dosya ile 37 ekleme ve 17 silme

Dosyayı Görüntüle

@ -1,5 +1,8 @@
<?php
require_once ("config.php");
require_once ("base.php");
require_once ("book.php");
require_once ("resources/php-epub-meta/epub.php");
function notFound () {
@ -9,7 +12,13 @@ function notFound () {
$_SERVER['REDIRECT_STATUS'] = 404;
}
$book = new EPub ("c:/Temp/Phare.epub");
$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 ();
$component = $_GET["comp"];
@ -22,14 +31,14 @@ try {
$data = $book->component ($component);
$directory = dirname ($component);
$callback = function ($m) use ($book, $component) {
$callback = function ($m) use ($book, $component, $add) {
$method = $m[1];
$path = $m[2];
if (preg_match ("/^#/", $path)) {
return $path;
}
$comp = $book->getComponentName ($component, $path);
return "$method'epubfs.php?comp=$comp'";
return "$method'epubfs.php?{$add}comp=$comp'";
};
$data = preg_replace_callback ("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
@ -42,7 +51,4 @@ try {
catch (Exception $e) {
error_log ($e);
notFound ();
}
?>
}

Dosyayı Görüntüle

@ -1,27 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<?php
require_once ("config.php");
require_once ("base.php");
require_once ("book.php");
require_once ("resources/php-epub-meta/epub.php");
header ("Content-Type: text/html;charset=utf-8");
$book = new EPub ("c:/Temp/Phare.epub");
$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 ();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
<title>COPS's Epub Reader</title>
<script type="text/javascript" src="<?php echo getUrlWithVersion("js/jquery-1.9.1.min.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle320/scripts/monocore.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle320/scripts/monoctrl.js") ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle320/styles/monocore.css") ?>" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle320/styles/monoctrl.css") ?>" media="screen" />
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jQuery/jquery-1.10.2.min.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monocore.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monoctrl.js") ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monocore.css") ?>" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monoctrl.css") ?>" media="screen" />
<script type="text/javascript">
Monocle.DEBUG = true;
var bookData = {
@ -33,7 +39,7 @@ $book->initSpineComponent ();
},
getComponent: function (componentId, callback) {
$.ajax({
url: "epubfs.php?comp=" + componentId,
url: "epubfs.php?<?php echo $add ?>comp=" + componentId,
type: 'get',
dataType: 'text',
error: function () {alert ("error");},
@ -42,7 +48,7 @@ $book->initSpineComponent ();
},
getMetaData: function(key) {
return {
title: "A book",
title: "<?php echo $myBook->title ?>",
creator: "Inventive Labs"
}[key];
}

Dosyayı Görüntüle

@ -194,6 +194,14 @@ class EPub {
$src = $this->toc_xpath->query('x:content', $node)->item(0)->attr('src');
$src = str_replace ("/", "-SLASH-", $src);
$contents[] = array("title" => $title, "src" => $src);
$insidenodes = $this->toc_xpath->query('x:navPoint', $node);
foreach($insidenodes as $insidenode){
$title = $this->toc_xpath->query('x:navLabel/x:text', $insidenode)->item(0)->nodeValue;
$src = $this->toc_xpath->query('x:content', $insidenode)->item(0)->attr('src');
$src = str_replace ("/", "-SLASH-", $src);
$contents[] = array("title" => $title, "src" => $src);
}
}
return $contents;
}