/** * Get book metadata of components. * * @access public * @return string */ public function getComponents() { $components = array_map(function ($component) { return '\'' . $component . '\''; }, $this->epub->components()); return '[' . implode(', ', $components) . ']'; }
<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 = { getComponents: function () { <?php echo "return [" . implode(", ", array_map(function ($comp) { return "'" . $comp . "'"; }, $book->components())) . "];"; ?> }, getContents: function () { <?php echo "return [" . implode(", ", array_map(function ($content) { return "{title: '" . addslashes($content["title"]) . "', src: '" . $content["src"] . "'}"; }, $book->contents())) . "];"; ?> }, getComponent: function (componentId) { return { url: "epubfs.php?<?php echo $add; ?> comp=" + componentId }; },