diff --git a/EPub.Example1.php b/EPub.Example1.php deleted file mode 100644 index 4a99a6b..0000000 --- a/EPub.Example1.php +++ /dev/null @@ -1,350 +0,0 @@ -\n" -. "\n" -. "\n" -. "" -. "\n" -. "\n" -. "Test Book\n" -. " \n" -. "\n"; - -$bookEnd = "\n\n"; - -// setting timezone for time functions used for logging to work properly -date_default_timezone_set('Europe/Berlin'); - -include_once("Logger.php"); -$log = new Logger("Example", TRUE); - -$fileDir = './PHPePub'; - -include_once("EPub.php"); -$log->logLine("include EPub"); - -$book = new EPub(); // Default is EPub::BOOK_VERSION_EPUB2 -$log->logLine("new EPub()"); -$log->logLine("EPub class version: " . EPub::VERSION); -$log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); -$log->logLine("Zip version: " . Zip::VERSION); -$log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); -$log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); - -// Title and Identifier are mandatory! -$book->setTitle("Test book"); -$book->setIdentifier("http://JohnJaneDoePublications.com/books/TestBook.html", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. -$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. -$book->setDescription("This is a brief description\nA test ePub book as an example of building a book in PHP"); -$book->setAuthor("John Doe Johnson", "Johnson, John Doe"); -$book->setPublisher("John and Jane Doe Publications", "http://JohnJaneDoePublications.com/"); // I hope this is a non existant address :) -$book->setDate(time()); // Strictly not needed as the book date defaults to time(). -$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. -$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBook.html"); - -$book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); - -$book->setSubject("Test book"); -$book->setSubject("keywords"); -$book->setSubject("Chapter levels"); - -// Insert custom meta data to the book, in this cvase, Calibre series index information. -$book->addCustomMetadata("calibre:series", "PHPePub Test books"); -$book->addCustomMetadata("calibre:series_index", "1"); - -$log->logLine("Set up parameters"); - -$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; - -$log->logLine("Add css"); -$book->addCSSFile("styles.css", "css1", $cssData); - -// This test requires you have an image, change "demo/cover-image.jpg" to match your location. -$log->logLine("Add Cover Image"); -$book->setCoverImage("Cover.jpg", file_get_contents("demo/cover-image.jpg"), "image/jpeg"); - -// A better way is to let EPub handle the image itself, as it may need resizing. Most Ebooks are only about 600x800 -// pixels, adding megapix images is a waste of place and spends bandwidth. setCoverImage can resize the image. -// When using this method, the given image path must be the absolute path from the servers Document root. - -/* $book->setCoverImage("/absolute/path/to/demo/cover-image.jpg"); */ - -// setCoverImage can only be called once per book, but can be called at any point in the book creation. -$log->logLine("Set Cover Image"); - -$cover = $content_start . "

Test Book

\n

By: John Doe Johnson

\n" . $bookEnd; -$book->addChapter("Notices", "Cover.html", $cover); -$book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE); -// function buildTOC($cssFileName = NULL, $tocCSSClass = "toc", $title = "Table of Contents", $addReferences = TRUE, $addToIndex = FALSE, $tocFileName = "TOC.xhtml") { - - -$chapter1 = $content_start . "

Chapter 1

\n" - . "

Lorem ipsum

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec magna lorem, mattis sit amet porta vitae, consectetur ut eros. Nullam id mattis lacus. In eget neque magna, congue imperdiet nulla. Aenean erat lacus, imperdiet a adipiscing non, dignissim eget felis. Nulla facilisi. Vivamus sit amet lorem eget mauris dictum pharetra. In mauris nulla, placerat a accumsan ac, mollis sit amet ligula. Donec eget facilisis dui. Cras elit quam, imperdiet at malesuada vitae, luctus id orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque eu libero in leo ultrices tristique. Etiam quis ornare massa. Donec in velit leo. Sed eu ante tortor.

\n" - . "

\"TestNullam at tempus enim. Nunc et augue non lectus consequat rhoncus ac a odio. Morbi et tellus eget nisi volutpat tincidunt. Curabitur tristique neque tincidunt purus blandit bibendum. Maecenas eleifend sem quis magna semper id pulvinar nisi porttitor. In in lectus accumsan eros tristique pharetra sit amet ac nulla. Nam vitae felis et orci congue porta nec non ipsum. Donec pretium blandit accumsan. In aliquam lacinia nisi, ut venenatis mauris condimentum ut. Morbi rutrum orci et nisl accumsan euismod. Etiam viverra luctus sem pellentesque suscipit. Aliquam ultricies egestas risus at eleifend. Ut lacinia, tortor non varius malesuada, massa diam aliquet augue, vitae tempor metus tellus eget diam. Nulla vel augue eu elit adipiscing egestas. Duis et nulla est, ac congue arcu. Phasellus semper, ipsum et blandit rutrum, erat ante semper quam, at iaculis quam tellus sed neque.

\n" - . "

Pellentesque vulputate sollicitudin justo, at faucibus nisl convallis in. Nulla facilisi. Curabitur nec mauris eu justo ultricies ultricies gravida eu ipsum. Pellentesque at nunc velit, vitae congue nisl. Nam varius imperdiet leo eu accumsan. Nullam elementum fermentum diam euismod porttitor. Etiam sed pellentesque ante. Donec in est elementum mi tempor consectetur. Fusce orci lorem, mollis at tincidunt eget, fringilla sed nunc. Ut consectetur condimentum condimentum. Phasellus sed felis non massa gravida euismod ut in tellus. Curabitur suscipit pharetra sapien vitae dignissim. Morbi id arcu nec ante viverra lobortis vitae nec quam. Mauris id gravida odio. Nunc non sem nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque hendrerit volutpat nisl id elementum. Vivamus lobortis iaculis nisi, sit amet tristique risus porttitor vel. Suspendisse potenti.

\n" - . "

Quisque aliquet sapien leo, vitae eleifend dolor. Fusce quis tincidunt nunc. Nam nec purus nulla, ac eleifend lorem. Curabitur eu quam et nibh egestas mattis. Maecenas eget felis augue. Integer scelerisque commodo urna, a pulvinar tortor euismod et. Praesent in nunc sapien. Ut iaculis auctor neque, sit amet rutrum est faucibus vitae. Sed a sagittis quam. Quisque interdum luctus fringilla. Vestibulum vitae nunc in felis luctus ultricies at id magna. Nam volutpat sapien ac lorem interdum pellentesque. Suspendisse faucibus, leo vitae laoreet interdum, mi mi pulvinar neque, sit amet tristique sapien nulla nec dolor. Etiam non ligula augue.

\n" - . "

Vivamus purus elit, ornare eget accumsan ut, luctus et orci. Sed vestibulum turpis ut quam vehicula id hendrerit velit suscipit. Pellentesque pulvinar, libero vitae sagittis scelerisque, felis ante faucibus risus, ut viverra velit mi at tortor. Aliquam lacinia condimentum felis, eu elementum ligula laoreet vitae. Sed placerat tempus turpis a fringilla. Etiam porta accumsan feugiat. Phasellus et cursus magna. Suspendisse vitae odio sit amet urna vulputate consectetur. Vestibulum massa magna, sagittis at dictum vitae, sagittis scelerisque erat. Donec viverra tincidunt lacus. Maecenas fermentum erat et mauris tincidunt sed eleifend quam tempus. In at augue mi, in tincidunt arcu. Duis dapibus aliquet mi, ac ullamcorper est semper quis. Sed nec nulla nec odio malesuada viverra id sed nulla. Donec lobortis euismod aliquam. Praesent sit amet dolor quis lacus auctor lobortis. In hac habitasse platea dictumst. Sed at nisi sed nisi ullamcorper pellentesque. Vivamus eget enim sem, non laoreet leo. Sed vel odio lacus.

\n" - . $bookEnd; - -$chapter2 = - "

Vivamus bibendum massa

\n" - . "

\"Demo

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter3 = array(); -$chapter3[] = $content_start . "

Chapter 3

\n" - . "

Vivamus bibendum massa 3A

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; -$chapter3[] = $content_start . "

Vivamus bibendum massa 3B

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter4 = $content_start . "

Chapter 4

\n" - . "

Vivamus bibendum massa

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat nulla ac libero dapibus ornare. Nam vel lacus in eros vehicula volutpat at ac est. Cras eleifend odio vitae nibh viverra et blandit nibh iaculis. Aenean non pellentesque nisi. Pellentesque ultricies mauris vel odio ullamcorper auctor. Etiam nec erat non mi blandit sollicitudin sed sed metus. Cras vel sagittis augue. Vestibulum eros neque, convallis vel semper in, fringilla sit amet justo. Proin lobortis est ut augue cursus egestas. Maecenas cursus blandit tellus vitae varius. Integer euismod malesuada volutpat. Praesent sem odio, consequat tristique dictum tincidunt, ultricies sit amet sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

\n" - . "

Pellentesque sit amet libero arcu, eu congue magna. Nam commodo, leo sed placerat sollicitudin, eros dolor vehicula ipsum, volutpat bibendum justo quam a turpis. Curabitur viverra ornare odio, aliquet accumsan nisi lobortis ut. Sed id mi non purus ultrices vestibulum eu ac justo. Nunc ultrices vulputate nulla eget porta. Nam iaculis arcu nec libero pretium eu ultricies enim porttitor. Praesent commodo, purus vel elementum egestas, sem nisl fermentum lorem, ac porttitor quam eros eget ante. Fusce diam eros, lacinia sit amet porttitor ac, lacinia quis mauris. Sed molestie, arcu id sodales malesuada, tortor diam faucibus diam, eget placerat tortor sapien ut est. Nam ut neque at nunc accumsan lacinia sed in neque. Nunc nec commodo eros. Suspendisse ut fringilla ipsum. Suspendisse eget neque nunc. Duis tincidunt consequat massa, vel vulputate ligula pretium a.

\n" - . "

Etiam blandit malesuada purus, sollicitudin eleifend magna consectetur ac. Aenean erat mi, varius non lacinia non, eleifend eget urna. Curabitur sagittis vestibulum magna vel dapibus. Phasellus tempus cursus tellus sed aliquet. Vivamus interdum tincidunt varius. Cras ut mi odio. Donec molestie vehicula justo, at congue arcu convallis nec. Proin sit amet libero ante. Nunc nec ante vel libero faucibus commodo ac at lacus. Pellentesque faucibus tellus sit amet odio viverra condimentum. Morbi ut est urna, quis laoreet diam. Aliquam vulputate risus rhoncus massa lobortis porta. Nulla eleifend suscipit interdum. Praesent dictum lobortis urna in facilisis. Proin adipiscing pulvinar accumsan. Maecenas ac lacus vitae erat porta malesuada. Proin malesuada, quam nec cursus suscipit, metus ligula accumsan tortor, non ullamcorper dui dui eget odio. In et massa vel ligula condimentum mollis. Vestibulum ac consectetur risus. Etiam at odio velit, quis blandit ante.

\n" - . "

Sed suscipit enim tortor. Curabitur ut dui dui, at tempus purus. Proin nulla velit, varius et ultricies at, pellentesque ac lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam commodo odio non leo commodo posuere. Integer sed mauris lacus. Aliquam nec diam velit, non volutpat metus. Vestibulum accumsan dignissim hendrerit. Nam elementum blandit pellentesque. Aliquam erat volutpat. Mauris ultrices metus ac enim pellentesque dignissim. Maecenas pellentesque interdum ligula, at imperdiet ipsum aliquam eu. Pellentesque pellentesque libero eget lacus placerat vel malesuada quam facilisis. Ut at nulla lacus. Nam et metus non velit accumsan pretium. Vestibulum eget iaculis nunc. In imperdiet lobortis tortor non eleifend.

\n" - . "

Mauris vel gravida mauris. Aliquam eleifend cursus auctor. Nulla mattis nisl sit amet sem varius eu consequat felis volutpat. Mauris leo nibh, lobortis eget interdum id, rhoncus ut nulla. Donec pretium aliquet dictum. Quisque facilisis, urna id accumsan auctor, quam turpis eleifend sem, ac pulvinar dui tellus eget sapien. Proin ut lorem sit amet velit pretium eleifend eget et velit. Proin facilisis arcu at nisl iaculis in vehicula tellus tristique. Sed in quam augue, elementum scelerisque ligula. Proin nec viverra urna. Integer sed dui orci, pulvinar cursus ante. Cras leo felis, vehicula aliquet convallis quis, aliquet vel dui. Vivamus non urna vitae augue scelerisque sagittis ac vitae sem. Aliquam sagittis, felis nec vestibulum ultricies, nisi tellus varius sapien, in pellentesque orci libero sed tellus. Duis id ante ipsum, id tincidunt leo. Phasellus cursus, nisl sit amet sodales pretium, turpis enim fringilla nisi, quis adipiscing felis velit in orci. Praesent sit amet lacus libero. Maecenas ac lorem quis metus tempus commodo eu nec justo. Nunc vitae dolor at orci ullamcorper pretium. In hac habitasse platea dictumst.

\n" - . "

Quisque rhoncus, nulla id viverra elementum, orci lorem lobortis enim, et fermentum erat massa et velit. Duis ullamcorper tempus laoreet. Quisque a massa vel magna viverra faucibus quis et erat. Praesent eu nulla a augue dignissim mattis. Nam ullamcorper pretium lobortis. Sed in quam vel leo dictum mattis. Quisque sapien est, consectetur et posuere sit amet, scelerisque at nulla. Proin sodales ultricies porttitor. Vestibulum sed dui lectus, sit amet hendrerit elit. Nunc nunc tortor, convallis sit amet vestibulum tempor, consequat sit amet arcu. Fusce congue scelerisque ante nec condimentum. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ligula ante, aliquet nec ornare in, commodo ut metus. Cras varius tempor justo at dictum. Cras tincidunt posuere consectetur. Pellentesque fringilla, augue ac aliquet blandit, ante nunc accumsan eros, lacinia vehicula eros magna non est. Donec neque sapien, eleifend id mollis facilisis, fermentum eget metus. Nunc a ante lorem, vitae lacinia augue. Maecenas cursus aliquam dui.

\n" - . "

Donec mollis nisi nec enim mattis vitae accumsan enim elementum. In rhoncus blandit odio, in facilisis nisl placerat in. Aenean vestibulum felis id dolor imperdiet tristique. Etiam ac urna eu nunc vestibulum euismod. Nulla mi magna, viverra at scelerisque non, rhoncus tempus libero. Sed facilisis, ante ullamcorper cursus placerat, orci turpis sagittis lectus, at placerat urna lorem elementum tortor. Vivamus felis mi, dictum et accumsan ut, lobortis vehicula libero. Suspendisse tellus arcu, malesuada vitae feugiat ut, vulputate sit amet sem. Pellentesque molestie, neque non rhoncus blandit, sapien dui pretium erat, eu tincidunt augue quam convallis nulla. Integer at adipiscing metus. Vestibulum felis urna, interdum eu egestas quis, iaculis a lacus. Aliquam nec urna nisl, id dignissim enim. Sed commodo vulputate turpis, ac dapibus nulla tincidunt et. Nam id nisl libero, in feugiat velit. Pellentesque lobortis adipiscing nisl sit amet rhoncus. Curabitur vulputate, ipsum a viverra ultrices, quam augue vulputate odio, pharetra placerat lorem tortor ac risus. Nunc egestas nisi vel orci venenatis iaculis. Phasellus facilisis risus et velit ultrices pulvinar. Donec convallis leo vel nisl lacinia luctus. Praesent non justo vitae eros malesuada auctor.

\n" - . "

Etiam dignissim, augue eu malesuada faucibus, quam risus rhoncus libero, consectetur molestie nisl lacus eu nisl. Maecenas a nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla urna, lobortis lacinia semper at, laoreet vitae arcu. Pellentesque pretium ultrices velit, nec interdum risus aliquet a. Donec nec nunc turpis, non sagittis magna. Donec eget dolor purus, eget sodales diam. Aliquam elementum dui eget augue commodo sit amet fermentum sem venenatis. Quisque tristique ligula sit amet nulla condimentum commodo. Donec placerat quam eget justo lacinia vitae malesuada mauris sodales. Vestibulum bibendum sem sit amet ante sagittis dignissim. Nullam placerat, enim ut suscipit ultricies, lacus mi hendrerit lorem, sit amet vestibulum libero elit ut lorem. Integer laoreet commodo aliquet. Suspendisse eget velit enim. Nam tellus tortor, hendrerit eget pulvinar id, iaculis nec leo. Donec mattis semper libero vitae laoreet. Phasellus vitae velit ut neque suscipit lobortis non at justo. Curabitur viverra nisl eu odio varius vitae pellentesque erat luctus. Phasellus porta blandit pulvinar.

\n" - . "

Donec rhoncus nunc sed ligula posuere a viverra nunc iaculis. Sed non dignissim nulla. Phasellus a nisl nec metus bibendum vulputate eu et ligula. Quisque dignissim quam id erat elementum cursus. Sed quis nisi nec lacus ullamcorper commodo. Nulla in lacinia odio. Vivamus metus turpis, tristique sed rutrum malesuada, pretium sed felis. Aliquam erat volutpat. Vestibulum eu elit porta tellus placerat consequat. Morbi sem nunc, vulputate sed scelerisque ut, feugiat et leo. Nam pellentesque metus eget ipsum feugiat euismod. Mauris nec enim sit amet turpis rutrum gravida. Cras velit nisl, tincidunt at mattis euismod, aliquet et urna. Sed pellentesque, magna at tristique pellentesque, metus est malesuada dolor, id lobortis eros justo in quam. In in lectus et arcu volutpat lacinia at ac nisl.

\n" - . "

Chapter 4B
test inlined chapter

\n" - . "

Vivamus bibendum massa

\n" - . "

Proin condimentum nisl tristique sapien luctus id ultrices magna molestie. Nulla nibh ligula, suscipit eget pharetra at, commodo et ligula. Quisque odio mi, aliquam a pulvinar id, condimentum vel dolor. In ut nisi eget orci facilisis pretium. Integer vel convallis nisi. Integer scelerisque luctus facilisis. Sed erat ante, adipiscing vel pretium eget, auctor quis eros. Donec tincidunt tempus porttitor. Phasellus in augue at nunc facilisis lacinia. Sed iaculis tristique diam at bibendum. Fusce lorem nibh, mollis semper pulvinar at, sollicitudin id velit. Donec aliquet, elit vel tempus sagittis, tortor nisl posuere turpis, in hendrerit mi justo id metus.

\n" - . "

Nulla facilisi. Integer non libero neque. Cras consequat risus sed quam placerat elementum. Ut placerat, massa at sagittis fermentum, libero risus tempus urna, ac commodo lorem massa sed metus. Sed at tellus nulla, id imperdiet arcu. Proin vehicula urna arcu, sit amet eleifend dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas fringilla risus eu nunc lacinia vel varius odio venenatis. Sed ultrices magna purus. Ut eu risus molestie mi posuere fringilla in sit amet libero. Nulla facilisi. Sed non nulla nec mi adipiscing molestie. Aenean consectetur nibh sit amet tortor ultrices in ultrices ante tempus. Phasellus non arcu purus. In libero tellus, pharetra sed lobortis eu, tristique non neque.

\n" - . "

Vivamus at odio id nisl egestas blandit. Sed sit amet ante urna, eget euismod justo. Cras adipiscing, purus vitae volutpat mollis, lectus massa tempor ligula, ut imperdiet erat lacus sit amet risus. Fusce erat tellus, adipiscing vitae fringilla at, pharetra eget ante. Sed sollicitudin dolor velit. Morbi suscipit turpis ac dui tincidunt nec tincidunt eros sagittis. Nulla et mauris vitae sapien commodo fermentum. Vivamus eget ante orci, id bibendum ipsum. Morbi ut neque tristique lorem pharetra rhoncus. Aliquam nisi odio, sollicitudin vel ornare quis, vestibulum sit amet magna. Cras ac augue quis mauris posuere convallis. Sed et nisi felis, in hendrerit tortor.

\n" - . "

Nulla viverra diam non quam fringilla sodales et quis purus. Quisque mi velit, bibendum eget sagittis eu, interdum ut est. Maecenas convallis elit non turpis lobortis iaculis. Vestibulum erat justo, tincidunt vel pellentesque sit amet, placerat quis erat. Aliquam et neque ac lorem scelerisque imperdiet porta non leo. Mauris lacinia sagittis erat, quis lacinia est commodo non. Suspendisse sed eros libero. Sed a velit lorem, consectetur facilisis nisi. Aliquam risus risus, lacinia sed rutrum ut, faucibus ut nisl. Fusce volutpat euismod purus non malesuada. Sed urna orci, ultricies a placerat vel, mattis id ante.

\n" - . "

Donec vitae ultrices tortor. Fusce luctus sollicitudin orci, nec tempus turpis tincidunt a. Nullam eu quam et magna aliquam viverra sed a tortor. Sed sem erat, tristique nec pellentesque quis, porta eu mi. Proin id ornare massa. Sed tincidunt, risus vitae fringilla porta, felis velit imperdiet justo, vel mattis lorem metus non metus. Sed condimentum leo non urna faucibus viverra aliquet est lobortis. Vivamus imperdiet velit quis odio fermentum eu luctus metus facilisis. Donec arcu tellus, commodo et semper in, aliquam vel lectus. Mauris tempus sagittis tortor eu blandit. Duis adipiscing accumsan commodo. Proin a arcu elit.

\n" - . "

Duis ut aliquam mauris. Vestibulum lobortis porta dolor at fermentum. Proin at elit lacus, quis accumsan turpis. Aenean molestie lobortis sollicitudin. Praesent velit est, molestie sed cursus id, consectetur non turpis. Quisque a purus dui, nec faucibus libero. Cras porta molestie elementum. Phasellus sit amet facilisis eros. Ut et mi malesuada mi cursus vulputate vitae et lectus. Sed ac massa quis nisi egestas convallis. Duis interdum aliquam dui, nec laoreet turpis auctor a. Mauris consectetur eros eu elit tempus tincidunt. Suspendisse tellus elit, viverra eu aliquam nec, auctor volutpat quam.

\n" - . "

Morbi pretium lectus laoreet sapien tincidunt ac volutpat erat ullamcorper. Vivamus dolor neque, blandit non ultrices vitae, mollis venenatis nisi. Fusce at mollis ante. Sed id libero id purus eleifend rutrum. Fusce eget lacus eget libero euismod elementum. Phasellus ac eros non mi luctus pulvinar vestibulum vitae nibh. Proin elementum ultricies mauris, non hendrerit massa egestas quis. Maecenas consectetur consequat quam, vitae tempor leo aliquam sed. Proin iaculis fringilla ante id laoreet. In facilisis vestibulum mollis. Etiam ut arcu mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at fermentum nisl. Proin odio justo, condimentum euismod mollis et, malesuada ac tortor. Aliquam ac elit euismod nibh pulvinar sodales id vitae nibh. Curabitur ut libero metus, eu bibendum turpis.

\n" - . "

Nam faucibus nibh non nulla aliquet id aliquet tortor tincidunt. Fusce at nisi ac mauris pulvinar vehicula at sed velit. Pellentesque vitae eros nec justo semper egestas ut id nisl. Quisque et est lectus. Cras eget nibh et odio pretium venenatis non nec tellus. Aliquam placerat odio non diam facilisis at sollicitudin turpis tempus. Etiam vitae magna dui, nec dignissim odio. Donec dui tellus, adipiscing vel dictum in, vehicula ut diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse est elit, porta non lobortis rutrum, placerat non urna. Integer nisi tellus, imperdiet ac dapibus at, interdum ut enim. Mauris fringilla tempus risus at dapibus. Quisque enim nunc, posuere vel dapibus vel, posuere vel sapien. Suspendisse potenti. Nullam pulvinar nibh nisi, nec porttitor nisi. Donec iaculis euismod elit at porttitor. Mauris quis nunc ut risus semper auctor. Pellentesque pulvinar cursus augue mattis luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\n" - . "

Pellentesque pharetra tincidunt velit, ac laoreet ipsum dictum quis. Cras hendrerit neque eu tellus pellentesque condimentum. Suspendisse metus mi, dignissim eu faucibus vel, molestie quis tortor. Suspendisse vel orci non orci gravida ultrices eu in dui. Vivamus vitae dolor vitae mauris congue auctor. Nulla iaculis, est tempor sagittis condimentum, libero erat fermentum libero, id dapibus tortor sem sit amet sapien. Pellentesque id ipsum eu elit pharetra tristique non ac nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis, lorem id elementum feugiat, orci arcu tincidunt diam, quis placerat sem lectus convallis nulla. Proin eget est quis libero molestie faucibus. Cras et est vitae lacus lacinia auctor. Mauris ligula justo, ullamcorper molestie fermentum vel, tincidunt at nunc. Sed ullamcorper fringilla lectus in pharetra. Sed libero erat, lobortis nec tempor ac, volutpat id orci. Phasellus orci elit, blandit a sollicitudin at, dignissim in mi. Ut facilisis gravida cursus. Duis risus lacus, pretium vitae egestas varius, interdum non ipsum.

\n" - . $bookEnd; - -$chapter5 = $content_start . "

Chapter 5

\n" - . "

Vivamus bibendum massa 5A

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat nulla ac libero dapibus ornare. Nam vel lacus in eros vehicula volutpat at ac est. Cras eleifend odio vitae nibh viverra et blandit nibh iaculis. Aenean non pellentesque nisi. Pellentesque ultricies mauris vel odio ullamcorper auctor. Etiam nec erat non mi blandit sollicitudin sed sed metus. Cras vel sagittis augue. Vestibulum eros neque, convallis vel semper in, fringilla sit amet justo. Proin lobortis est ut augue cursus egestas. Maecenas cursus blandit tellus vitae varius. Integer euismod malesuada volutpat. Praesent sem odio, consequat tristique dictum tincidunt, ultricies sit amet sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

\n" - . "

Pellentesque sit amet libero arcu, eu congue magna. Nam commodo, leo sed placerat sollicitudin, eros dolor vehicula ipsum, volutpat bibendum justo quam a turpis. Curabitur viverra ornare odio, aliquet accumsan nisi lobortis ut. Sed id mi non purus ultrices vestibulum eu ac justo. Nunc ultrices vulputate nulla eget porta. Nam iaculis arcu nec libero pretium eu ultricies enim porttitor. Praesent commodo, purus vel elementum egestas, sem nisl fermentum lorem, ac porttitor quam eros eget ante. Fusce diam eros, lacinia sit amet porttitor ac, lacinia quis mauris. Sed molestie, arcu id sodales malesuada, tortor diam faucibus diam, eget placerat tortor sapien ut est. Nam ut neque at nunc accumsan lacinia sed in neque. Nunc nec commodo eros. Suspendisse ut fringilla ipsum. Suspendisse eget neque nunc. Duis tincidunt consequat massa, vel vulputate ligula pretium a.

\n" - . "

Etiam blandit malesuada purus, sollicitudin eleifend magna consectetur ac. Aenean erat mi, varius non lacinia non, eleifend eget urna. Curabitur sagittis vestibulum magna vel dapibus. Phasellus tempus cursus tellus sed aliquet. Vivamus interdum tincidunt varius. Cras ut mi odio. Donec molestie vehicula justo, at congue arcu convallis nec. Proin sit amet libero ante. Nunc nec ante vel libero faucibus commodo ac at lacus. Pellentesque faucibus tellus sit amet odio viverra condimentum. Morbi ut est urna, quis laoreet diam. Aliquam vulputate risus rhoncus massa lobortis porta. Nulla eleifend suscipit interdum. Praesent dictum lobortis urna in facilisis. Proin adipiscing pulvinar accumsan. Maecenas ac lacus vitae erat porta malesuada. Proin malesuada, quam nec cursus suscipit, metus ligula accumsan tortor, non ullamcorper dui dui eget odio. In et massa vel ligula condimentum mollis. Vestibulum ac consectetur risus. Etiam at odio velit, quis blandit ante.

\n" - . "

Sed suscipit enim tortor. Curabitur ut dui dui, at tempus purus. Proin nulla velit, varius et ultricies at, pellentesque ac lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam commodo odio non leo commodo posuere. Integer sed mauris lacus. Aliquam nec diam velit, non volutpat metus. Vestibulum accumsan dignissim hendrerit. Nam elementum blandit pellentesque. Aliquam erat volutpat. Mauris ultrices metus ac enim pellentesque dignissim. Maecenas pellentesque interdum ligula, at imperdiet ipsum aliquam eu. Pellentesque pellentesque libero eget lacus placerat vel malesuada quam facilisis. Ut at nulla lacus. Nam et metus non velit accumsan pretium. Vestibulum eget iaculis nunc. In imperdiet lobortis tortor non eleifend.

\n" - . "

Mauris vel gravida mauris. Aliquam eleifend cursus auctor. Nulla mattis nisl sit amet sem varius eu consequat felis volutpat. Mauris leo nibh, lobortis eget interdum id, rhoncus ut nulla. Donec pretium aliquet dictum. Quisque facilisis, urna id accumsan auctor, quam turpis eleifend sem, ac pulvinar dui tellus eget sapien. Proin ut lorem sit amet velit pretium eleifend eget et velit. Proin facilisis arcu at nisl iaculis in vehicula tellus tristique. Sed in quam augue, elementum scelerisque ligula. Proin nec viverra urna. Integer sed dui orci, pulvinar cursus ante. Cras leo felis, vehicula aliquet convallis quis, aliquet vel dui. Vivamus non urna vitae augue scelerisque sagittis ac vitae sem. Aliquam sagittis, felis nec vestibulum ultricies, nisi tellus varius sapien, in pellentesque orci libero sed tellus. Duis id ante ipsum, id tincidunt leo. Phasellus cursus, nisl sit amet sodales pretium, turpis enim fringilla nisi, quis adipiscing felis velit in orci. Praesent sit amet lacus libero. Maecenas ac lorem quis metus tempus commodo eu nec justo. Nunc vitae dolor at orci ullamcorper pretium. In hac habitasse platea dictumst.

\n" - . "

Quisque rhoncus, nulla id viverra elementum, orci lorem lobortis enim, et fermentum erat massa et velit. Duis ullamcorper tempus laoreet. Quisque a massa vel magna viverra faucibus quis et erat. Praesent eu nulla a augue dignissim mattis. Nam ullamcorper pretium lobortis. Sed in quam vel leo dictum mattis. Quisque sapien est, consectetur et posuere sit amet, scelerisque at nulla. Proin sodales ultricies porttitor. Vestibulum sed dui lectus, sit amet hendrerit elit. Nunc nunc tortor, convallis sit amet vestibulum tempor, consequat sit amet arcu. Fusce congue scelerisque ante nec condimentum. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ligula ante, aliquet nec ornare in, commodo ut metus. Cras varius tempor justo at dictum. Cras tincidunt posuere consectetur. Pellentesque fringilla, augue ac aliquet blandit, ante nunc accumsan eros, lacinia vehicula eros magna non est. Donec neque sapien, eleifend id mollis facilisis, fermentum eget metus. Nunc a ante lorem, vitae lacinia augue. Maecenas cursus aliquam dui.

\n" - . "

Donec mollis nisi nec enim mattis vitae accumsan enim elementum. In rhoncus blandit odio, in facilisis nisl placerat in. Aenean vestibulum felis id dolor imperdiet tristique. Etiam ac urna eu nunc vestibulum euismod. Nulla mi magna, viverra at scelerisque non, rhoncus tempus libero. Sed facilisis, ante ullamcorper cursus placerat, orci turpis sagittis lectus, at placerat urna lorem elementum tortor. Vivamus felis mi, dictum et accumsan ut, lobortis vehicula libero. Suspendisse tellus arcu, malesuada vitae feugiat ut, vulputate sit amet sem. Pellentesque molestie, neque non rhoncus blandit, sapien dui pretium erat, eu tincidunt augue quam convallis nulla. Integer at adipiscing metus. Vestibulum felis urna, interdum eu egestas quis, iaculis a lacus. Aliquam nec urna nisl, id dignissim enim. Sed commodo vulputate turpis, ac dapibus nulla tincidunt et. Nam id nisl libero, in feugiat velit. Pellentesque lobortis adipiscing nisl sit amet rhoncus. Curabitur vulputate, ipsum a viverra ultrices, quam augue vulputate odio, pharetra placerat lorem tortor ac risus. Nunc egestas nisi vel orci venenatis iaculis. Phasellus facilisis risus et velit ultrices pulvinar. Donec convallis leo vel nisl lacinia luctus. Praesent non justo vitae eros malesuada auctor.

\n" - . "

Etiam dignissim, augue eu malesuada faucibus, quam risus rhoncus libero, consectetur molestie nisl lacus eu nisl. Maecenas a nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla urna, lobortis lacinia semper at, laoreet vitae arcu. Pellentesque pretium ultrices velit, nec interdum risus aliquet a. Donec nec nunc turpis, non sagittis magna. Donec eget dolor purus, eget sodales diam. Aliquam elementum dui eget augue commodo sit amet fermentum sem venenatis. Quisque tristique ligula sit amet nulla condimentum commodo. Donec placerat quam eget justo lacinia vitae malesuada mauris sodales. Vestibulum bibendum sem sit amet ante sagittis dignissim. Nullam placerat, enim ut suscipit ultricies, lacus mi hendrerit lorem, sit amet vestibulum libero elit ut lorem. Integer laoreet commodo aliquet. Suspendisse eget velit enim. Nam tellus tortor, hendrerit eget pulvinar id, iaculis nec leo. Donec mattis semper libero vitae laoreet. Phasellus vitae velit ut neque suscipit lobortis non at justo. Curabitur viverra nisl eu odio varius vitae pellentesque erat luctus. Phasellus porta blandit pulvinar.

\n" - . "

Donec rhoncus nunc sed ligula posuere a viverra nunc iaculis. Sed non dignissim nulla. Phasellus a nisl nec metus bibendum vulputate eu et ligula. Quisque dignissim quam id erat elementum cursus. Sed quis nisi nec lacus ullamcorper commodo. Nulla in lacinia odio. Vivamus metus turpis, tristique sed rutrum malesuada, pretium sed felis. Aliquam erat volutpat. Vestibulum eu elit porta tellus placerat consequat. Morbi sem nunc, vulputate sed scelerisque ut, feugiat et leo. Nam pellentesque metus eget ipsum feugiat euismod. Mauris nec enim sit amet turpis rutrum gravida. Cras velit nisl, tincidunt at mattis euismod, aliquet et urna. Sed pellentesque, magna at tristique pellentesque, metus est malesuada dolor, id lobortis eros justo in quam. In in lectus et arcu volutpat lacinia at ac nisl.

\n" - . "

Chapter 5B
test inlined chapter

\n" - . "

Vivamus bibendum massa 5B

\n" - . "

Proin condimentum nisl tristique sapien luctus id ultrices magna molestie. Nulla nibh ligula, suscipit eget pharetra at, commodo et ligula. Quisque odio mi, aliquam a pulvinar id, condimentum vel dolor. In ut nisi eget orci facilisis pretium. Integer vel convallis nisi. Integer scelerisque luctus facilisis. Sed erat ante, adipiscing vel pretium eget, auctor quis eros. Donec tincidunt tempus porttitor. Phasellus in augue at nunc facilisis lacinia. Sed iaculis tristique diam at bibendum. Fusce lorem nibh, mollis semper pulvinar at, sollicitudin id velit. Donec aliquet, elit vel tempus sagittis, tortor nisl posuere turpis, in hendrerit mi justo id metus.

\n" - . "

Nulla facilisi. Integer non libero neque. Cras consequat risus sed quam placerat elementum. Ut placerat, massa at sagittis fermentum, libero risus tempus urna, ac commodo lorem massa sed metus. Sed at tellus nulla, id imperdiet arcu. Proin vehicula urna arcu, sit amet eleifend dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas fringilla risus eu nunc lacinia vel varius odio venenatis. Sed ultrices magna purus. Ut eu risus molestie mi posuere fringilla in sit amet libero. Nulla facilisi. Sed non nulla nec mi adipiscing molestie. Aenean consectetur nibh sit amet tortor ultrices in ultrices ante tempus. Phasellus non arcu purus. In libero tellus, pharetra sed lobortis eu, tristique non neque.

\n" - . "

Vivamus at odio id nisl egestas blandit. Sed sit amet ante urna, eget euismod justo. Cras adipiscing, purus vitae volutpat mollis, lectus massa tempor ligula, ut imperdiet erat lacus sit amet risus. Fusce erat tellus, adipiscing vitae fringilla at, pharetra eget ante. Sed sollicitudin dolor velit. Morbi suscipit turpis ac dui tincidunt nec tincidunt eros sagittis. Nulla et mauris vitae sapien commodo fermentum. Vivamus eget ante orci, id bibendum ipsum. Morbi ut neque tristique lorem pharetra rhoncus. Aliquam nisi odio, sollicitudin vel ornare quis, vestibulum sit amet magna. Cras ac augue quis mauris posuere convallis. Sed et nisi felis, in hendrerit tortor.

\n" - . "

Nulla viverra diam non quam fringilla sodales et quis purus. Quisque mi velit, bibendum eget sagittis eu, interdum ut est. Maecenas convallis elit non turpis lobortis iaculis. Vestibulum erat justo, tincidunt vel pellentesque sit amet, placerat quis erat. Aliquam et neque ac lorem scelerisque imperdiet porta non leo. Mauris lacinia sagittis erat, quis lacinia est commodo non. Suspendisse sed eros libero. Sed a velit lorem, consectetur facilisis nisi. Aliquam risus risus, lacinia sed rutrum ut, faucibus ut nisl. Fusce volutpat euismod purus non malesuada. Sed urna orci, ultricies a placerat vel, mattis id ante.

\n" - . "

Donec vitae ultrices tortor. Fusce luctus sollicitudin orci, nec tempus turpis tincidunt a. Nullam eu quam et magna aliquam viverra sed a tortor. Sed sem erat, tristique nec pellentesque quis, porta eu mi. Proin id ornare massa. Sed tincidunt, risus vitae fringilla porta, felis velit imperdiet justo, vel mattis lorem metus non metus. Sed condimentum leo non urna faucibus viverra aliquet est lobortis. Vivamus imperdiet velit quis odio fermentum eu luctus metus facilisis. Donec arcu tellus, commodo et semper in, aliquam vel lectus. Mauris tempus sagittis tortor eu blandit. Duis adipiscing accumsan commodo. Proin a arcu elit.

\n" - . "

Duis ut aliquam mauris. Vestibulum lobortis porta dolor at fermentum. Proin at elit lacus, quis accumsan turpis. Aenean molestie lobortis sollicitudin. Praesent velit est, molestie sed cursus id, consectetur non turpis. Quisque a purus dui, nec faucibus libero. Cras porta molestie elementum. Phasellus sit amet facilisis eros. Ut et mi malesuada mi cursus vulputate vitae et lectus. Sed ac massa quis nisi egestas convallis. Duis interdum aliquam dui, nec laoreet turpis auctor a. Mauris consectetur eros eu elit tempus tincidunt. Suspendisse tellus elit, viverra eu aliquam nec, auctor volutpat quam.

\n" - . "

Morbi pretium lectus laoreet sapien tincidunt ac volutpat erat ullamcorper. Vivamus dolor neque, blandit non ultrices vitae, mollis venenatis nisi. Fusce at mollis ante. Sed id libero id purus eleifend rutrum. Fusce eget lacus eget libero euismod elementum. Phasellus ac eros non mi luctus pulvinar vestibulum vitae nibh. Proin elementum ultricies mauris, non hendrerit massa egestas quis. Maecenas consectetur consequat quam, vitae tempor leo aliquam sed. Proin iaculis fringilla ante id laoreet. In facilisis vestibulum mollis. Etiam ut arcu mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at fermentum nisl. Proin odio justo, condimentum euismod mollis et, malesuada ac tortor. Aliquam ac elit euismod nibh pulvinar sodales id vitae nibh. Curabitur ut libero metus, eu bibendum turpis.

\n" - . "

Nam faucibus nibh non nulla aliquet id aliquet tortor tincidunt. Fusce at nisi ac mauris pulvinar vehicula at sed velit. Pellentesque vitae eros nec justo semper egestas ut id nisl. Quisque et est lectus. Cras eget nibh et odio pretium venenatis non nec tellus. Aliquam placerat odio non diam facilisis at sollicitudin turpis tempus. Etiam vitae magna dui, nec dignissim odio. Donec dui tellus, adipiscing vel dictum in, vehicula ut diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse est elit, porta non lobortis rutrum, placerat non urna. Integer nisi tellus, imperdiet ac dapibus at, interdum ut enim. Mauris fringilla tempus risus at dapibus. Quisque enim nunc, posuere vel dapibus vel, posuere vel sapien. Suspendisse potenti. Nullam pulvinar nibh nisi, nec porttitor nisi. Donec iaculis euismod elit at porttitor. Mauris quis nunc ut risus semper auctor. Pellentesque pulvinar cursus augue mattis luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\n" - . "

Pellentesque pharetra tincidunt velit, ac laoreet ipsum dictum quis. Cras hendrerit neque eu tellus pellentesque condimentum. Suspendisse metus mi, dignissim eu faucibus vel, molestie quis tortor. Suspendisse vel orci non orci gravida ultrices eu in dui. Vivamus vitae dolor vitae mauris congue auctor. Nulla iaculis, est tempor sagittis condimentum, libero erat fermentum libero, id dapibus tortor sem sit amet sapien. Pellentesque id ipsum eu elit pharetra tristique non ac nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis, lorem id elementum feugiat, orci arcu tincidunt diam, quis placerat sem lectus convallis nulla. Proin eget est quis libero molestie faucibus. Cras et est vitae lacus lacinia auctor. Mauris ligula justo, ullamcorper molestie fermentum vel, tincidunt at nunc. Sed ullamcorper fringilla lectus in pharetra. Sed libero erat, lobortis nec tempor ac, volutpat id orci. Phasellus orci elit, blandit a sollicitudin at, dignissim in mi. Ut facilisis gravida cursus. Duis risus lacus, pretium vitae egestas varius, interdum non ipsum.

\n" - . $bookEnd; - -$log->logLine("Build Chapters"); - -$log->logLine("Add Chapter 1"); -$book->addChapter("Chapter 1: Lorem ipsum", "Chapter001.html", $chapter1, true, EPub::EXTERNAL_REF_ADD); - -$log->logLine("Add Chapter 2"); -$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $content_start . "

Chapter 2

\n" . $chapter2); - -// Chapter 2 contains an image reference "demo/DemoInlineImage.jpg" which we didn't get it to import -// automatically. So we will do that manually. -$log->logLine("Add referenced image from Chapter 2"); -$book->addLargeFile("demo/DemoInlineImage.jpg", "DemoInlineImage", "demo/DemoInlineImage.jpg", "image/jpeg"); - -$log->logLine("Add Chapter 3"); -$book->addChapter("Chapter 3: Vivamus bibendum massa again", "Chapter003.html", $chapter3); - -// Autosplit a chapter: -$log->logLine("Add Chapter 4"); -$book->setSplitSize(15000); // For this test, we split at approx 15k. Default is 250000 had we left it alone. -$book->addChapter("Chapter 4: Vivamus bibendum massa split", "Chapter004.html", $chapter4, true); -$book->setSplitSize(250000); - -$book->subLevel(); -$book->addChapter("Chapter 4B: test inlined chapter", "Chapter004.html#sub01"); -$book->backLevel(); - -// More advanced use of the splitter: -// Still using Chapter 4, but as you can see, "Chapter 4" also contains a header for Chapter 5. -require_once 'EPubChapterSplitter.php'; -$log->logLine("include EPubChapterSplitter.php"); - -$splitter = new EPubChapterSplitter(); -$splitter->setSplitSize(15000); // For this test, we split at approx 15k. Default is 250000 had we left it alone. -$log->logLine("new EPubChapterSplitter()"); - -/* Using the # as regexp delimiter here, it makes writing the regexp easier. - * in this case we could have just searched for "Chapter ", or if we were using regexp '#^

Chapter #i', - * using regular text (no regexp delimiters) will look for the text after the first tag. Meaning had we used - * "Chapter ", any paragraph or header starting with "Chapter " would have matched. The regexp equivalent of - * "Chapter " is '#^<.+?>Chapter #' - * Essentially, the search strnig is looking for lines starting with... - */ -$log->logLine("Add Chapter 5"); -$html2 = $splitter->splitChapter($chapter5, true, "Chapter ");/* '#^<.+?>Chapter \d*#i'); */ -$log->logLine("Split chapter 5"); - -$idx = 0; -while (list($k, $v) = each($html2)) { - $idx++; - // Because we used a string search in the splitter, the returned hits are put in the key part of the array. - // The entire HTML tag of the line matching the chapter search. - - // find the text inside the tags - preg_match('#^<(\w+)\ *.*?>(.+)$#i', $k, $cName); - - // because of the back reference, the tag name is in $cName[1], and the content is in $cName[2] - // Change any line breakes in the chapter name to " - " - $cName = preg_replace('##i', " - ", $cName[2]); - // Remove any other tags - $cName = preg_replace('#<.+?>#i', " ", $cName); - // clean the chapter name by removing any double spaces left behind to single space. - $cName = preg_replace('#\s+#i', " ", $cName); - - $book->addChapter($cName, "Chapter005_" . $idx . ".html", $v, true); -} - -// Notice that Chapter 1 have an image reference in paragraph 2? -// We can tell EPub to automatically load embedded images and other references: -// The parameters for addChapter are: -// 1: Chapter Name -// 2: File Name (in the book) -// 3: Chapter Data (HTML or array of HTML strings making up one chapter) -// 4: Auto Split Chapter (Default false) -// 5: External References, How to handle external references, default is EPub::EXTERNAL_REF_IGNORE -// 6: Base Dir, This is important, as this have to point to the root of the imported HTML, as seen from it's Document root. -// if you are importing an HTML designed to live in "http://server/story/book.html", $baseDir must be "story" -// It is used to resolve any links in the HTML. - -// BEWARE! -// Using EPub::EXTERNAL_REF_ADD means EPub will try to download the imagees from the internet if they are external. This WILL slow down book generation a lot. -// $book->addChapter("Chapter 6: External Image test", "Chapter006.html", $chapter1, false, EPub::EXTERNAL_REF_ADD, $fileDir); -//$log->logLine("add chapter 6"); - -$log->logLine("Add Chapter 6"); -$book->addChapter("Chapter 6: Local Image test", "Chapter006.html", $content_start . "

Chapter 6

\n" . $chapter2, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -// Chapter 7 tests level indentation -$chapter7Body = "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" . $bookEnd; - -$log->logLine("Add Chapter 7.0.0.0"); -$book->addChapter("Chapter 7", "Chapter00700.html", $content_start . "

Chapter 7.0.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.1.0.0"); -$book->subLevel(); -$book->addChapter("Chapter 7.1", "Chapter00710.html", $content_start . "

Chapter 7.1.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.1.1.0"); -$book->subLevel(); -$book->addChapter("Chapter 7.1.1", "Chapter00711.html", $content_start . "

Chapter 7.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.1.1"); -$book->subLevel(); -$book->addChapter("Chapter 7.1.1.1", "Chapter007111.html", $content_start . "

Chapter 7.1.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.1.2", "Chapter007112.html", $content_start . "

Chapter 7.1.1.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.2.0"); -$book->backLevel(); -$book->addChapter("Chapter 7.1.2", "Chapter007120.html", $content_start . "

Chapter 7.1.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.3.0"); -$book->addChapter("Chapter 7.1.3", "Chapter007130.html", $content_start . "

Chapter 7.1.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.3.x"); -$book->subLevel(); -$book->addChapter("Chapter 7.1.3.1", "Chapter007131.html", $content_start . "

Chapter 7.1.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.3.2", "Chapter007132.html", $content_start . "

Chapter 7.1.3.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.3.3", "Chapter007133.html", $content_start . "

Chapter 7.1.3.3

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.3.4", "Chapter007134.html", $content_start . "

Chapter 7.1.3.4

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.2.0.0"); -// We went deep with Chapter 7.1.3.x, and sometimes the generating class knows exactly where it is anyway, -// so instead of relying on multiple ->backLevel() calls, you can set the target level directly. -// This only works for going back in the hieracy. ->setCurrentLevel(1) (or less) equals ->rootLevel(); -$book->setCurrentLevel(2); -$book->addChapter("Chapter 7.2", "Chapter00720.html", $content_start . "

Chapter 7.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.3.0.0"); -$book->addChapter("Chapter 7.3", "Chapter00730.html", $content_start . "

Chapter 7.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.3.1.0"); -$book->subLevel(); -$book->addChapter("Chapter 7.3.1", "Chapter00731.html", $content_start . "

Chapter 7.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -// If you have nested chapters, you can call ->rootLevel() to return your hierachy to the root of the navMap. -$book->rootLevel(); - -// $log->logLine("Add TOC"); -// $book->buildTOC(); - -$book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n" . $bookEnd); - -if ($book->isLogging) { // Only used in case we need to debug EPub.php. - $epuplog = $book->getLog(); - $book->addChapter("ePubLog", "ePubLog.html", $content_start . $epuplog . "\n" . $bookEnd); -} - -$book->finalize(); // Finalize the book, and build the archive. - -// This is not really a part of the EPub class, but IF you have errors and want to know about them, -// they would have been written to the output buffer, preventing the book from being sent. -// This behaviour is desired as the book will then most likely be corrupt. -// However you might want to dump the output to a log, this example section can do that: -/* -if (ob_get_contents() !== false && ob_get_contents() != '') { - $f = fopen ('./log.txt', 'a') or die("Unable to open log.txt."); - fwrite($f, "\r\n" . date("D, d M Y H:i:s T") . ": Error in " . __FILE__ . ": \r\n"); - fwrite($f, ob_get_contents() . "\r\n"); - fclose($f); -} -*/ - -// Save book as a file relative to your script (for local ePub generation) -// Notice that the extions .epub will be added by the script. -// The second parameter is a directory name which is '.' by default. Don't use trailing slash! -//$book->saveBook('epub-filename', '.'); - -// Send the book to the client. ".epub" will be appended if missing. -$zipData = $book->sendBook("ExampleBook1"); - -// After this point your script should call exit. If anything is written to the output, -// it'll be appended to the end of the book, causing the epub file to become corrupt. -?> \ No newline at end of file diff --git a/EPub.Example2.php b/EPub.Example2.php deleted file mode 100644 index a407f55..0000000 --- a/EPub.Example2.php +++ /dev/null @@ -1,350 +0,0 @@ -\n" -. "\n" -. "\n" -. "" -. "\n" -. "\n" -. "Test Book\n" -. " \n" -. "\n"; - -$bookEnd = "\n\n"; - -// setting timezone for time functions used for logging to work properly -date_default_timezone_set('Europe/Berlin'); - -include_once("Logger.php"); -$log = new Logger("Example", TRUE); - -$fileDir = './PHPePub'; - -include_once("EPub.php"); -$log->logLine("include EPub"); - -$book = new EPub(); // Default is EPub::BOOK_VERSION_EPUB2 -$log->logLine("new EPub()"); -$log->logLine("EPub class version: " . EPub::VERSION); -$log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); -$log->logLine("Zip version: " . Zip::VERSION); -$log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); -$log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); - -// Title and Identifier are mandatory! -$book->setTitle("Test book"); -$book->setIdentifier("http://JohnJaneDoePublications.com/books/TestBook.html", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. -$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. -$book->setDescription("This is a brief description\nA test ePub book as an example of building a book in PHP"); -$book->setAuthor("John Doe Johnson", "Johnson, John Doe"); -$book->setPublisher("John and Jane Doe Publications", "http://JohnJaneDoePublications.com/"); // I hope this is a non existant address :) -$book->setDate(time()); // Strictly not needed as the book date defaults to time(). -$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. -$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBook.html"); - -$book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); - -$book->setSubject("Test book"); -$book->setSubject("keywords"); -$book->setSubject("Chapter levels"); - -// Insert custom meta data to the book, in this cvase, Calibre series index information. -$book->addCustomMetadata("calibre:series", "PHPePub Test books"); -$book->addCustomMetadata("calibre:series_index", "2"); - -$log->logLine("Set up parameters"); - -$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; - -$log->logLine("Add css"); -$book->addCSSFile("styles.css", "css1", $cssData); - -// This test requires you have an image, change "demo/cover-image.jpg" to match your location. -$log->logLine("Add Cover Image"); -$book->setCoverImage("Cover.jpg", file_get_contents("demo/cover-image.jpg"), "image/jpeg"); - -// A better way is to let EPub handle the image itself, as it may need resizing. Most Ebooks are only about 600x800 -// pixels, adding megapix images is a waste of place and spends bandwidth. setCoverImage can resize the image. -// When using this method, the given image path must be the absolute path from the servers Document root. - -/* $book->setCoverImage("/absolute/path/to/demo/cover-image.jpg"); */ - -// setCoverImage can only be called once per book, but can be called at any point in the book creation. -$log->logLine("Set Cover Image"); - -$cover = $content_start . "

Test Book

\n

By: John Doe Johnson

\n" . $bookEnd; -$book->addChapter("Notices", "Cover.html", $cover); - -$chapter1 = $content_start . "

Chapter 1

\n" - . "

Lorem ipsum

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec magna lorem, mattis sit amet porta vitae, consectetur ut eros. Nullam id mattis lacus. In eget neque magna, congue imperdiet nulla. Aenean erat lacus, imperdiet a adipiscing non, dignissim eget felis. Nulla facilisi. Vivamus sit amet lorem eget mauris dictum pharetra. In mauris nulla, placerat a accumsan ac, mollis sit amet ligula. Donec eget facilisis dui. Cras elit quam, imperdiet at malesuada vitae, luctus id orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque eu libero in leo ultrices tristique. Etiam quis ornare massa. Donec in velit leo. Sed eu ante tortor.

\n" - . "

\"TestNullam at tempus enim. Nunc et augue non lectus consequat rhoncus ac a odio. Morbi et tellus eget nisi volutpat tincidunt. Curabitur tristique neque tincidunt purus blandit bibendum. Maecenas eleifend sem quis magna semper id pulvinar nisi porttitor. In in lectus accumsan eros tristique pharetra sit amet ac nulla. Nam vitae felis et orci congue porta nec non ipsum. Donec pretium blandit accumsan. In aliquam lacinia nisi, ut venenatis mauris condimentum ut. Morbi rutrum orci et nisl accumsan euismod. Etiam viverra luctus sem pellentesque suscipit. Aliquam ultricies egestas risus at eleifend. Ut lacinia, tortor non varius malesuada, massa diam aliquet augue, vitae tempor metus tellus eget diam. Nulla vel augue eu elit adipiscing egestas. Duis et nulla est, ac congue arcu. Phasellus semper, ipsum et blandit rutrum, erat ante semper quam, at iaculis quam tellus sed neque.

\n" - . "

Pellentesque vulputate sollicitudin justo, at faucibus nisl convallis in. Nulla facilisi. Curabitur nec mauris eu justo ultricies ultricies gravida eu ipsum. Pellentesque at nunc velit, vitae congue nisl. Nam varius imperdiet leo eu accumsan. Nullam elementum fermentum diam euismod porttitor. Etiam sed pellentesque ante. Donec in est elementum mi tempor consectetur. Fusce orci lorem, mollis at tincidunt eget, fringilla sed nunc. Ut consectetur condimentum condimentum. Phasellus sed felis non massa gravida euismod ut in tellus. Curabitur suscipit pharetra sapien vitae dignissim. Morbi id arcu nec ante viverra lobortis vitae nec quam. Mauris id gravida odio. Nunc non sem nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque hendrerit volutpat nisl id elementum. Vivamus lobortis iaculis nisi, sit amet tristique risus porttitor vel. Suspendisse potenti.

\n" - . "

Quisque aliquet sapien leo, vitae eleifend dolor. Fusce quis tincidunt nunc. Nam nec purus nulla, ac eleifend lorem. Curabitur eu quam et nibh egestas mattis. Maecenas eget felis augue. Integer scelerisque commodo urna, a pulvinar tortor euismod et. Praesent in nunc sapien. Ut iaculis auctor neque, sit amet rutrum est faucibus vitae. Sed a sagittis quam. Quisque interdum luctus fringilla. Vestibulum vitae nunc in felis luctus ultricies at id magna. Nam volutpat sapien ac lorem interdum pellentesque. Suspendisse faucibus, leo vitae laoreet interdum, mi mi pulvinar neque, sit amet tristique sapien nulla nec dolor. Etiam non ligula augue.

\n" - . "

Vivamus purus elit, ornare eget accumsan ut, luctus et orci. Sed vestibulum turpis ut quam vehicula id hendrerit velit suscipit. Pellentesque pulvinar, libero vitae sagittis scelerisque, felis ante faucibus risus, ut viverra velit mi at tortor. Aliquam lacinia condimentum felis, eu elementum ligula laoreet vitae. Sed placerat tempus turpis a fringilla. Etiam porta accumsan feugiat. Phasellus et cursus magna. Suspendisse vitae odio sit amet urna vulputate consectetur. Vestibulum massa magna, sagittis at dictum vitae, sagittis scelerisque erat. Donec viverra tincidunt lacus. Maecenas fermentum erat et mauris tincidunt sed eleifend quam tempus. In at augue mi, in tincidunt arcu. Duis dapibus aliquet mi, ac ullamcorper est semper quis. Sed nec nulla nec odio malesuada viverra id sed nulla. Donec lobortis euismod aliquam. Praesent sit amet dolor quis lacus auctor lobortis. In hac habitasse platea dictumst. Sed at nisi sed nisi ullamcorper pellentesque. Vivamus eget enim sem, non laoreet leo. Sed vel odio lacus.

\n" - . $bookEnd; - -$chapter2 = - "

Vivamus bibendum massa

\n" - . "

\"Demo

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter3 = array(); -$chapter3[] = $content_start . "

Chapter 3

\n" - . "

Vivamus bibendum massa 3A

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; -$chapter3[] = $content_start . "

Vivamus bibendum massa 3B

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter4 = $content_start . "

Chapter 4

\n" - . "

Vivamus bibendum massa

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat nulla ac libero dapibus ornare. Nam vel lacus in eros vehicula volutpat at ac est. Cras eleifend odio vitae nibh viverra et blandit nibh iaculis. Aenean non pellentesque nisi. Pellentesque ultricies mauris vel odio ullamcorper auctor. Etiam nec erat non mi blandit sollicitudin sed sed metus. Cras vel sagittis augue. Vestibulum eros neque, convallis vel semper in, fringilla sit amet justo. Proin lobortis est ut augue cursus egestas. Maecenas cursus blandit tellus vitae varius. Integer euismod malesuada volutpat. Praesent sem odio, consequat tristique dictum tincidunt, ultricies sit amet sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

\n" - . "

Pellentesque sit amet libero arcu, eu congue magna. Nam commodo, leo sed placerat sollicitudin, eros dolor vehicula ipsum, volutpat bibendum justo quam a turpis. Curabitur viverra ornare odio, aliquet accumsan nisi lobortis ut. Sed id mi non purus ultrices vestibulum eu ac justo. Nunc ultrices vulputate nulla eget porta. Nam iaculis arcu nec libero pretium eu ultricies enim porttitor. Praesent commodo, purus vel elementum egestas, sem nisl fermentum lorem, ac porttitor quam eros eget ante. Fusce diam eros, lacinia sit amet porttitor ac, lacinia quis mauris. Sed molestie, arcu id sodales malesuada, tortor diam faucibus diam, eget placerat tortor sapien ut est. Nam ut neque at nunc accumsan lacinia sed in neque. Nunc nec commodo eros. Suspendisse ut fringilla ipsum. Suspendisse eget neque nunc. Duis tincidunt consequat massa, vel vulputate ligula pretium a.

\n" - . "

Etiam blandit malesuada purus, sollicitudin eleifend magna consectetur ac. Aenean erat mi, varius non lacinia non, eleifend eget urna. Curabitur sagittis vestibulum magna vel dapibus. Phasellus tempus cursus tellus sed aliquet. Vivamus interdum tincidunt varius. Cras ut mi odio. Donec molestie vehicula justo, at congue arcu convallis nec. Proin sit amet libero ante. Nunc nec ante vel libero faucibus commodo ac at lacus. Pellentesque faucibus tellus sit amet odio viverra condimentum. Morbi ut est urna, quis laoreet diam. Aliquam vulputate risus rhoncus massa lobortis porta. Nulla eleifend suscipit interdum. Praesent dictum lobortis urna in facilisis. Proin adipiscing pulvinar accumsan. Maecenas ac lacus vitae erat porta malesuada. Proin malesuada, quam nec cursus suscipit, metus ligula accumsan tortor, non ullamcorper dui dui eget odio. In et massa vel ligula condimentum mollis. Vestibulum ac consectetur risus. Etiam at odio velit, quis blandit ante.

\n" - . "

Sed suscipit enim tortor. Curabitur ut dui dui, at tempus purus. Proin nulla velit, varius et ultricies at, pellentesque ac lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam commodo odio non leo commodo posuere. Integer sed mauris lacus. Aliquam nec diam velit, non volutpat metus. Vestibulum accumsan dignissim hendrerit. Nam elementum blandit pellentesque. Aliquam erat volutpat. Mauris ultrices metus ac enim pellentesque dignissim. Maecenas pellentesque interdum ligula, at imperdiet ipsum aliquam eu. Pellentesque pellentesque libero eget lacus placerat vel malesuada quam facilisis. Ut at nulla lacus. Nam et metus non velit accumsan pretium. Vestibulum eget iaculis nunc. In imperdiet lobortis tortor non eleifend.

\n" - . "

Mauris vel gravida mauris. Aliquam eleifend cursus auctor. Nulla mattis nisl sit amet sem varius eu consequat felis volutpat. Mauris leo nibh, lobortis eget interdum id, rhoncus ut nulla. Donec pretium aliquet dictum. Quisque facilisis, urna id accumsan auctor, quam turpis eleifend sem, ac pulvinar dui tellus eget sapien. Proin ut lorem sit amet velit pretium eleifend eget et velit. Proin facilisis arcu at nisl iaculis in vehicula tellus tristique. Sed in quam augue, elementum scelerisque ligula. Proin nec viverra urna. Integer sed dui orci, pulvinar cursus ante. Cras leo felis, vehicula aliquet convallis quis, aliquet vel dui. Vivamus non urna vitae augue scelerisque sagittis ac vitae sem. Aliquam sagittis, felis nec vestibulum ultricies, nisi tellus varius sapien, in pellentesque orci libero sed tellus. Duis id ante ipsum, id tincidunt leo. Phasellus cursus, nisl sit amet sodales pretium, turpis enim fringilla nisi, quis adipiscing felis velit in orci. Praesent sit amet lacus libero. Maecenas ac lorem quis metus tempus commodo eu nec justo. Nunc vitae dolor at orci ullamcorper pretium. In hac habitasse platea dictumst.

\n" - . "

Quisque rhoncus, nulla id viverra elementum, orci lorem lobortis enim, et fermentum erat massa et velit. Duis ullamcorper tempus laoreet. Quisque a massa vel magna viverra faucibus quis et erat. Praesent eu nulla a augue dignissim mattis. Nam ullamcorper pretium lobortis. Sed in quam vel leo dictum mattis. Quisque sapien est, consectetur et posuere sit amet, scelerisque at nulla. Proin sodales ultricies porttitor. Vestibulum sed dui lectus, sit amet hendrerit elit. Nunc nunc tortor, convallis sit amet vestibulum tempor, consequat sit amet arcu. Fusce congue scelerisque ante nec condimentum. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ligula ante, aliquet nec ornare in, commodo ut metus. Cras varius tempor justo at dictum. Cras tincidunt posuere consectetur. Pellentesque fringilla, augue ac aliquet blandit, ante nunc accumsan eros, lacinia vehicula eros magna non est. Donec neque sapien, eleifend id mollis facilisis, fermentum eget metus. Nunc a ante lorem, vitae lacinia augue. Maecenas cursus aliquam dui.

\n" - . "

Donec mollis nisi nec enim mattis vitae accumsan enim elementum. In rhoncus blandit odio, in facilisis nisl placerat in. Aenean vestibulum felis id dolor imperdiet tristique. Etiam ac urna eu nunc vestibulum euismod. Nulla mi magna, viverra at scelerisque non, rhoncus tempus libero. Sed facilisis, ante ullamcorper cursus placerat, orci turpis sagittis lectus, at placerat urna lorem elementum tortor. Vivamus felis mi, dictum et accumsan ut, lobortis vehicula libero. Suspendisse tellus arcu, malesuada vitae feugiat ut, vulputate sit amet sem. Pellentesque molestie, neque non rhoncus blandit, sapien dui pretium erat, eu tincidunt augue quam convallis nulla. Integer at adipiscing metus. Vestibulum felis urna, interdum eu egestas quis, iaculis a lacus. Aliquam nec urna nisl, id dignissim enim. Sed commodo vulputate turpis, ac dapibus nulla tincidunt et. Nam id nisl libero, in feugiat velit. Pellentesque lobortis adipiscing nisl sit amet rhoncus. Curabitur vulputate, ipsum a viverra ultrices, quam augue vulputate odio, pharetra placerat lorem tortor ac risus. Nunc egestas nisi vel orci venenatis iaculis. Phasellus facilisis risus et velit ultrices pulvinar. Donec convallis leo vel nisl lacinia luctus. Praesent non justo vitae eros malesuada auctor.

\n" - . "

Etiam dignissim, augue eu malesuada faucibus, quam risus rhoncus libero, consectetur molestie nisl lacus eu nisl. Maecenas a nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla urna, lobortis lacinia semper at, laoreet vitae arcu. Pellentesque pretium ultrices velit, nec interdum risus aliquet a. Donec nec nunc turpis, non sagittis magna. Donec eget dolor purus, eget sodales diam. Aliquam elementum dui eget augue commodo sit amet fermentum sem venenatis. Quisque tristique ligula sit amet nulla condimentum commodo. Donec placerat quam eget justo lacinia vitae malesuada mauris sodales. Vestibulum bibendum sem sit amet ante sagittis dignissim. Nullam placerat, enim ut suscipit ultricies, lacus mi hendrerit lorem, sit amet vestibulum libero elit ut lorem. Integer laoreet commodo aliquet. Suspendisse eget velit enim. Nam tellus tortor, hendrerit eget pulvinar id, iaculis nec leo. Donec mattis semper libero vitae laoreet. Phasellus vitae velit ut neque suscipit lobortis non at justo. Curabitur viverra nisl eu odio varius vitae pellentesque erat luctus. Phasellus porta blandit pulvinar.

\n" - . "

Donec rhoncus nunc sed ligula posuere a viverra nunc iaculis. Sed non dignissim nulla. Phasellus a nisl nec metus bibendum vulputate eu et ligula. Quisque dignissim quam id erat elementum cursus. Sed quis nisi nec lacus ullamcorper commodo. Nulla in lacinia odio. Vivamus metus turpis, tristique sed rutrum malesuada, pretium sed felis. Aliquam erat volutpat. Vestibulum eu elit porta tellus placerat consequat. Morbi sem nunc, vulputate sed scelerisque ut, feugiat et leo. Nam pellentesque metus eget ipsum feugiat euismod. Mauris nec enim sit amet turpis rutrum gravida. Cras velit nisl, tincidunt at mattis euismod, aliquet et urna. Sed pellentesque, magna at tristique pellentesque, metus est malesuada dolor, id lobortis eros justo in quam. In in lectus et arcu volutpat lacinia at ac nisl.

\n" - . "

Chapter 4B
test inlined chapter

\n" - . "

Vivamus bibendum massa

\n" - . "

Proin condimentum nisl tristique sapien luctus id ultrices magna molestie. Nulla nibh ligula, suscipit eget pharetra at, commodo et ligula. Quisque odio mi, aliquam a pulvinar id, condimentum vel dolor. In ut nisi eget orci facilisis pretium. Integer vel convallis nisi. Integer scelerisque luctus facilisis. Sed erat ante, adipiscing vel pretium eget, auctor quis eros. Donec tincidunt tempus porttitor. Phasellus in augue at nunc facilisis lacinia. Sed iaculis tristique diam at bibendum. Fusce lorem nibh, mollis semper pulvinar at, sollicitudin id velit. Donec aliquet, elit vel tempus sagittis, tortor nisl posuere turpis, in hendrerit mi justo id metus.

\n" - . "

Nulla facilisi. Integer non libero neque. Cras consequat risus sed quam placerat elementum. Ut placerat, massa at sagittis fermentum, libero risus tempus urna, ac commodo lorem massa sed metus. Sed at tellus nulla, id imperdiet arcu. Proin vehicula urna arcu, sit amet eleifend dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas fringilla risus eu nunc lacinia vel varius odio venenatis. Sed ultrices magna purus. Ut eu risus molestie mi posuere fringilla in sit amet libero. Nulla facilisi. Sed non nulla nec mi adipiscing molestie. Aenean consectetur nibh sit amet tortor ultrices in ultrices ante tempus. Phasellus non arcu purus. In libero tellus, pharetra sed lobortis eu, tristique non neque.

\n" - . "

Vivamus at odio id nisl egestas blandit. Sed sit amet ante urna, eget euismod justo. Cras adipiscing, purus vitae volutpat mollis, lectus massa tempor ligula, ut imperdiet erat lacus sit amet risus. Fusce erat tellus, adipiscing vitae fringilla at, pharetra eget ante. Sed sollicitudin dolor velit. Morbi suscipit turpis ac dui tincidunt nec tincidunt eros sagittis. Nulla et mauris vitae sapien commodo fermentum. Vivamus eget ante orci, id bibendum ipsum. Morbi ut neque tristique lorem pharetra rhoncus. Aliquam nisi odio, sollicitudin vel ornare quis, vestibulum sit amet magna. Cras ac augue quis mauris posuere convallis. Sed et nisi felis, in hendrerit tortor.

\n" - . "

Nulla viverra diam non quam fringilla sodales et quis purus. Quisque mi velit, bibendum eget sagittis eu, interdum ut est. Maecenas convallis elit non turpis lobortis iaculis. Vestibulum erat justo, tincidunt vel pellentesque sit amet, placerat quis erat. Aliquam et neque ac lorem scelerisque imperdiet porta non leo. Mauris lacinia sagittis erat, quis lacinia est commodo non. Suspendisse sed eros libero. Sed a velit lorem, consectetur facilisis nisi. Aliquam risus risus, lacinia sed rutrum ut, faucibus ut nisl. Fusce volutpat euismod purus non malesuada. Sed urna orci, ultricies a placerat vel, mattis id ante.

\n" - . "

Donec vitae ultrices tortor. Fusce luctus sollicitudin orci, nec tempus turpis tincidunt a. Nullam eu quam et magna aliquam viverra sed a tortor. Sed sem erat, tristique nec pellentesque quis, porta eu mi. Proin id ornare massa. Sed tincidunt, risus vitae fringilla porta, felis velit imperdiet justo, vel mattis lorem metus non metus. Sed condimentum leo non urna faucibus viverra aliquet est lobortis. Vivamus imperdiet velit quis odio fermentum eu luctus metus facilisis. Donec arcu tellus, commodo et semper in, aliquam vel lectus. Mauris tempus sagittis tortor eu blandit. Duis adipiscing accumsan commodo. Proin a arcu elit.

\n" - . "

Duis ut aliquam mauris. Vestibulum lobortis porta dolor at fermentum. Proin at elit lacus, quis accumsan turpis. Aenean molestie lobortis sollicitudin. Praesent velit est, molestie sed cursus id, consectetur non turpis. Quisque a purus dui, nec faucibus libero. Cras porta molestie elementum. Phasellus sit amet facilisis eros. Ut et mi malesuada mi cursus vulputate vitae et lectus. Sed ac massa quis nisi egestas convallis. Duis interdum aliquam dui, nec laoreet turpis auctor a. Mauris consectetur eros eu elit tempus tincidunt. Suspendisse tellus elit, viverra eu aliquam nec, auctor volutpat quam.

\n" - . "

Morbi pretium lectus laoreet sapien tincidunt ac volutpat erat ullamcorper. Vivamus dolor neque, blandit non ultrices vitae, mollis venenatis nisi. Fusce at mollis ante. Sed id libero id purus eleifend rutrum. Fusce eget lacus eget libero euismod elementum. Phasellus ac eros non mi luctus pulvinar vestibulum vitae nibh. Proin elementum ultricies mauris, non hendrerit massa egestas quis. Maecenas consectetur consequat quam, vitae tempor leo aliquam sed. Proin iaculis fringilla ante id laoreet. In facilisis vestibulum mollis. Etiam ut arcu mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at fermentum nisl. Proin odio justo, condimentum euismod mollis et, malesuada ac tortor. Aliquam ac elit euismod nibh pulvinar sodales id vitae nibh. Curabitur ut libero metus, eu bibendum turpis.

\n" - . "

Nam faucibus nibh non nulla aliquet id aliquet tortor tincidunt. Fusce at nisi ac mauris pulvinar vehicula at sed velit. Pellentesque vitae eros nec justo semper egestas ut id nisl. Quisque et est lectus. Cras eget nibh et odio pretium venenatis non nec tellus. Aliquam placerat odio non diam facilisis at sollicitudin turpis tempus. Etiam vitae magna dui, nec dignissim odio. Donec dui tellus, adipiscing vel dictum in, vehicula ut diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse est elit, porta non lobortis rutrum, placerat non urna. Integer nisi tellus, imperdiet ac dapibus at, interdum ut enim. Mauris fringilla tempus risus at dapibus. Quisque enim nunc, posuere vel dapibus vel, posuere vel sapien. Suspendisse potenti. Nullam pulvinar nibh nisi, nec porttitor nisi. Donec iaculis euismod elit at porttitor. Mauris quis nunc ut risus semper auctor. Pellentesque pulvinar cursus augue mattis luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\n" - . "

Pellentesque pharetra tincidunt velit, ac laoreet ipsum dictum quis. Cras hendrerit neque eu tellus pellentesque condimentum. Suspendisse metus mi, dignissim eu faucibus vel, molestie quis tortor. Suspendisse vel orci non orci gravida ultrices eu in dui. Vivamus vitae dolor vitae mauris congue auctor. Nulla iaculis, est tempor sagittis condimentum, libero erat fermentum libero, id dapibus tortor sem sit amet sapien. Pellentesque id ipsum eu elit pharetra tristique non ac nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis, lorem id elementum feugiat, orci arcu tincidunt diam, quis placerat sem lectus convallis nulla. Proin eget est quis libero molestie faucibus. Cras et est vitae lacus lacinia auctor. Mauris ligula justo, ullamcorper molestie fermentum vel, tincidunt at nunc. Sed ullamcorper fringilla lectus in pharetra. Sed libero erat, lobortis nec tempor ac, volutpat id orci. Phasellus orci elit, blandit a sollicitudin at, dignissim in mi. Ut facilisis gravida cursus. Duis risus lacus, pretium vitae egestas varius, interdum non ipsum.

\n" - . $bookEnd; - -$chapter5 = $content_start . "

Chapter 5

\n" - . "

Vivamus bibendum massa

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat nulla ac libero dapibus ornare. Nam vel lacus in eros vehicula volutpat at ac est. Cras eleifend odio vitae nibh viverra et blandit nibh iaculis. Aenean non pellentesque nisi. Pellentesque ultricies mauris vel odio ullamcorper auctor. Etiam nec erat non mi blandit sollicitudin sed sed metus. Cras vel sagittis augue. Vestibulum eros neque, convallis vel semper in, fringilla sit amet justo. Proin lobortis est ut augue cursus egestas. Maecenas cursus blandit tellus vitae varius. Integer euismod malesuada volutpat. Praesent sem odio, consequat tristique dictum tincidunt, ultricies sit amet sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

\n" - . "

Pellentesque sit amet libero arcu, eu congue magna. Nam commodo, leo sed placerat sollicitudin, eros dolor vehicula ipsum, volutpat bibendum justo quam a turpis. Curabitur viverra ornare odio, aliquet accumsan nisi lobortis ut. Sed id mi non purus ultrices vestibulum eu ac justo. Nunc ultrices vulputate nulla eget porta. Nam iaculis arcu nec libero pretium eu ultricies enim porttitor. Praesent commodo, purus vel elementum egestas, sem nisl fermentum lorem, ac porttitor quam eros eget ante. Fusce diam eros, lacinia sit amet porttitor ac, lacinia quis mauris. Sed molestie, arcu id sodales malesuada, tortor diam faucibus diam, eget placerat tortor sapien ut est. Nam ut neque at nunc accumsan lacinia sed in neque. Nunc nec commodo eros. Suspendisse ut fringilla ipsum. Suspendisse eget neque nunc. Duis tincidunt consequat massa, vel vulputate ligula pretium a.

\n" - . "

Etiam blandit malesuada purus, sollicitudin eleifend magna consectetur ac. Aenean erat mi, varius non lacinia non, eleifend eget urna. Curabitur sagittis vestibulum magna vel dapibus. Phasellus tempus cursus tellus sed aliquet. Vivamus interdum tincidunt varius. Cras ut mi odio. Donec molestie vehicula justo, at congue arcu convallis nec. Proin sit amet libero ante. Nunc nec ante vel libero faucibus commodo ac at lacus. Pellentesque faucibus tellus sit amet odio viverra condimentum. Morbi ut est urna, quis laoreet diam. Aliquam vulputate risus rhoncus massa lobortis porta. Nulla eleifend suscipit interdum. Praesent dictum lobortis urna in facilisis. Proin adipiscing pulvinar accumsan. Maecenas ac lacus vitae erat porta malesuada. Proin malesuada, quam nec cursus suscipit, metus ligula accumsan tortor, non ullamcorper dui dui eget odio. In et massa vel ligula condimentum mollis. Vestibulum ac consectetur risus. Etiam at odio velit, quis blandit ante.

\n" - . "

Sed suscipit enim tortor. Curabitur ut dui dui, at tempus purus. Proin nulla velit, varius et ultricies at, pellentesque ac lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam commodo odio non leo commodo posuere. Integer sed mauris lacus. Aliquam nec diam velit, non volutpat metus. Vestibulum accumsan dignissim hendrerit. Nam elementum blandit pellentesque. Aliquam erat volutpat. Mauris ultrices metus ac enim pellentesque dignissim. Maecenas pellentesque interdum ligula, at imperdiet ipsum aliquam eu. Pellentesque pellentesque libero eget lacus placerat vel malesuada quam facilisis. Ut at nulla lacus. Nam et metus non velit accumsan pretium. Vestibulum eget iaculis nunc. In imperdiet lobortis tortor non eleifend.

\n" - . "

Mauris vel gravida mauris. Aliquam eleifend cursus auctor. Nulla mattis nisl sit amet sem varius eu consequat felis volutpat. Mauris leo nibh, lobortis eget interdum id, rhoncus ut nulla. Donec pretium aliquet dictum. Quisque facilisis, urna id accumsan auctor, quam turpis eleifend sem, ac pulvinar dui tellus eget sapien. Proin ut lorem sit amet velit pretium eleifend eget et velit. Proin facilisis arcu at nisl iaculis in vehicula tellus tristique. Sed in quam augue, elementum scelerisque ligula. Proin nec viverra urna. Integer sed dui orci, pulvinar cursus ante. Cras leo felis, vehicula aliquet convallis quis, aliquet vel dui. Vivamus non urna vitae augue scelerisque sagittis ac vitae sem. Aliquam sagittis, felis nec vestibulum ultricies, nisi tellus varius sapien, in pellentesque orci libero sed tellus. Duis id ante ipsum, id tincidunt leo. Phasellus cursus, nisl sit amet sodales pretium, turpis enim fringilla nisi, quis adipiscing felis velit in orci. Praesent sit amet lacus libero. Maecenas ac lorem quis metus tempus commodo eu nec justo. Nunc vitae dolor at orci ullamcorper pretium. In hac habitasse platea dictumst.

\n" - . "

Quisque rhoncus, nulla id viverra elementum, orci lorem lobortis enim, et fermentum erat massa et velit. Duis ullamcorper tempus laoreet. Quisque a massa vel magna viverra faucibus quis et erat. Praesent eu nulla a augue dignissim mattis. Nam ullamcorper pretium lobortis. Sed in quam vel leo dictum mattis. Quisque sapien est, consectetur et posuere sit amet, scelerisque at nulla. Proin sodales ultricies porttitor. Vestibulum sed dui lectus, sit amet hendrerit elit. Nunc nunc tortor, convallis sit amet vestibulum tempor, consequat sit amet arcu. Fusce congue scelerisque ante nec condimentum. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ligula ante, aliquet nec ornare in, commodo ut metus. Cras varius tempor justo at dictum. Cras tincidunt posuere consectetur. Pellentesque fringilla, augue ac aliquet blandit, ante nunc accumsan eros, lacinia vehicula eros magna non est. Donec neque sapien, eleifend id mollis facilisis, fermentum eget metus. Nunc a ante lorem, vitae lacinia augue. Maecenas cursus aliquam dui.

\n" - . "

Donec mollis nisi nec enim mattis vitae accumsan enim elementum. In rhoncus blandit odio, in facilisis nisl placerat in. Aenean vestibulum felis id dolor imperdiet tristique. Etiam ac urna eu nunc vestibulum euismod. Nulla mi magna, viverra at scelerisque non, rhoncus tempus libero. Sed facilisis, ante ullamcorper cursus placerat, orci turpis sagittis lectus, at placerat urna lorem elementum tortor. Vivamus felis mi, dictum et accumsan ut, lobortis vehicula libero. Suspendisse tellus arcu, malesuada vitae feugiat ut, vulputate sit amet sem. Pellentesque molestie, neque non rhoncus blandit, sapien dui pretium erat, eu tincidunt augue quam convallis nulla. Integer at adipiscing metus. Vestibulum felis urna, interdum eu egestas quis, iaculis a lacus. Aliquam nec urna nisl, id dignissim enim. Sed commodo vulputate turpis, ac dapibus nulla tincidunt et. Nam id nisl libero, in feugiat velit. Pellentesque lobortis adipiscing nisl sit amet rhoncus. Curabitur vulputate, ipsum a viverra ultrices, quam augue vulputate odio, pharetra placerat lorem tortor ac risus. Nunc egestas nisi vel orci venenatis iaculis. Phasellus facilisis risus et velit ultrices pulvinar. Donec convallis leo vel nisl lacinia luctus. Praesent non justo vitae eros malesuada auctor.

\n" - . "

Etiam dignissim, augue eu malesuada faucibus, quam risus rhoncus libero, consectetur molestie nisl lacus eu nisl. Maecenas a nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla urna, lobortis lacinia semper at, laoreet vitae arcu. Pellentesque pretium ultrices velit, nec interdum risus aliquet a. Donec nec nunc turpis, non sagittis magna. Donec eget dolor purus, eget sodales diam. Aliquam elementum dui eget augue commodo sit amet fermentum sem venenatis. Quisque tristique ligula sit amet nulla condimentum commodo. Donec placerat quam eget justo lacinia vitae malesuada mauris sodales. Vestibulum bibendum sem sit amet ante sagittis dignissim. Nullam placerat, enim ut suscipit ultricies, lacus mi hendrerit lorem, sit amet vestibulum libero elit ut lorem. Integer laoreet commodo aliquet. Suspendisse eget velit enim. Nam tellus tortor, hendrerit eget pulvinar id, iaculis nec leo. Donec mattis semper libero vitae laoreet. Phasellus vitae velit ut neque suscipit lobortis non at justo. Curabitur viverra nisl eu odio varius vitae pellentesque erat luctus. Phasellus porta blandit pulvinar.

\n" - . "

Donec rhoncus nunc sed ligula posuere a viverra nunc iaculis. Sed non dignissim nulla. Phasellus a nisl nec metus bibendum vulputate eu et ligula. Quisque dignissim quam id erat elementum cursus. Sed quis nisi nec lacus ullamcorper commodo. Nulla in lacinia odio. Vivamus metus turpis, tristique sed rutrum malesuada, pretium sed felis. Aliquam erat volutpat. Vestibulum eu elit porta tellus placerat consequat. Morbi sem nunc, vulputate sed scelerisque ut, feugiat et leo. Nam pellentesque metus eget ipsum feugiat euismod. Mauris nec enim sit amet turpis rutrum gravida. Cras velit nisl, tincidunt at mattis euismod, aliquet et urna. Sed pellentesque, magna at tristique pellentesque, metus est malesuada dolor, id lobortis eros justo in quam. In in lectus et arcu volutpat lacinia at ac nisl.

\n" - . "

Chapter 5B
test inlined chapter

\n" - . "

Vivamus bibendum massa

\n" - . "

Proin condimentum nisl tristique sapien luctus id ultrices magna molestie. Nulla nibh ligula, suscipit eget pharetra at, commodo et ligula. Quisque odio mi, aliquam a pulvinar id, condimentum vel dolor. In ut nisi eget orci facilisis pretium. Integer vel convallis nisi. Integer scelerisque luctus facilisis. Sed erat ante, adipiscing vel pretium eget, auctor quis eros. Donec tincidunt tempus porttitor. Phasellus in augue at nunc facilisis lacinia. Sed iaculis tristique diam at bibendum. Fusce lorem nibh, mollis semper pulvinar at, sollicitudin id velit. Donec aliquet, elit vel tempus sagittis, tortor nisl posuere turpis, in hendrerit mi justo id metus.

\n" - . "

Nulla facilisi. Integer non libero neque. Cras consequat risus sed quam placerat elementum. Ut placerat, massa at sagittis fermentum, libero risus tempus urna, ac commodo lorem massa sed metus. Sed at tellus nulla, id imperdiet arcu. Proin vehicula urna arcu, sit amet eleifend dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas fringilla risus eu nunc lacinia vel varius odio venenatis. Sed ultrices magna purus. Ut eu risus molestie mi posuere fringilla in sit amet libero. Nulla facilisi. Sed non nulla nec mi adipiscing molestie. Aenean consectetur nibh sit amet tortor ultrices in ultrices ante tempus. Phasellus non arcu purus. In libero tellus, pharetra sed lobortis eu, tristique non neque.

\n" - . "

Vivamus at odio id nisl egestas blandit. Sed sit amet ante urna, eget euismod justo. Cras adipiscing, purus vitae volutpat mollis, lectus massa tempor ligula, ut imperdiet erat lacus sit amet risus. Fusce erat tellus, adipiscing vitae fringilla at, pharetra eget ante. Sed sollicitudin dolor velit. Morbi suscipit turpis ac dui tincidunt nec tincidunt eros sagittis. Nulla et mauris vitae sapien commodo fermentum. Vivamus eget ante orci, id bibendum ipsum. Morbi ut neque tristique lorem pharetra rhoncus. Aliquam nisi odio, sollicitudin vel ornare quis, vestibulum sit amet magna. Cras ac augue quis mauris posuere convallis. Sed et nisi felis, in hendrerit tortor.

\n" - . "

Nulla viverra diam non quam fringilla sodales et quis purus. Quisque mi velit, bibendum eget sagittis eu, interdum ut est. Maecenas convallis elit non turpis lobortis iaculis. Vestibulum erat justo, tincidunt vel pellentesque sit amet, placerat quis erat. Aliquam et neque ac lorem scelerisque imperdiet porta non leo. Mauris lacinia sagittis erat, quis lacinia est commodo non. Suspendisse sed eros libero. Sed a velit lorem, consectetur facilisis nisi. Aliquam risus risus, lacinia sed rutrum ut, faucibus ut nisl. Fusce volutpat euismod purus non malesuada. Sed urna orci, ultricies a placerat vel, mattis id ante.

\n" - . "

Donec vitae ultrices tortor. Fusce luctus sollicitudin orci, nec tempus turpis tincidunt a. Nullam eu quam et magna aliquam viverra sed a tortor. Sed sem erat, tristique nec pellentesque quis, porta eu mi. Proin id ornare massa. Sed tincidunt, risus vitae fringilla porta, felis velit imperdiet justo, vel mattis lorem metus non metus. Sed condimentum leo non urna faucibus viverra aliquet est lobortis. Vivamus imperdiet velit quis odio fermentum eu luctus metus facilisis. Donec arcu tellus, commodo et semper in, aliquam vel lectus. Mauris tempus sagittis tortor eu blandit. Duis adipiscing accumsan commodo. Proin a arcu elit.

\n" - . "

Duis ut aliquam mauris. Vestibulum lobortis porta dolor at fermentum. Proin at elit lacus, quis accumsan turpis. Aenean molestie lobortis sollicitudin. Praesent velit est, molestie sed cursus id, consectetur non turpis. Quisque a purus dui, nec faucibus libero. Cras porta molestie elementum. Phasellus sit amet facilisis eros. Ut et mi malesuada mi cursus vulputate vitae et lectus. Sed ac massa quis nisi egestas convallis. Duis interdum aliquam dui, nec laoreet turpis auctor a. Mauris consectetur eros eu elit tempus tincidunt. Suspendisse tellus elit, viverra eu aliquam nec, auctor volutpat quam.

\n" - . "

Morbi pretium lectus laoreet sapien tincidunt ac volutpat erat ullamcorper. Vivamus dolor neque, blandit non ultrices vitae, mollis venenatis nisi. Fusce at mollis ante. Sed id libero id purus eleifend rutrum. Fusce eget lacus eget libero euismod elementum. Phasellus ac eros non mi luctus pulvinar vestibulum vitae nibh. Proin elementum ultricies mauris, non hendrerit massa egestas quis. Maecenas consectetur consequat quam, vitae tempor leo aliquam sed. Proin iaculis fringilla ante id laoreet. In facilisis vestibulum mollis. Etiam ut arcu mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at fermentum nisl. Proin odio justo, condimentum euismod mollis et, malesuada ac tortor. Aliquam ac elit euismod nibh pulvinar sodales id vitae nibh. Curabitur ut libero metus, eu bibendum turpis.

\n" - . "

Nam faucibus nibh non nulla aliquet id aliquet tortor tincidunt. Fusce at nisi ac mauris pulvinar vehicula at sed velit. Pellentesque vitae eros nec justo semper egestas ut id nisl. Quisque et est lectus. Cras eget nibh et odio pretium venenatis non nec tellus. Aliquam placerat odio non diam facilisis at sollicitudin turpis tempus. Etiam vitae magna dui, nec dignissim odio. Donec dui tellus, adipiscing vel dictum in, vehicula ut diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse est elit, porta non lobortis rutrum, placerat non urna. Integer nisi tellus, imperdiet ac dapibus at, interdum ut enim. Mauris fringilla tempus risus at dapibus. Quisque enim nunc, posuere vel dapibus vel, posuere vel sapien. Suspendisse potenti. Nullam pulvinar nibh nisi, nec porttitor nisi. Donec iaculis euismod elit at porttitor. Mauris quis nunc ut risus semper auctor. Pellentesque pulvinar cursus augue mattis luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\n" - . "

Pellentesque pharetra tincidunt velit, ac laoreet ipsum dictum quis. Cras hendrerit neque eu tellus pellentesque condimentum. Suspendisse metus mi, dignissim eu faucibus vel, molestie quis tortor. Suspendisse vel orci non orci gravida ultrices eu in dui. Vivamus vitae dolor vitae mauris congue auctor. Nulla iaculis, est tempor sagittis condimentum, libero erat fermentum libero, id dapibus tortor sem sit amet sapien. Pellentesque id ipsum eu elit pharetra tristique non ac nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis, lorem id elementum feugiat, orci arcu tincidunt diam, quis placerat sem lectus convallis nulla. Proin eget est quis libero molestie faucibus. Cras et est vitae lacus lacinia auctor. Mauris ligula justo, ullamcorper molestie fermentum vel, tincidunt at nunc. Sed ullamcorper fringilla lectus in pharetra. Sed libero erat, lobortis nec tempor ac, volutpat id orci. Phasellus orci elit, blandit a sollicitudin at, dignissim in mi. Ut facilisis gravida cursus. Duis risus lacus, pretium vitae egestas varius, interdum non ipsum.

\n" - . $bookEnd; - -$log->logLine("Build Chapters"); - -$log->logLine("Add Chapter 1"); -$book->addChapter("Chapter 1: Lorem ipsum", "Chapter001.html", $chapter1, true, EPub::EXTERNAL_REF_ADD); - -$log->logLine("Add Chapter 2"); -$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $content_start . "

Chapter 2

\n" . $chapter2); - -// Chapter 2 contains an image reference "demo/DemoInlineImage.jpg" which we didn't get it to import -// automatically. So we will do that manually. -$log->logLine("Add referenced image from Chapter 2"); -$book->addLargeFile("demo/DemoInlineImage.jpg", "DemoInlineImage", "demo/DemoInlineImage.jpg", "image/jpeg"); - -$log->logLine("Add Chapter 3"); -$book->addChapter("Chapter 3: Vivamus bibendum massa again", "Chapter003.html", $chapter3); - -// Autosplit a chapter: -$log->logLine("Add Chapter 4"); -$book->setSplitSize(15000); // For this test, we split at approx 15k. Default is 250000 had we left it alone. -$book->addChapter("Chapter 4: Vivamus bibendum massa split", "Chapter004.html", $chapter4, true); -$book->setSplitSize(250000); - -$book->subLevel(); -$book->addChapter("Chapter 4B: test inlined chapter", "Chapter004.html#sub01"); -$book->backLevel(); - -// More advanced use of the splitter: -// Still using Chapter 4, but as you can see, "Chapter 4" also contains a header for Chapter 5. -require_once 'EPubChapterSplitter.php'; -$log->logLine("include EPubChapterSplitter.php"); - -$splitter = new EPubChapterSplitter(); -$splitter->setSplitSize(15000); // For this test, we split at approx 15k. Default is 250000 had we left it alone. -$log->logLine("new EPubChapterSplitter()"); - -/* Using the # as regexp delimiter here, it makes writing the regexp easier. - * in this case we could have just searched for "Chapter ", or if we were using regexp '#^

Chapter #i', - * using regular text (no regexp delimiters) will look for the text after the first tag. Meaning had we used - * "Chapter ", any paragraph or header starting with "Chapter " would have matched. The regexp equivalent of - * "Chapter " is '#^<.+?>Chapter #' - * Essentially, the search strnig is looking for lines starting with... - */ -$log->logLine("Add Chapter 5"); -$html2 = $splitter->splitChapter($chapter5, true, "Chapter ");/* '#^<.+?>Chapter \d*#i'); */ -$log->logLine("Split chapter 5"); - -$idx = 0; -while (list($k, $v) = each($html2)) { - $idx++; - // Because we used a string search in the splitter, the returned hits are put in the key part of the array. - // The entire HTML tag of the line matching the chapter search. - - // find the text inside the tags - preg_match('#^<(\w+)\ *.*?>(.+)$#i', $k, $cName); - - // because of the back reference, the tag name is in $cName[1], and the content is in $cName[2] - // Change any line breakes in the chapter name to " - " - $cName = preg_replace('##i', " - ", $cName[2]); - // Remove any other tags - $cName = preg_replace('#<.+?>#i', " ", $cName); - // clean the chapter name by removing any double spaces left behind to single space. - $cName = preg_replace('#\s+#i', " ", $cName); - - $book->addChapter($cName, "Chapter005_" . $idx . ".html", $v, true); -} - -// Notice that Chapter 1 have an image reference in paragraph 2? -// We can tell EPub to automatically load embedded images and other references: -// The parameters for addChapter are: -// 1: Chapter Name -// 2: File Name (in the book) -// 3: Chapter Data (HTML or array of HTML strings making up one chapter) -// 4: Auto Split Chapter (Default false) -// 5: External References, How to handle external references, default is EPub::EXTERNAL_REF_IGNORE -// 6: Base Dir, This is important, as this have to point to the root of the imported HTML, as seen from it's Document root. -// if you are importing an HTML designed to live in "http://server/story/book.html", $baseDir must be "story" -// It is used to resolve any links in the HTML. - -// BEWARE! -// Using EPub::EXTERNAL_REF_ADD means EPub will try to download the imagees from the internet if they are external. This WILL slow down book generation a lot. -// $book->addChapter("Chapter 6: External Image test", "Chapter006.html", $chapter1, false, EPub::EXTERNAL_REF_ADD, $fileDir); -//$log->logLine("add chapter 6"); - -$log->logLine("Add Chapter 6"); -$book->addChapter("Chapter 6: Local Image test", "Chapter006.html", $content_start . "

Chapter 6

\n" . $chapter2, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -// Chapter 7 tests level indentation -$chapter7Body = "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" . $bookEnd; - -$log->logLine("Add Chapter 7.0.0.0"); -$book->addChapter("Chapter 7", "Chapter00700.html", $content_start . "

Chapter 7.0.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.1.0.0"); -$book->subLevel(); -$book->addChapter("Chapter 7.1", "Chapter00710.html", $content_start . "

Chapter 7.1.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.1.1.0"); -$book->subLevel(); -$book->addChapter("Chapter 7.1.1", "Chapter00711.html", $content_start . "

Chapter 7.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.1.1"); -$book->subLevel(); -$book->addChapter("Chapter 7.1.1.1", "Chapter007111.html", $content_start . "

Chapter 7.1.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.1.2", "Chapter007112.html", $content_start . "

Chapter 7.1.1.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.2.0"); -$book->backLevel(); -$book->addChapter("Chapter 7.1.2", "Chapter007120.html", $content_start . "

Chapter 7.1.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.3.0"); -$book->addChapter("Chapter 7.1.3", "Chapter007130.html", $content_start . "

Chapter 7.1.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 7.1.3.x"); -$book->subLevel(); -$book->addChapter("Chapter 7.1.3.1", "Chapter007131.html", $content_start . "

Chapter 7.1.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.3.2", "Chapter007132.html", $content_start . "

Chapter 7.1.3.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.3.3", "Chapter007133.html", $content_start . "

Chapter 7.1.3.3

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 7.1.3.4", "Chapter007134.html", $content_start . "

Chapter 7.1.3.4

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.2.0.0"); -// We went deep with Chapter 7.1.3.x, and sometimes the generating class knows exactly where it is anyway, -// so instead of relying on multiple ->backLevel() calls, you can set the target level directly. -// This only works for going back in the hieracy. ->setCurrentLevel(1) (or less) equals ->rootLevel(); -$book->setCurrentLevel(2); -$book->addChapter("Chapter 7.2", "Chapter00720.html", $content_start . "

Chapter 7.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.3.0.0"); -$book->addChapter("Chapter 7.3", "Chapter00730.html", $content_start . "

Chapter 7.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 7.3.1.0"); -$book->subLevel(); -$book->addChapter("Chapter 7.3.1", "Chapter00731.html", $content_start . "

Chapter 7.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -// If you have nested chapters, you can call ->rootLevel() to return your hierachy to the root of the navMap. -$book->rootLevel(); - -$log->logLine("Add TOC"); -$book->buildTOC(); - -$book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n" . $bookEnd); - -if ($book->isLogging) { // Only used in case we need to debug EPub.php. - $epuplog = $book->getLog(); - $book->addChapter("ePubLog", "ePubLog.html", $content_start . $epuplog . "\n" . $bookEnd); -} - -$book->finalize(); // Finalize the book, and build the archive. - -// This is not really a part of the EPub class, but IF you have errors and want to know about them, -// they would have been written to the output buffer, preventing the book from being sent. -// This behaviour is desired as the book will then most likely be corrupt. -// However you might want to dump the output to a log, this example section can do that: -/* -if (ob_get_contents() !== false && ob_get_contents() != '') { - $f = fopen ('./log.txt', 'a') or die("Unable to open log.txt."); - fwrite($f, "\r\n" . date("D, d M Y H:i:s T") . ": Error in " . __FILE__ . ": \r\n"); - fwrite($f, ob_get_contents() . "\r\n"); - fclose($f); -} - * or just: - $bufferData = ob_get_contents(); - ob_end_clean(); - */ - -// Save book as a file relative to your script (for local ePub generation) -// Notice that the extions .epub will be added by the script. -// The second parameter is a directory name which is '.' by default. Don't use trailing slash! -//$book->saveBook('epub-filename', '.'); - -// Send the book to the client. ".epub" will be appended if missing. -$zipData = $book->sendBook("ExampleBook2"); - -// After this point your script should call exit. If anything is written to the output, -// it'll be appended to the end of the book, causing the epub file to become corrupt. -?> \ No newline at end of file diff --git a/EPub.Example3.php b/EPub.Example3.php deleted file mode 100644 index 222568a..0000000 --- a/EPub.Example3.php +++ /dev/null @@ -1,246 +0,0 @@ -\n" -. "\n" -. "" -. "\n" -. "\n" -. "Test Book\n" -. " \n" -. "\n"; - -$bookEnd = "\n\n"; - -// setting timezone for time functions used for logging to work properly -date_default_timezone_set('Europe/Berlin'); - -include_once("Logger.php"); -$log = new Logger("Example", TRUE); - -$fileDir = './PHPePub'; - -include_once("EPub.php"); -$log->logLine("include EPub"); - -// ePub 3 is not fully implemented. but aspects of it is, in order to help inmplementers. -// ePub 3 uses HTML5, formatted strictly as if it was XHTML but still using just the HTML5 doctype (aka XHTML5) -$book = new EPub(EPub::BOOK_VERSION_EPUB3, "en", EPub::DIRECTION_LEFT_TO_RIGHT); // Default is ePub 2 -$log->logLine("new EPub()"); -$log->logLine("EPub class version: " . EPub::VERSION); -$log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); -$log->logLine("Zip version: " . Zip::VERSION); -$log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); -$log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); - -// Title and Identifier are mandatory! -$book->setTitle("ePub 3 Test book"); -$book->setIdentifier("http://JohnJaneDoePublications.com/books/TestBookEPub3.html", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. -$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. -$book->setDescription("This is a brief description\nA test ePub book as an example of building a book in PHP"); -$book->setAuthor("John Doe Johnson", "Johnson, John Doe"); -$book->setPublisher("John and Jane Doe Publications", "http://JohnJaneDoePublications.com/"); // I hope this is a non existant address :) -$book->setDate(time()); // Strictly not needed as the book date defaults to time(). -$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. -$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBookEPub3.html"); - -$book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); - -$book->setSubject("Test book"); -$book->setSubject("keywords"); -$book->setSubject("Chapter levels"); - -// Insert custom meta data to the book, in this cvase, Calibre series index information. -$book->addCustomMetadata("calibre:series", "PHPePub Test books"); -$book->addCustomMetadata("calibre:series_index", "3"); - -$log->logLine("Set up parameters"); - -$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; - -$log->logLine("Add css"); -$book->addCSSFile("styles.css", "css1", $cssData); - -// This test requires you have an image, change "demo/cover-image.jpg" to match your location. -$log->logLine("Add Cover Image"); -$book->setCoverImage("Cover.jpg", file_get_contents("demo/cover-image.jpg"), "image/jpeg"); - -// A better way is to let EPub handle the image itself, as it may need resizing. Most Ebooks are only about 600x800 -// pixels, adding megapix images is a waste of place and spends bandwidth. setCoverImage can resize the image. -// When using this method, the given image path must be the absolute path from the servers Document root. - -/* $book->setCoverImage("/absolute/path/to/demo/cover-image.jpg"); */ - -// setCoverImage can only be called once per book, but can be called at any point in the book creation. -$log->logLine("Set Cover Image"); - -$cover = $content_start . "

Test Book

\n

By: John Doe Johnson

\n" . $bookEnd; -$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE); -$book->addChapter("Notices", "Cover.html", $cover); - -$chapter1 = $content_start . "

Chapter 1

\n" - . "

Lorem ipsum

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec magna lorem, mattis sit amet porta vitae, consectetur ut eros. Nullam id mattis lacus. In eget neque magna, congue imperdiet nulla. Aenean erat lacus, imperdiet a adipiscing non, dignissim eget felis. Nulla facilisi. Vivamus sit amet lorem eget mauris dictum pharetra. In mauris nulla, placerat a accumsan ac, mollis sit amet ligula. Donec eget facilisis dui. Cras elit quam, imperdiet at malesuada vitae, luctus id orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque eu libero in leo ultrices tristique. Etiam quis ornare massa. Donec in velit leo. Sed eu ante tortor.

\n" - . "

\"TestNullam at tempus enim. Nunc et augue non lectus consequat rhoncus ac a odio. Morbi et tellus eget nisi volutpat tincidunt. Curabitur tristique neque tincidunt purus blandit bibendum. Maecenas eleifend sem quis magna semper id pulvinar nisi porttitor. In in lectus accumsan eros tristique pharetra sit amet ac nulla. Nam vitae felis et orci congue porta nec non ipsum. Donec pretium blandit accumsan. In aliquam lacinia nisi, ut venenatis mauris condimentum ut. Morbi rutrum orci et nisl accumsan euismod. Etiam viverra luctus sem pellentesque suscipit. Aliquam ultricies egestas risus at eleifend. Ut lacinia, tortor non varius malesuada, massa diam aliquet augue, vitae tempor metus tellus eget diam. Nulla vel augue eu elit adipiscing egestas. Duis et nulla est, ac congue arcu. Phasellus semper, ipsum et blandit rutrum, erat ante semper quam, at iaculis quam tellus sed neque.

\n" - . "

Pellentesque vulputate sollicitudin justo, at faucibus nisl convallis in. Nulla facilisi. Curabitur nec mauris eu justo ultricies ultricies gravida eu ipsum. Pellentesque at nunc velit, vitae congue nisl. Nam varius imperdiet leo eu accumsan. Nullam elementum fermentum diam euismod porttitor. Etiam sed pellentesque ante. Donec in est elementum mi tempor consectetur. Fusce orci lorem, mollis at tincidunt eget, fringilla sed nunc. Ut consectetur condimentum condimentum. Phasellus sed felis non massa gravida euismod ut in tellus. Curabitur suscipit pharetra sapien vitae dignissim. Morbi id arcu nec ante viverra lobortis vitae nec quam. Mauris id gravida odio. Nunc non sem nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque hendrerit volutpat nisl id elementum. Vivamus lobortis iaculis nisi, sit amet tristique risus porttitor vel. Suspendisse potenti.

\n" - . "

Quisque aliquet sapien leo, vitae eleifend dolor. Fusce quis tincidunt nunc. Nam nec purus nulla, ac eleifend lorem. Curabitur eu quam et nibh egestas mattis. Maecenas eget felis augue. Integer scelerisque commodo urna, a pulvinar tortor euismod et. Praesent in nunc sapien. Ut iaculis auctor neque, sit amet rutrum est faucibus vitae. Sed a sagittis quam. Quisque interdum luctus fringilla. Vestibulum vitae nunc in felis luctus ultricies at id magna. Nam volutpat sapien ac lorem interdum pellentesque. Suspendisse faucibus, leo vitae laoreet interdum, mi mi pulvinar neque, sit amet tristique sapien nulla nec dolor. Etiam non ligula augue.

\n" - . "

Vivamus purus elit, ornare eget accumsan ut, luctus et orci. Sed vestibulum turpis ut quam vehicula id hendrerit velit suscipit. Pellentesque pulvinar, libero vitae sagittis scelerisque, felis ante faucibus risus, ut viverra velit mi at tortor. Aliquam lacinia condimentum felis, eu elementum ligula laoreet vitae. Sed placerat tempus turpis a fringilla. Etiam porta accumsan feugiat. Phasellus et cursus magna. Suspendisse vitae odio sit amet urna vulputate consectetur. Vestibulum massa magna, sagittis at dictum vitae, sagittis scelerisque erat. Donec viverra tincidunt lacus. Maecenas fermentum erat et mauris tincidunt sed eleifend quam tempus. In at augue mi, in tincidunt arcu. Duis dapibus aliquet mi, ac ullamcorper est semper quis. Sed nec nulla nec odio malesuada viverra id sed nulla. Donec lobortis euismod aliquam. Praesent sit amet dolor quis lacus auctor lobortis. In hac habitasse platea dictumst. Sed at nisi sed nisi ullamcorper pellentesque. Vivamus eget enim sem, non laoreet leo. Sed vel odio lacus.

\n" - . $bookEnd; - -$chapter2 = - "

Vivamus bibendum massa

\n" - . "

\"Demo

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter3 = array(); -$chapter3[] = $content_start . "

Chapter 3

\n" - . "

Vivamus bibendum massa 3A

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; -$chapter3[] = $content_start . "

Vivamus bibendum massa 3B

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter4 = $content_start . "

Chapter 4

\n" - . "

Vivamus bibendum massa

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat nulla ac libero dapibus ornare. Nam vel lacus in eros vehicula volutpat at ac est. Cras eleifend odio vitae nibh viverra et blandit nibh iaculis. Aenean non pellentesque nisi. Pellentesque ultricies mauris vel odio ullamcorper auctor. Etiam nec erat non mi blandit sollicitudin sed sed metus. Cras vel sagittis augue. Vestibulum eros neque, convallis vel semper in, fringilla sit amet justo. Proin lobortis est ut augue cursus egestas. Maecenas cursus blandit tellus vitae varius. Integer euismod malesuada volutpat. Praesent sem odio, consequat tristique dictum tincidunt, ultricies sit amet sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

\n" - . "

Pellentesque sit amet libero arcu, eu congue magna. Nam commodo, leo sed placerat sollicitudin, eros dolor vehicula ipsum, volutpat bibendum justo quam a turpis. Curabitur viverra ornare odio, aliquet accumsan nisi lobortis ut. Sed id mi non purus ultrices vestibulum eu ac justo. Nunc ultrices vulputate nulla eget porta. Nam iaculis arcu nec libero pretium eu ultricies enim porttitor. Praesent commodo, purus vel elementum egestas, sem nisl fermentum lorem, ac porttitor quam eros eget ante. Fusce diam eros, lacinia sit amet porttitor ac, lacinia quis mauris. Sed molestie, arcu id sodales malesuada, tortor diam faucibus diam, eget placerat tortor sapien ut est. Nam ut neque at nunc accumsan lacinia sed in neque. Nunc nec commodo eros. Suspendisse ut fringilla ipsum. Suspendisse eget neque nunc. Duis tincidunt consequat massa, vel vulputate ligula pretium a.

\n" - . "

Etiam blandit malesuada purus, sollicitudin eleifend magna consectetur ac. Aenean erat mi, varius non lacinia non, eleifend eget urna. Curabitur sagittis vestibulum magna vel dapibus. Phasellus tempus cursus tellus sed aliquet. Vivamus interdum tincidunt varius. Cras ut mi odio. Donec molestie vehicula justo, at congue arcu convallis nec. Proin sit amet libero ante. Nunc nec ante vel libero faucibus commodo ac at lacus. Pellentesque faucibus tellus sit amet odio viverra condimentum. Morbi ut est urna, quis laoreet diam. Aliquam vulputate risus rhoncus massa lobortis porta. Nulla eleifend suscipit interdum. Praesent dictum lobortis urna in facilisis. Proin adipiscing pulvinar accumsan. Maecenas ac lacus vitae erat porta malesuada. Proin malesuada, quam nec cursus suscipit, metus ligula accumsan tortor, non ullamcorper dui dui eget odio. In et massa vel ligula condimentum mollis. Vestibulum ac consectetur risus. Etiam at odio velit, quis blandit ante.

\n" - . "

Sed suscipit enim tortor. Curabitur ut dui dui, at tempus purus. Proin nulla velit, varius et ultricies at, pellentesque ac lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam commodo odio non leo commodo posuere. Integer sed mauris lacus. Aliquam nec diam velit, non volutpat metus. Vestibulum accumsan dignissim hendrerit. Nam elementum blandit pellentesque. Aliquam erat volutpat. Mauris ultrices metus ac enim pellentesque dignissim. Maecenas pellentesque interdum ligula, at imperdiet ipsum aliquam eu. Pellentesque pellentesque libero eget lacus placerat vel malesuada quam facilisis. Ut at nulla lacus. Nam et metus non velit accumsan pretium. Vestibulum eget iaculis nunc. In imperdiet lobortis tortor non eleifend.

\n" - . "

Mauris vel gravida mauris. Aliquam eleifend cursus auctor. Nulla mattis nisl sit amet sem varius eu consequat felis volutpat. Mauris leo nibh, lobortis eget interdum id, rhoncus ut nulla. Donec pretium aliquet dictum. Quisque facilisis, urna id accumsan auctor, quam turpis eleifend sem, ac pulvinar dui tellus eget sapien. Proin ut lorem sit amet velit pretium eleifend eget et velit. Proin facilisis arcu at nisl iaculis in vehicula tellus tristique. Sed in quam augue, elementum scelerisque ligula. Proin nec viverra urna. Integer sed dui orci, pulvinar cursus ante. Cras leo felis, vehicula aliquet convallis quis, aliquet vel dui. Vivamus non urna vitae augue scelerisque sagittis ac vitae sem. Aliquam sagittis, felis nec vestibulum ultricies, nisi tellus varius sapien, in pellentesque orci libero sed tellus. Duis id ante ipsum, id tincidunt leo. Phasellus cursus, nisl sit amet sodales pretium, turpis enim fringilla nisi, quis adipiscing felis velit in orci. Praesent sit amet lacus libero. Maecenas ac lorem quis metus tempus commodo eu nec justo. Nunc vitae dolor at orci ullamcorper pretium. In hac habitasse platea dictumst.

\n" - . "

Quisque rhoncus, nulla id viverra elementum, orci lorem lobortis enim, et fermentum erat massa et velit. Duis ullamcorper tempus laoreet. Quisque a massa vel magna viverra faucibus quis et erat. Praesent eu nulla a augue dignissim mattis. Nam ullamcorper pretium lobortis. Sed in quam vel leo dictum mattis. Quisque sapien est, consectetur et posuere sit amet, scelerisque at nulla. Proin sodales ultricies porttitor. Vestibulum sed dui lectus, sit amet hendrerit elit. Nunc nunc tortor, convallis sit amet vestibulum tempor, consequat sit amet arcu. Fusce congue scelerisque ante nec condimentum. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ligula ante, aliquet nec ornare in, commodo ut metus. Cras varius tempor justo at dictum. Cras tincidunt posuere consectetur. Pellentesque fringilla, augue ac aliquet blandit, ante nunc accumsan eros, lacinia vehicula eros magna non est. Donec neque sapien, eleifend id mollis facilisis, fermentum eget metus. Nunc a ante lorem, vitae lacinia augue. Maecenas cursus aliquam dui.

\n" - . "

Donec mollis nisi nec enim mattis vitae accumsan enim elementum. In rhoncus blandit odio, in facilisis nisl placerat in. Aenean vestibulum felis id dolor imperdiet tristique. Etiam ac urna eu nunc vestibulum euismod. Nulla mi magna, viverra at scelerisque non, rhoncus tempus libero. Sed facilisis, ante ullamcorper cursus placerat, orci turpis sagittis lectus, at placerat urna lorem elementum tortor. Vivamus felis mi, dictum et accumsan ut, lobortis vehicula libero. Suspendisse tellus arcu, malesuada vitae feugiat ut, vulputate sit amet sem. Pellentesque molestie, neque non rhoncus blandit, sapien dui pretium erat, eu tincidunt augue quam convallis nulla. Integer at adipiscing metus. Vestibulum felis urna, interdum eu egestas quis, iaculis a lacus. Aliquam nec urna nisl, id dignissim enim. Sed commodo vulputate turpis, ac dapibus nulla tincidunt et. Nam id nisl libero, in feugiat velit. Pellentesque lobortis adipiscing nisl sit amet rhoncus. Curabitur vulputate, ipsum a viverra ultrices, quam augue vulputate odio, pharetra placerat lorem tortor ac risus. Nunc egestas nisi vel orci venenatis iaculis. Phasellus facilisis risus et velit ultrices pulvinar. Donec convallis leo vel nisl lacinia luctus. Praesent non justo vitae eros malesuada auctor.

\n" - . "

Etiam dignissim, augue eu malesuada faucibus, quam risus rhoncus libero, consectetur molestie nisl lacus eu nisl. Maecenas a nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla urna, lobortis lacinia semper at, laoreet vitae arcu. Pellentesque pretium ultrices velit, nec interdum risus aliquet a. Donec nec nunc turpis, non sagittis magna. Donec eget dolor purus, eget sodales diam. Aliquam elementum dui eget augue commodo sit amet fermentum sem venenatis. Quisque tristique ligula sit amet nulla condimentum commodo. Donec placerat quam eget justo lacinia vitae malesuada mauris sodales. Vestibulum bibendum sem sit amet ante sagittis dignissim. Nullam placerat, enim ut suscipit ultricies, lacus mi hendrerit lorem, sit amet vestibulum libero elit ut lorem. Integer laoreet commodo aliquet. Suspendisse eget velit enim. Nam tellus tortor, hendrerit eget pulvinar id, iaculis nec leo. Donec mattis semper libero vitae laoreet. Phasellus vitae velit ut neque suscipit lobortis non at justo. Curabitur viverra nisl eu odio varius vitae pellentesque erat luctus. Phasellus porta blandit pulvinar.

\n" - . "

Donec rhoncus nunc sed ligula posuere a viverra nunc iaculis. Sed non dignissim nulla. Phasellus a nisl nec metus bibendum vulputate eu et ligula. Quisque dignissim quam id erat elementum cursus. Sed quis nisi nec lacus ullamcorper commodo. Nulla in lacinia odio. Vivamus metus turpis, tristique sed rutrum malesuada, pretium sed felis. Aliquam erat volutpat. Vestibulum eu elit porta tellus placerat consequat. Morbi sem nunc, vulputate sed scelerisque ut, feugiat et leo. Nam pellentesque metus eget ipsum feugiat euismod. Mauris nec enim sit amet turpis rutrum gravida. Cras velit nisl, tincidunt at mattis euismod, aliquet et urna. Sed pellentesque, magna at tristique pellentesque, metus est malesuada dolor, id lobortis eros justo in quam. In in lectus et arcu volutpat lacinia at ac nisl.

\n" - . "

Chapter 4.1
test inlined chapter

\n" - . "

Proin condimentum nisl tristique sapien luctus id ultrices magna molestie. Nulla nibh ligula, suscipit eget pharetra at, commodo et ligula. Quisque odio mi, aliquam a pulvinar id, condimentum vel dolor. In ut nisi eget orci facilisis pretium. Integer vel convallis nisi. Integer scelerisque luctus facilisis. Sed erat ante, adipiscing vel pretium eget, auctor quis eros. Donec tincidunt tempus porttitor. Phasellus in augue at nunc facilisis lacinia. Sed iaculis tristique diam at bibendum. Fusce lorem nibh, mollis semper pulvinar at, sollicitudin id velit. Donec aliquet, elit vel tempus sagittis, tortor nisl posuere turpis, in hendrerit mi justo id metus.

\n" - . "

Nulla facilisi. Integer non libero neque. Cras consequat risus sed quam placerat elementum. Ut placerat, massa at sagittis fermentum, libero risus tempus urna, ac commodo lorem massa sed metus. Sed at tellus nulla, id imperdiet arcu. Proin vehicula urna arcu, sit amet eleifend dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas fringilla risus eu nunc lacinia vel varius odio venenatis. Sed ultrices magna purus. Ut eu risus molestie mi posuere fringilla in sit amet libero. Nulla facilisi. Sed non nulla nec mi adipiscing molestie. Aenean consectetur nibh sit amet tortor ultrices in ultrices ante tempus. Phasellus non arcu purus. In libero tellus, pharetra sed lobortis eu, tristique non neque.

\n" - . "

Vivamus at odio id nisl egestas blandit. Sed sit amet ante urna, eget euismod justo. Cras adipiscing, purus vitae volutpat mollis, lectus massa tempor ligula, ut imperdiet erat lacus sit amet risus. Fusce erat tellus, adipiscing vitae fringilla at, pharetra eget ante. Sed sollicitudin dolor velit. Morbi suscipit turpis ac dui tincidunt nec tincidunt eros sagittis. Nulla et mauris vitae sapien commodo fermentum. Vivamus eget ante orci, id bibendum ipsum. Morbi ut neque tristique lorem pharetra rhoncus. Aliquam nisi odio, sollicitudin vel ornare quis, vestibulum sit amet magna. Cras ac augue quis mauris posuere convallis. Sed et nisi felis, in hendrerit tortor.

\n" - . "

Nulla viverra diam non quam fringilla sodales et quis purus. Quisque mi velit, bibendum eget sagittis eu, interdum ut est. Maecenas convallis elit non turpis lobortis iaculis. Vestibulum erat justo, tincidunt vel pellentesque sit amet, placerat quis erat. Aliquam et neque ac lorem scelerisque imperdiet porta non leo. Mauris lacinia sagittis erat, quis lacinia est commodo non. Suspendisse sed eros libero. Sed a velit lorem, consectetur facilisis nisi. Aliquam risus risus, lacinia sed rutrum ut, faucibus ut nisl. Fusce volutpat euismod purus non malesuada. Sed urna orci, ultricies a placerat vel, mattis id ante.

\n" - . "

Donec vitae ultrices tortor. Fusce luctus sollicitudin orci, nec tempus turpis tincidunt a. Nullam eu quam et magna aliquam viverra sed a tortor. Sed sem erat, tristique nec pellentesque quis, porta eu mi. Proin id ornare massa. Sed tincidunt, risus vitae fringilla porta, felis velit imperdiet justo, vel mattis lorem metus non metus. Sed condimentum leo non urna faucibus viverra aliquet est lobortis. Vivamus imperdiet velit quis odio fermentum eu luctus metus facilisis. Donec arcu tellus, commodo et semper in, aliquam vel lectus. Mauris tempus sagittis tortor eu blandit. Duis adipiscing accumsan commodo. Proin a arcu elit.

\n" - . "

Duis ut aliquam mauris. Vestibulum lobortis porta dolor at fermentum. Proin at elit lacus, quis accumsan turpis. Aenean molestie lobortis sollicitudin. Praesent velit est, molestie sed cursus id, consectetur non turpis. Quisque a purus dui, nec faucibus libero. Cras porta molestie elementum. Phasellus sit amet facilisis eros. Ut et mi malesuada mi cursus vulputate vitae et lectus. Sed ac massa quis nisi egestas convallis. Duis interdum aliquam dui, nec laoreet turpis auctor a. Mauris consectetur eros eu elit tempus tincidunt. Suspendisse tellus elit, viverra eu aliquam nec, auctor volutpat quam.

\n" - . "

Morbi pretium lectus laoreet sapien tincidunt ac volutpat erat ullamcorper. Vivamus dolor neque, blandit non ultrices vitae, mollis venenatis nisi. Fusce at mollis ante. Sed id libero id purus eleifend rutrum. Fusce eget lacus eget libero euismod elementum. Phasellus ac eros non mi luctus pulvinar vestibulum vitae nibh. Proin elementum ultricies mauris, non hendrerit massa egestas quis. Maecenas consectetur consequat quam, vitae tempor leo aliquam sed. Proin iaculis fringilla ante id laoreet. In facilisis vestibulum mollis. Etiam ut arcu mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at fermentum nisl. Proin odio justo, condimentum euismod mollis et, malesuada ac tortor. Aliquam ac elit euismod nibh pulvinar sodales id vitae nibh. Curabitur ut libero metus, eu bibendum turpis.

\n" - . "

Nam faucibus nibh non nulla aliquet id aliquet tortor tincidunt. Fusce at nisi ac mauris pulvinar vehicula at sed velit. Pellentesque vitae eros nec justo semper egestas ut id nisl. Quisque et est lectus. Cras eget nibh et odio pretium venenatis non nec tellus. Aliquam placerat odio non diam facilisis at sollicitudin turpis tempus. Etiam vitae magna dui, nec dignissim odio. Donec dui tellus, adipiscing vel dictum in, vehicula ut diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse est elit, porta non lobortis rutrum, placerat non urna. Integer nisi tellus, imperdiet ac dapibus at, interdum ut enim. Mauris fringilla tempus risus at dapibus. Quisque enim nunc, posuere vel dapibus vel, posuere vel sapien. Suspendisse potenti. Nullam pulvinar nibh nisi, nec porttitor nisi. Donec iaculis euismod elit at porttitor. Mauris quis nunc ut risus semper auctor. Pellentesque pulvinar cursus augue mattis luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\n" - . "

Pellentesque pharetra tincidunt velit, ac laoreet ipsum dictum quis. Cras hendrerit neque eu tellus pellentesque condimentum. Suspendisse metus mi, dignissim eu faucibus vel, molestie quis tortor. Suspendisse vel orci non orci gravida ultrices eu in dui. Vivamus vitae dolor vitae mauris congue auctor. Nulla iaculis, est tempor sagittis condimentum, libero erat fermentum libero, id dapibus tortor sem sit amet sapien. Pellentesque id ipsum eu elit pharetra tristique non ac nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis, lorem id elementum feugiat, orci arcu tincidunt diam, quis placerat sem lectus convallis nulla. Proin eget est quis libero molestie faucibus. Cras et est vitae lacus lacinia auctor. Mauris ligula justo, ullamcorper molestie fermentum vel, tincidunt at nunc. Sed ullamcorper fringilla lectus in pharetra. Sed libero erat, lobortis nec tempor ac, volutpat id orci. Phasellus orci elit, blandit a sollicitudin at, dignissim in mi. Ut facilisis gravida cursus. Duis risus lacus, pretium vitae egestas varius, interdum non ipsum.

\n" - . $bookEnd; - -$log->logLine("Build Chapters"); - -$log->logLine("Add Chapter 1"); -$book->addChapter("Chapter 1: Lorem ipsum", "Chapter001.html", $chapter1, true, EPub::EXTERNAL_REF_ADD); - -$log->logLine("Add Chapter 2"); -$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $content_start . "

Chapter 2

\n" . $chapter2); - -// Chapter 2 contains an image reference "demo/DemoInlineImage.jpg" which we didn't get -// it to import automatically. So we will do that manually. -$log->logLine("Add referenced image from Chapter 2"); -$book->addLargeFile("demo/DemoInlineImage.jpg", "DemoInlineImage", "demo/DemoInlineImage.jpg", "image/jpeg"); - -$log->logLine("Add Chapter 3"); -// Chapter 3 is an array of chapter fragments. -// Just remember, that if you reference these parts with id's, the chapter file name -// is appended with _ (starting from 1) -// This example will produce Chapter003_1.html and Chapter003-2.html -$book->addChapter("Chapter 3: Vivamus bibendum massa again", "Chapter003.html", $chapter3); - -$log->logLine("Add Chapter 4"); -$book->addChapter("Chapter 4: Vivamus bibendum massa split", "Chapter004.html", $chapter4, true); - -// Reference an id inside Chapter 4. Indenting the index is not necessary. -$book->subLevel(); -$book->addChapter("Chapter 4.1: test inlined chapter", "Chapter004.html#sub01"); -$book->backLevel(); - -// Chapter 5 tests level indentation -$chapter7Body = "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" . $bookEnd; - -$log->logLine("Add Chapter 5.0.0.0"); -$book->addChapter("Chapter 5", "Chapter00500.html", $content_start . "

Chapter 5.0.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.1.0.0"); -$book->subLevel(); -$book->addChapter("Chapter 5.1", "Chapter00510.html", $content_start . "

Chapter 5.1.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.1.1.0"); -$book->subLevel("test", "toc"); -$book->addChapter("Chapter 5.1.1", "Chapter00511.html", $content_start . "

Chapter 5.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.1.1"); -$book->subLevel(); -$book->addChapter("Chapter 5.1.1.1", "Chapter005111.html", $content_start . "

Chapter 5.1.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.1.2", "Chapter005112.html", $content_start . "

Chapter 5.1.1.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.2.0"); -$book->backLevel(); -$book->addChapter("Chapter 5.1.2", "Chapter005120.html", $content_start . "

Chapter 5.1.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.3.0"); -$book->addChapter("Chapter 5.1.3", "Chapter005130.html", $content_start . "

Chapter 5.1.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.3.x"); -$book->subLevel(); -$book->addChapter("Chapter 5.1.3.1", "Chapter005131.html", $content_start . "

Chapter 5.1.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.3.2", "Chapter005132.html", $content_start . "

Chapter 5.1.3.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.3.3", "Chapter005133.html", $content_start . "

Chapter 5.1.3.3

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.3.4", "Chapter005134.html", $content_start . "

Chapter 5.1.3.4

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.2.0.0"); -// We went deep with Chapter 5.1.3.x, and sometimes the generating class knows exactly where it is anyway, -// so instead of relying on multiple ->backLevel() calls, you can set the target level directly. -// This only works for going back in the hieracy. ->setCurrentLevel(1) (or less) equals ->rootLevel(); -$book->setCurrentLevel(2); -$book->addChapter("Chapter 5.2", "Chapter00520.html", $content_start . "

Chapter 5.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.3.0.0"); -$book->addChapter("Chapter 5.3", "Chapter00530.html", $content_start . "

Chapter 5.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.3.1.0"); -$book->subLevel(); -$book->addChapter("Chapter 5.3.1", "Chapter00531.html", $content_start . "

Chapter 5.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -// If you have nested chapters, you can call ->rootLevel() to return your hierachy to the root of the navMap. -$book->rootLevel(); - -$log->logLine("Add TOC"); -$book->buildTOC(); - -$book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n" . $bookEnd); - -if ($book->isLogging) { // Only used in case we need to debug EPub.php. - $epuplog = $book->getLog(); - $book->addChapter("ePubLog", "ePubLog.html", $content_start . $epuplog . "\n" . $bookEnd); -} - -$book->finalize(); // Finalize the book, and build the archive. - -// Send the book to the client. ".epub" will be appended if missing. -$zipData = $book->sendBook("ExampleBook3"); - -// After this point your script should call exit. If anything is written to the output, -// it'll be appended to the end of the book, causing the epub file to become corrupt. -?> diff --git a/EPub.Example3_1.php b/EPub.Example3_1.php deleted file mode 100644 index 222568a..0000000 --- a/EPub.Example3_1.php +++ /dev/null @@ -1,246 +0,0 @@ -\n" -. "\n" -. "" -. "\n" -. "\n" -. "Test Book\n" -. " \n" -. "\n"; - -$bookEnd = "\n\n"; - -// setting timezone for time functions used for logging to work properly -date_default_timezone_set('Europe/Berlin'); - -include_once("Logger.php"); -$log = new Logger("Example", TRUE); - -$fileDir = './PHPePub'; - -include_once("EPub.php"); -$log->logLine("include EPub"); - -// ePub 3 is not fully implemented. but aspects of it is, in order to help inmplementers. -// ePub 3 uses HTML5, formatted strictly as if it was XHTML but still using just the HTML5 doctype (aka XHTML5) -$book = new EPub(EPub::BOOK_VERSION_EPUB3, "en", EPub::DIRECTION_LEFT_TO_RIGHT); // Default is ePub 2 -$log->logLine("new EPub()"); -$log->logLine("EPub class version: " . EPub::VERSION); -$log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); -$log->logLine("Zip version: " . Zip::VERSION); -$log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); -$log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); - -// Title and Identifier are mandatory! -$book->setTitle("ePub 3 Test book"); -$book->setIdentifier("http://JohnJaneDoePublications.com/books/TestBookEPub3.html", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. -$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. -$book->setDescription("This is a brief description\nA test ePub book as an example of building a book in PHP"); -$book->setAuthor("John Doe Johnson", "Johnson, John Doe"); -$book->setPublisher("John and Jane Doe Publications", "http://JohnJaneDoePublications.com/"); // I hope this is a non existant address :) -$book->setDate(time()); // Strictly not needed as the book date defaults to time(). -$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. -$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBookEPub3.html"); - -$book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); - -$book->setSubject("Test book"); -$book->setSubject("keywords"); -$book->setSubject("Chapter levels"); - -// Insert custom meta data to the book, in this cvase, Calibre series index information. -$book->addCustomMetadata("calibre:series", "PHPePub Test books"); -$book->addCustomMetadata("calibre:series_index", "3"); - -$log->logLine("Set up parameters"); - -$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; - -$log->logLine("Add css"); -$book->addCSSFile("styles.css", "css1", $cssData); - -// This test requires you have an image, change "demo/cover-image.jpg" to match your location. -$log->logLine("Add Cover Image"); -$book->setCoverImage("Cover.jpg", file_get_contents("demo/cover-image.jpg"), "image/jpeg"); - -// A better way is to let EPub handle the image itself, as it may need resizing. Most Ebooks are only about 600x800 -// pixels, adding megapix images is a waste of place and spends bandwidth. setCoverImage can resize the image. -// When using this method, the given image path must be the absolute path from the servers Document root. - -/* $book->setCoverImage("/absolute/path/to/demo/cover-image.jpg"); */ - -// setCoverImage can only be called once per book, but can be called at any point in the book creation. -$log->logLine("Set Cover Image"); - -$cover = $content_start . "

Test Book

\n

By: John Doe Johnson

\n" . $bookEnd; -$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE); -$book->addChapter("Notices", "Cover.html", $cover); - -$chapter1 = $content_start . "

Chapter 1

\n" - . "

Lorem ipsum

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec magna lorem, mattis sit amet porta vitae, consectetur ut eros. Nullam id mattis lacus. In eget neque magna, congue imperdiet nulla. Aenean erat lacus, imperdiet a adipiscing non, dignissim eget felis. Nulla facilisi. Vivamus sit amet lorem eget mauris dictum pharetra. In mauris nulla, placerat a accumsan ac, mollis sit amet ligula. Donec eget facilisis dui. Cras elit quam, imperdiet at malesuada vitae, luctus id orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque eu libero in leo ultrices tristique. Etiam quis ornare massa. Donec in velit leo. Sed eu ante tortor.

\n" - . "

\"TestNullam at tempus enim. Nunc et augue non lectus consequat rhoncus ac a odio. Morbi et tellus eget nisi volutpat tincidunt. Curabitur tristique neque tincidunt purus blandit bibendum. Maecenas eleifend sem quis magna semper id pulvinar nisi porttitor. In in lectus accumsan eros tristique pharetra sit amet ac nulla. Nam vitae felis et orci congue porta nec non ipsum. Donec pretium blandit accumsan. In aliquam lacinia nisi, ut venenatis mauris condimentum ut. Morbi rutrum orci et nisl accumsan euismod. Etiam viverra luctus sem pellentesque suscipit. Aliquam ultricies egestas risus at eleifend. Ut lacinia, tortor non varius malesuada, massa diam aliquet augue, vitae tempor metus tellus eget diam. Nulla vel augue eu elit adipiscing egestas. Duis et nulla est, ac congue arcu. Phasellus semper, ipsum et blandit rutrum, erat ante semper quam, at iaculis quam tellus sed neque.

\n" - . "

Pellentesque vulputate sollicitudin justo, at faucibus nisl convallis in. Nulla facilisi. Curabitur nec mauris eu justo ultricies ultricies gravida eu ipsum. Pellentesque at nunc velit, vitae congue nisl. Nam varius imperdiet leo eu accumsan. Nullam elementum fermentum diam euismod porttitor. Etiam sed pellentesque ante. Donec in est elementum mi tempor consectetur. Fusce orci lorem, mollis at tincidunt eget, fringilla sed nunc. Ut consectetur condimentum condimentum. Phasellus sed felis non massa gravida euismod ut in tellus. Curabitur suscipit pharetra sapien vitae dignissim. Morbi id arcu nec ante viverra lobortis vitae nec quam. Mauris id gravida odio. Nunc non sem nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque hendrerit volutpat nisl id elementum. Vivamus lobortis iaculis nisi, sit amet tristique risus porttitor vel. Suspendisse potenti.

\n" - . "

Quisque aliquet sapien leo, vitae eleifend dolor. Fusce quis tincidunt nunc. Nam nec purus nulla, ac eleifend lorem. Curabitur eu quam et nibh egestas mattis. Maecenas eget felis augue. Integer scelerisque commodo urna, a pulvinar tortor euismod et. Praesent in nunc sapien. Ut iaculis auctor neque, sit amet rutrum est faucibus vitae. Sed a sagittis quam. Quisque interdum luctus fringilla. Vestibulum vitae nunc in felis luctus ultricies at id magna. Nam volutpat sapien ac lorem interdum pellentesque. Suspendisse faucibus, leo vitae laoreet interdum, mi mi pulvinar neque, sit amet tristique sapien nulla nec dolor. Etiam non ligula augue.

\n" - . "

Vivamus purus elit, ornare eget accumsan ut, luctus et orci. Sed vestibulum turpis ut quam vehicula id hendrerit velit suscipit. Pellentesque pulvinar, libero vitae sagittis scelerisque, felis ante faucibus risus, ut viverra velit mi at tortor. Aliquam lacinia condimentum felis, eu elementum ligula laoreet vitae. Sed placerat tempus turpis a fringilla. Etiam porta accumsan feugiat. Phasellus et cursus magna. Suspendisse vitae odio sit amet urna vulputate consectetur. Vestibulum massa magna, sagittis at dictum vitae, sagittis scelerisque erat. Donec viverra tincidunt lacus. Maecenas fermentum erat et mauris tincidunt sed eleifend quam tempus. In at augue mi, in tincidunt arcu. Duis dapibus aliquet mi, ac ullamcorper est semper quis. Sed nec nulla nec odio malesuada viverra id sed nulla. Donec lobortis euismod aliquam. Praesent sit amet dolor quis lacus auctor lobortis. In hac habitasse platea dictumst. Sed at nisi sed nisi ullamcorper pellentesque. Vivamus eget enim sem, non laoreet leo. Sed vel odio lacus.

\n" - . $bookEnd; - -$chapter2 = - "

Vivamus bibendum massa

\n" - . "

\"Demo

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter3 = array(); -$chapter3[] = $content_start . "

Chapter 3

\n" - . "

Vivamus bibendum massa 3A

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; -$chapter3[] = $content_start . "

Vivamus bibendum massa 3B

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; - -$chapter4 = $content_start . "

Chapter 4

\n" - . "

Vivamus bibendum massa

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat nulla ac libero dapibus ornare. Nam vel lacus in eros vehicula volutpat at ac est. Cras eleifend odio vitae nibh viverra et blandit nibh iaculis. Aenean non pellentesque nisi. Pellentesque ultricies mauris vel odio ullamcorper auctor. Etiam nec erat non mi blandit sollicitudin sed sed metus. Cras vel sagittis augue. Vestibulum eros neque, convallis vel semper in, fringilla sit amet justo. Proin lobortis est ut augue cursus egestas. Maecenas cursus blandit tellus vitae varius. Integer euismod malesuada volutpat. Praesent sem odio, consequat tristique dictum tincidunt, ultricies sit amet sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

\n" - . "

Pellentesque sit amet libero arcu, eu congue magna. Nam commodo, leo sed placerat sollicitudin, eros dolor vehicula ipsum, volutpat bibendum justo quam a turpis. Curabitur viverra ornare odio, aliquet accumsan nisi lobortis ut. Sed id mi non purus ultrices vestibulum eu ac justo. Nunc ultrices vulputate nulla eget porta. Nam iaculis arcu nec libero pretium eu ultricies enim porttitor. Praesent commodo, purus vel elementum egestas, sem nisl fermentum lorem, ac porttitor quam eros eget ante. Fusce diam eros, lacinia sit amet porttitor ac, lacinia quis mauris. Sed molestie, arcu id sodales malesuada, tortor diam faucibus diam, eget placerat tortor sapien ut est. Nam ut neque at nunc accumsan lacinia sed in neque. Nunc nec commodo eros. Suspendisse ut fringilla ipsum. Suspendisse eget neque nunc. Duis tincidunt consequat massa, vel vulputate ligula pretium a.

\n" - . "

Etiam blandit malesuada purus, sollicitudin eleifend magna consectetur ac. Aenean erat mi, varius non lacinia non, eleifend eget urna. Curabitur sagittis vestibulum magna vel dapibus. Phasellus tempus cursus tellus sed aliquet. Vivamus interdum tincidunt varius. Cras ut mi odio. Donec molestie vehicula justo, at congue arcu convallis nec. Proin sit amet libero ante. Nunc nec ante vel libero faucibus commodo ac at lacus. Pellentesque faucibus tellus sit amet odio viverra condimentum. Morbi ut est urna, quis laoreet diam. Aliquam vulputate risus rhoncus massa lobortis porta. Nulla eleifend suscipit interdum. Praesent dictum lobortis urna in facilisis. Proin adipiscing pulvinar accumsan. Maecenas ac lacus vitae erat porta malesuada. Proin malesuada, quam nec cursus suscipit, metus ligula accumsan tortor, non ullamcorper dui dui eget odio. In et massa vel ligula condimentum mollis. Vestibulum ac consectetur risus. Etiam at odio velit, quis blandit ante.

\n" - . "

Sed suscipit enim tortor. Curabitur ut dui dui, at tempus purus. Proin nulla velit, varius et ultricies at, pellentesque ac lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam commodo odio non leo commodo posuere. Integer sed mauris lacus. Aliquam nec diam velit, non volutpat metus. Vestibulum accumsan dignissim hendrerit. Nam elementum blandit pellentesque. Aliquam erat volutpat. Mauris ultrices metus ac enim pellentesque dignissim. Maecenas pellentesque interdum ligula, at imperdiet ipsum aliquam eu. Pellentesque pellentesque libero eget lacus placerat vel malesuada quam facilisis. Ut at nulla lacus. Nam et metus non velit accumsan pretium. Vestibulum eget iaculis nunc. In imperdiet lobortis tortor non eleifend.

\n" - . "

Mauris vel gravida mauris. Aliquam eleifend cursus auctor. Nulla mattis nisl sit amet sem varius eu consequat felis volutpat. Mauris leo nibh, lobortis eget interdum id, rhoncus ut nulla. Donec pretium aliquet dictum. Quisque facilisis, urna id accumsan auctor, quam turpis eleifend sem, ac pulvinar dui tellus eget sapien. Proin ut lorem sit amet velit pretium eleifend eget et velit. Proin facilisis arcu at nisl iaculis in vehicula tellus tristique. Sed in quam augue, elementum scelerisque ligula. Proin nec viverra urna. Integer sed dui orci, pulvinar cursus ante. Cras leo felis, vehicula aliquet convallis quis, aliquet vel dui. Vivamus non urna vitae augue scelerisque sagittis ac vitae sem. Aliquam sagittis, felis nec vestibulum ultricies, nisi tellus varius sapien, in pellentesque orci libero sed tellus. Duis id ante ipsum, id tincidunt leo. Phasellus cursus, nisl sit amet sodales pretium, turpis enim fringilla nisi, quis adipiscing felis velit in orci. Praesent sit amet lacus libero. Maecenas ac lorem quis metus tempus commodo eu nec justo. Nunc vitae dolor at orci ullamcorper pretium. In hac habitasse platea dictumst.

\n" - . "

Quisque rhoncus, nulla id viverra elementum, orci lorem lobortis enim, et fermentum erat massa et velit. Duis ullamcorper tempus laoreet. Quisque a massa vel magna viverra faucibus quis et erat. Praesent eu nulla a augue dignissim mattis. Nam ullamcorper pretium lobortis. Sed in quam vel leo dictum mattis. Quisque sapien est, consectetur et posuere sit amet, scelerisque at nulla. Proin sodales ultricies porttitor. Vestibulum sed dui lectus, sit amet hendrerit elit. Nunc nunc tortor, convallis sit amet vestibulum tempor, consequat sit amet arcu. Fusce congue scelerisque ante nec condimentum. Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent ligula ante, aliquet nec ornare in, commodo ut metus. Cras varius tempor justo at dictum. Cras tincidunt posuere consectetur. Pellentesque fringilla, augue ac aliquet blandit, ante nunc accumsan eros, lacinia vehicula eros magna non est. Donec neque sapien, eleifend id mollis facilisis, fermentum eget metus. Nunc a ante lorem, vitae lacinia augue. Maecenas cursus aliquam dui.

\n" - . "

Donec mollis nisi nec enim mattis vitae accumsan enim elementum. In rhoncus blandit odio, in facilisis nisl placerat in. Aenean vestibulum felis id dolor imperdiet tristique. Etiam ac urna eu nunc vestibulum euismod. Nulla mi magna, viverra at scelerisque non, rhoncus tempus libero. Sed facilisis, ante ullamcorper cursus placerat, orci turpis sagittis lectus, at placerat urna lorem elementum tortor. Vivamus felis mi, dictum et accumsan ut, lobortis vehicula libero. Suspendisse tellus arcu, malesuada vitae feugiat ut, vulputate sit amet sem. Pellentesque molestie, neque non rhoncus blandit, sapien dui pretium erat, eu tincidunt augue quam convallis nulla. Integer at adipiscing metus. Vestibulum felis urna, interdum eu egestas quis, iaculis a lacus. Aliquam nec urna nisl, id dignissim enim. Sed commodo vulputate turpis, ac dapibus nulla tincidunt et. Nam id nisl libero, in feugiat velit. Pellentesque lobortis adipiscing nisl sit amet rhoncus. Curabitur vulputate, ipsum a viverra ultrices, quam augue vulputate odio, pharetra placerat lorem tortor ac risus. Nunc egestas nisi vel orci venenatis iaculis. Phasellus facilisis risus et velit ultrices pulvinar. Donec convallis leo vel nisl lacinia luctus. Praesent non justo vitae eros malesuada auctor.

\n" - . "

Etiam dignissim, augue eu malesuada faucibus, quam risus rhoncus libero, consectetur molestie nisl lacus eu nisl. Maecenas a nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean nulla urna, lobortis lacinia semper at, laoreet vitae arcu. Pellentesque pretium ultrices velit, nec interdum risus aliquet a. Donec nec nunc turpis, non sagittis magna. Donec eget dolor purus, eget sodales diam. Aliquam elementum dui eget augue commodo sit amet fermentum sem venenatis. Quisque tristique ligula sit amet nulla condimentum commodo. Donec placerat quam eget justo lacinia vitae malesuada mauris sodales. Vestibulum bibendum sem sit amet ante sagittis dignissim. Nullam placerat, enim ut suscipit ultricies, lacus mi hendrerit lorem, sit amet vestibulum libero elit ut lorem. Integer laoreet commodo aliquet. Suspendisse eget velit enim. Nam tellus tortor, hendrerit eget pulvinar id, iaculis nec leo. Donec mattis semper libero vitae laoreet. Phasellus vitae velit ut neque suscipit lobortis non at justo. Curabitur viverra nisl eu odio varius vitae pellentesque erat luctus. Phasellus porta blandit pulvinar.

\n" - . "

Donec rhoncus nunc sed ligula posuere a viverra nunc iaculis. Sed non dignissim nulla. Phasellus a nisl nec metus bibendum vulputate eu et ligula. Quisque dignissim quam id erat elementum cursus. Sed quis nisi nec lacus ullamcorper commodo. Nulla in lacinia odio. Vivamus metus turpis, tristique sed rutrum malesuada, pretium sed felis. Aliquam erat volutpat. Vestibulum eu elit porta tellus placerat consequat. Morbi sem nunc, vulputate sed scelerisque ut, feugiat et leo. Nam pellentesque metus eget ipsum feugiat euismod. Mauris nec enim sit amet turpis rutrum gravida. Cras velit nisl, tincidunt at mattis euismod, aliquet et urna. Sed pellentesque, magna at tristique pellentesque, metus est malesuada dolor, id lobortis eros justo in quam. In in lectus et arcu volutpat lacinia at ac nisl.

\n" - . "

Chapter 4.1
test inlined chapter

\n" - . "

Proin condimentum nisl tristique sapien luctus id ultrices magna molestie. Nulla nibh ligula, suscipit eget pharetra at, commodo et ligula. Quisque odio mi, aliquam a pulvinar id, condimentum vel dolor. In ut nisi eget orci facilisis pretium. Integer vel convallis nisi. Integer scelerisque luctus facilisis. Sed erat ante, adipiscing vel pretium eget, auctor quis eros. Donec tincidunt tempus porttitor. Phasellus in augue at nunc facilisis lacinia. Sed iaculis tristique diam at bibendum. Fusce lorem nibh, mollis semper pulvinar at, sollicitudin id velit. Donec aliquet, elit vel tempus sagittis, tortor nisl posuere turpis, in hendrerit mi justo id metus.

\n" - . "

Nulla facilisi. Integer non libero neque. Cras consequat risus sed quam placerat elementum. Ut placerat, massa at sagittis fermentum, libero risus tempus urna, ac commodo lorem massa sed metus. Sed at tellus nulla, id imperdiet arcu. Proin vehicula urna arcu, sit amet eleifend dui. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas fringilla risus eu nunc lacinia vel varius odio venenatis. Sed ultrices magna purus. Ut eu risus molestie mi posuere fringilla in sit amet libero. Nulla facilisi. Sed non nulla nec mi adipiscing molestie. Aenean consectetur nibh sit amet tortor ultrices in ultrices ante tempus. Phasellus non arcu purus. In libero tellus, pharetra sed lobortis eu, tristique non neque.

\n" - . "

Vivamus at odio id nisl egestas blandit. Sed sit amet ante urna, eget euismod justo. Cras adipiscing, purus vitae volutpat mollis, lectus massa tempor ligula, ut imperdiet erat lacus sit amet risus. Fusce erat tellus, adipiscing vitae fringilla at, pharetra eget ante. Sed sollicitudin dolor velit. Morbi suscipit turpis ac dui tincidunt nec tincidunt eros sagittis. Nulla et mauris vitae sapien commodo fermentum. Vivamus eget ante orci, id bibendum ipsum. Morbi ut neque tristique lorem pharetra rhoncus. Aliquam nisi odio, sollicitudin vel ornare quis, vestibulum sit amet magna. Cras ac augue quis mauris posuere convallis. Sed et nisi felis, in hendrerit tortor.

\n" - . "

Nulla viverra diam non quam fringilla sodales et quis purus. Quisque mi velit, bibendum eget sagittis eu, interdum ut est. Maecenas convallis elit non turpis lobortis iaculis. Vestibulum erat justo, tincidunt vel pellentesque sit amet, placerat quis erat. Aliquam et neque ac lorem scelerisque imperdiet porta non leo. Mauris lacinia sagittis erat, quis lacinia est commodo non. Suspendisse sed eros libero. Sed a velit lorem, consectetur facilisis nisi. Aliquam risus risus, lacinia sed rutrum ut, faucibus ut nisl. Fusce volutpat euismod purus non malesuada. Sed urna orci, ultricies a placerat vel, mattis id ante.

\n" - . "

Donec vitae ultrices tortor. Fusce luctus sollicitudin orci, nec tempus turpis tincidunt a. Nullam eu quam et magna aliquam viverra sed a tortor. Sed sem erat, tristique nec pellentesque quis, porta eu mi. Proin id ornare massa. Sed tincidunt, risus vitae fringilla porta, felis velit imperdiet justo, vel mattis lorem metus non metus. Sed condimentum leo non urna faucibus viverra aliquet est lobortis. Vivamus imperdiet velit quis odio fermentum eu luctus metus facilisis. Donec arcu tellus, commodo et semper in, aliquam vel lectus. Mauris tempus sagittis tortor eu blandit. Duis adipiscing accumsan commodo. Proin a arcu elit.

\n" - . "

Duis ut aliquam mauris. Vestibulum lobortis porta dolor at fermentum. Proin at elit lacus, quis accumsan turpis. Aenean molestie lobortis sollicitudin. Praesent velit est, molestie sed cursus id, consectetur non turpis. Quisque a purus dui, nec faucibus libero. Cras porta molestie elementum. Phasellus sit amet facilisis eros. Ut et mi malesuada mi cursus vulputate vitae et lectus. Sed ac massa quis nisi egestas convallis. Duis interdum aliquam dui, nec laoreet turpis auctor a. Mauris consectetur eros eu elit tempus tincidunt. Suspendisse tellus elit, viverra eu aliquam nec, auctor volutpat quam.

\n" - . "

Morbi pretium lectus laoreet sapien tincidunt ac volutpat erat ullamcorper. Vivamus dolor neque, blandit non ultrices vitae, mollis venenatis nisi. Fusce at mollis ante. Sed id libero id purus eleifend rutrum. Fusce eget lacus eget libero euismod elementum. Phasellus ac eros non mi luctus pulvinar vestibulum vitae nibh. Proin elementum ultricies mauris, non hendrerit massa egestas quis. Maecenas consectetur consequat quam, vitae tempor leo aliquam sed. Proin iaculis fringilla ante id laoreet. In facilisis vestibulum mollis. Etiam ut arcu mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at fermentum nisl. Proin odio justo, condimentum euismod mollis et, malesuada ac tortor. Aliquam ac elit euismod nibh pulvinar sodales id vitae nibh. Curabitur ut libero metus, eu bibendum turpis.

\n" - . "

Nam faucibus nibh non nulla aliquet id aliquet tortor tincidunt. Fusce at nisi ac mauris pulvinar vehicula at sed velit. Pellentesque vitae eros nec justo semper egestas ut id nisl. Quisque et est lectus. Cras eget nibh et odio pretium venenatis non nec tellus. Aliquam placerat odio non diam facilisis at sollicitudin turpis tempus. Etiam vitae magna dui, nec dignissim odio. Donec dui tellus, adipiscing vel dictum in, vehicula ut diam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse est elit, porta non lobortis rutrum, placerat non urna. Integer nisi tellus, imperdiet ac dapibus at, interdum ut enim. Mauris fringilla tempus risus at dapibus. Quisque enim nunc, posuere vel dapibus vel, posuere vel sapien. Suspendisse potenti. Nullam pulvinar nibh nisi, nec porttitor nisi. Donec iaculis euismod elit at porttitor. Mauris quis nunc ut risus semper auctor. Pellentesque pulvinar cursus augue mattis luctus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\n" - . "

Pellentesque pharetra tincidunt velit, ac laoreet ipsum dictum quis. Cras hendrerit neque eu tellus pellentesque condimentum. Suspendisse metus mi, dignissim eu faucibus vel, molestie quis tortor. Suspendisse vel orci non orci gravida ultrices eu in dui. Vivamus vitae dolor vitae mauris congue auctor. Nulla iaculis, est tempor sagittis condimentum, libero erat fermentum libero, id dapibus tortor sem sit amet sapien. Pellentesque id ipsum eu elit pharetra tristique non ac nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus facilisis, lorem id elementum feugiat, orci arcu tincidunt diam, quis placerat sem lectus convallis nulla. Proin eget est quis libero molestie faucibus. Cras et est vitae lacus lacinia auctor. Mauris ligula justo, ullamcorper molestie fermentum vel, tincidunt at nunc. Sed ullamcorper fringilla lectus in pharetra. Sed libero erat, lobortis nec tempor ac, volutpat id orci. Phasellus orci elit, blandit a sollicitudin at, dignissim in mi. Ut facilisis gravida cursus. Duis risus lacus, pretium vitae egestas varius, interdum non ipsum.

\n" - . $bookEnd; - -$log->logLine("Build Chapters"); - -$log->logLine("Add Chapter 1"); -$book->addChapter("Chapter 1: Lorem ipsum", "Chapter001.html", $chapter1, true, EPub::EXTERNAL_REF_ADD); - -$log->logLine("Add Chapter 2"); -$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $content_start . "

Chapter 2

\n" . $chapter2); - -// Chapter 2 contains an image reference "demo/DemoInlineImage.jpg" which we didn't get -// it to import automatically. So we will do that manually. -$log->logLine("Add referenced image from Chapter 2"); -$book->addLargeFile("demo/DemoInlineImage.jpg", "DemoInlineImage", "demo/DemoInlineImage.jpg", "image/jpeg"); - -$log->logLine("Add Chapter 3"); -// Chapter 3 is an array of chapter fragments. -// Just remember, that if you reference these parts with id's, the chapter file name -// is appended with _ (starting from 1) -// This example will produce Chapter003_1.html and Chapter003-2.html -$book->addChapter("Chapter 3: Vivamus bibendum massa again", "Chapter003.html", $chapter3); - -$log->logLine("Add Chapter 4"); -$book->addChapter("Chapter 4: Vivamus bibendum massa split", "Chapter004.html", $chapter4, true); - -// Reference an id inside Chapter 4. Indenting the index is not necessary. -$book->subLevel(); -$book->addChapter("Chapter 4.1: test inlined chapter", "Chapter004.html#sub01"); -$book->backLevel(); - -// Chapter 5 tests level indentation -$chapter7Body = "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" . $bookEnd; - -$log->logLine("Add Chapter 5.0.0.0"); -$book->addChapter("Chapter 5", "Chapter00500.html", $content_start . "

Chapter 5.0.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.1.0.0"); -$book->subLevel(); -$book->addChapter("Chapter 5.1", "Chapter00510.html", $content_start . "

Chapter 5.1.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.1.1.0"); -$book->subLevel("test", "toc"); -$book->addChapter("Chapter 5.1.1", "Chapter00511.html", $content_start . "

Chapter 5.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.1.1"); -$book->subLevel(); -$book->addChapter("Chapter 5.1.1.1", "Chapter005111.html", $content_start . "

Chapter 5.1.1.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.1.2", "Chapter005112.html", $content_start . "

Chapter 5.1.1.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.2.0"); -$book->backLevel(); -$book->addChapter("Chapter 5.1.2", "Chapter005120.html", $content_start . "

Chapter 5.1.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.3.0"); -$book->addChapter("Chapter 5.1.3", "Chapter005130.html", $content_start . "

Chapter 5.1.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -$log->logLine("Add Chapter 5.1.3.x"); -$book->subLevel(); -$book->addChapter("Chapter 5.1.3.1", "Chapter005131.html", $content_start . "

Chapter 5.1.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.3.2", "Chapter005132.html", $content_start . "

Chapter 5.1.3.2

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.3.3", "Chapter005133.html", $content_start . "

Chapter 5.1.3.3

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 5.1.3.4", "Chapter005134.html", $content_start . "

Chapter 5.1.3.4

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.2.0.0"); -// We went deep with Chapter 5.1.3.x, and sometimes the generating class knows exactly where it is anyway, -// so instead of relying on multiple ->backLevel() calls, you can set the target level directly. -// This only works for going back in the hieracy. ->setCurrentLevel(1) (or less) equals ->rootLevel(); -$book->setCurrentLevel(2); -$book->addChapter("Chapter 5.2", "Chapter00520.html", $content_start . "

Chapter 5.2.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.3.0.0"); -$book->addChapter("Chapter 5.3", "Chapter00530.html", $content_start . "

Chapter 5.3.0

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - - -$log->logLine("Add Chapter 5.3.1.0"); -$book->subLevel(); -$book->addChapter("Chapter 5.3.1", "Chapter00531.html", $content_start . "

Chapter 5.3.1

\n" . $chapter7Body, false, EPub::EXTERNAL_REF_ADD, $fileDir); - -// If you have nested chapters, you can call ->rootLevel() to return your hierachy to the root of the navMap. -$book->rootLevel(); - -$log->logLine("Add TOC"); -$book->buildTOC(); - -$book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n" . $bookEnd); - -if ($book->isLogging) { // Only used in case we need to debug EPub.php. - $epuplog = $book->getLog(); - $book->addChapter("ePubLog", "ePubLog.html", $content_start . $epuplog . "\n" . $bookEnd); -} - -$book->finalize(); // Finalize the book, and build the archive. - -// Send the book to the client. ".epub" will be appended if missing. -$zipData = $book->sendBook("ExampleBook3"); - -// After this point your script should call exit. If anything is written to the output, -// it'll be appended to the end of the book, causing the epub file to become corrupt. -?> diff --git a/EPub.ExampleImg.php b/EPub.ExampleImg.php deleted file mode 100644 index 9b40838..0000000 --- a/EPub.ExampleImg.php +++ /dev/null @@ -1,63 +0,0 @@ -setTitle("Test book"); -$book->setIdentifier("http://JohnJaneDoePublications.com/books/TestBook.html", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. -$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. -$book->setDescription("This is a brief description\nA test ePub book as an example of building a book in PHP"); -$book->setAuthor("John Doe Johnson", "Johnson, John Doe"); -$book->setPublisher("John and Jane Doe Publications", "http://JohnJaneDoePublications.com/"); // I hope this is a non existant address :) -$book->setDate(time()); // Strictly not needed as the book date defaults to time(). -$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. -$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBook.html"); - -$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; -$book->addCSSFile("Styles/styles.css", "css1", $cssData); - -$content_start = -"\n" -. "\n" -. "\n" -. "" -. "\n" -. "\n" -. "Test Book\n" -. " \n" -. "\n"; - -$bookEnd = "\n\n"; -$fileDir = './PHPePub'; -// setting timezone for time functions used for logging to work properly -date_default_timezone_set('Europe/Berlin'); - -$chapter = $content_start . "

Image

\n" - . "

Animated Gif

\n" - . "

none

\n" - . "

Demo 2

\n" -. $bookEnd; - -$book->isGifImagesEnabled = TRUE; -$book->setCoverImage('demo/512x700_1.jpg'); - -$book->addChapter("Prologue", "Texts/Prologue.html", $content_start . "

Prologue

\n" . $bookEnd); -$book->addChapter("Chapter 1", "Texts/Chapter1.html", $chapter, false, EPub::EXTERNAL_REF_ADD, $fileDir); -$book->addChapter("Chapter 2", "Texts/Chapter2.html", $chapter, false, EPub::EXTERNAL_REF_REPLACE_IMAGES, $fileDir); - - -$book->finalize(); -// Send the book to the client. ".epub" will be appended if missing. -$zipData = $book->sendBook("ExampleBookImg"); - -// After this point your script should call exit. If anything is written to the output, -// it'll be appended to the end of the book, causing the epub file to become corrupt. - -?> \ No newline at end of file diff --git a/EPub.ExampleSimple.php b/EPub.ExampleSimple.php deleted file mode 100644 index 5b891c5..0000000 --- a/EPub.ExampleSimple.php +++ /dev/null @@ -1,81 +0,0 @@ -\n" -. "\n" -. "\n" -. "" -. "\n" -. "\n" -. "Test Book\n" -. " \n" -. "\n"; - -$bookEnd = "\n\n"; - -// setting timezone for time functions used for logging to work properly -date_default_timezone_set('Europe/Berlin'); - -$fileDir = './PHPePub'; - -include_once("EPub.php"); - -$book = new EPub(); // no argumetns gives us the default ePub 2, lang=en and dir="ltr" - -// Title and Identifier are mandatory! -$book->setTitle("Simple Test book"); -$book->setIdentifier("http://JohnJaneDoePublications.com/books/TestBookSimple.html", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. -$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. -$book->setDescription("This is a brief description\nA test ePub book as an example of building a book in PHP"); -$book->setAuthor("John Doe Johnson", "Johnson, John Doe"); -$book->setPublisher("John and Jane Doe Publications", "http://JohnJaneDoePublications.com/"); // I hope this is a non existant address :) -$book->setDate(time()); // Strictly not needed as the book date defaults to time(). -$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. -$book->setSourceURL("http://JohnJaneDoePublications.com/books/TestBookSimple.html"); - -// A book need styling, in this case we use static text, but it could have been a file. -$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; -$book->addCSSFile("styles.css", "css1", $cssData); - -// Add cover page -$cover = $content_start . "

Test Book

\n

By: John Doe Johnson

\n" . $bookEnd; -$book->addChapter("Notices", "Cover.html", $cover); - -$chapter1 = $content_start . "

Chapter 1

\n" - . "

Lorem ipsum

\n" - . "

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec magna lorem, mattis sit amet porta vitae, consectetur ut eros. Nullam id mattis lacus. In eget neque magna, congue imperdiet nulla. Aenean erat lacus, imperdiet a adipiscing non, dignissim eget felis. Nulla facilisi. Vivamus sit amet lorem eget mauris dictum pharetra. In mauris nulla, placerat a accumsan ac, mollis sit amet ligula. Donec eget facilisis dui. Cras elit quam, imperdiet at malesuada vitae, luctus id orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque eu libero in leo ultrices tristique. Etiam quis ornare massa. Donec in velit leo. Sed eu ante tortor.

\n" - . "

\"TestNullam at tempus enim. Nunc et augue non lectus consequat rhoncus ac a odio. Morbi et tellus eget nisi volutpat tincidunt. Curabitur tristique neque tincidunt purus blandit bibendum. Maecenas eleifend sem quis magna semper id pulvinar nisi porttitor. In in lectus accumsan eros tristique pharetra sit amet ac nulla. Nam vitae felis et orci congue porta nec non ipsum. Donec pretium blandit accumsan. In aliquam lacinia nisi, ut venenatis mauris condimentum ut. Morbi rutrum orci et nisl accumsan euismod. Etiam viverra luctus sem pellentesque suscipit. Aliquam ultricies egestas risus at eleifend. Ut lacinia, tortor non varius malesuada, massa diam aliquet augue, vitae tempor metus tellus eget diam. Nulla vel augue eu elit adipiscing egestas. Duis et nulla est, ac congue arcu. Phasellus semper, ipsum et blandit rutrum, erat ante semper quam, at iaculis quam tellus sed neque.

\n" - . "

Pellentesque vulputate sollicitudin justo, at faucibus nisl convallis in. Nulla facilisi. Curabitur nec mauris eu justo ultricies ultricies gravida eu ipsum. Pellentesque at nunc velit, vitae congue nisl. Nam varius imperdiet leo eu accumsan. Nullam elementum fermentum diam euismod porttitor. Etiam sed pellentesque ante. Donec in est elementum mi tempor consectetur. Fusce orci lorem, mollis at tincidunt eget, fringilla sed nunc. Ut consectetur condimentum condimentum. Phasellus sed felis non massa gravida euismod ut in tellus. Curabitur suscipit pharetra sapien vitae dignissim. Morbi id arcu nec ante viverra lobortis vitae nec quam. Mauris id gravida odio. Nunc non sem nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque hendrerit volutpat nisl id elementum. Vivamus lobortis iaculis nisi, sit amet tristique risus porttitor vel. Suspendisse potenti.

\n" - . "

Quisque aliquet sapien leo, vitae eleifend dolor. Fusce quis tincidunt nunc. Nam nec purus nulla, ac eleifend lorem. Curabitur eu quam et nibh egestas mattis. Maecenas eget felis augue. Integer scelerisque commodo urna, a pulvinar tortor euismod et. Praesent in nunc sapien. Ut iaculis auctor neque, sit amet rutrum est faucibus vitae. Sed a sagittis quam. Quisque interdum luctus fringilla. Vestibulum vitae nunc in felis luctus ultricies at id magna. Nam volutpat sapien ac lorem interdum pellentesque. Suspendisse faucibus, leo vitae laoreet interdum, mi mi pulvinar neque, sit amet tristique sapien nulla nec dolor. Etiam non ligula augue.

\n" - . "

Vivamus purus elit, ornare eget accumsan ut, luctus et orci. Sed vestibulum turpis ut quam vehicula id hendrerit velit suscipit. Pellentesque pulvinar, libero vitae sagittis scelerisque, felis ante faucibus risus, ut viverra velit mi at tortor. Aliquam lacinia condimentum felis, eu elementum ligula laoreet vitae. Sed placerat tempus turpis a fringilla. Etiam porta accumsan feugiat. Phasellus et cursus magna. Suspendisse vitae odio sit amet urna vulputate consectetur. Vestibulum massa magna, sagittis at dictum vitae, sagittis scelerisque erat. Donec viverra tincidunt lacus. Maecenas fermentum erat et mauris tincidunt sed eleifend quam tempus. In at augue mi, in tincidunt arcu. Duis dapibus aliquet mi, ac ullamcorper est semper quis. Sed nec nulla nec odio malesuada viverra id sed nulla. Donec lobortis euismod aliquam. Praesent sit amet dolor quis lacus auctor lobortis. In hac habitasse platea dictumst. Sed at nisi sed nisi ullamcorper pellentesque. Vivamus eget enim sem, non laoreet leo. Sed vel odio lacus.

\n" - . $bookEnd; -$book->addChapter("Chapter 1: Lorem ipsum", "Chapter001.html", $chapter1, true, EPub::EXTERNAL_REF_ADD); - -$chapter2 = $content_start . "

Chapter 2

\n" - . "

Vivamus bibendum massa

\n" - . "

Vivamus bibendum massa ac magna congue gravida. Curabitur nulla ante, accumsan sit amet luctus a, fermentum ut diam. Maecenas porttitor faucibus mattis. Ut auctor aliquet ligula nec posuere. Nullam arcu turpis, dapibus sit amet tempor nec, cursus at augue. Aliquam sed sem velit, id sagittis mauris. Donec sed ipsum nisi, id scelerisque felis. Cras lacus est, fermentum in ultricies eu, congue in elit. Nulla tincidunt posuere eros, eget suscipit tellus porta vel. Aliquam ut sollicitudin libero. Suspendisse potenti. Sed cursus dignissim nulla in elementum. Aliquam id quam justo, sit amet laoreet ligula. Etiam pellentesque tellus a nisi commodo eu sodales ante commodo. Vestibulum ultricies sapien arcu. Proin nunc mauris, ultrices id imperdiet ac, malesuada ac nunc. Nunc a mi quis nunc ultricies rhoncus. Mauris pellentesque eros eu augue congue ac tincidunt est gravida.

\n" - . "

Integer lobortis facilisis magna, non tristique sem facilisis ut. Sed id nisi diam. Nulla viverra lectus ut purus tempus sagittis. Quisque dictum enim tempus ipsum mollis blandit. Cras in mi non nulla imperdiet fringilla at blandit urna. Donec vel dui quis sem congue ullamcorper nec a massa. Vivamus in dui nunc. Donec sit amet augue odio, at imperdiet lacus. Mauris sit amet magna justo. Maecenas ultrices orci ultrices sapien ornare eget consequat nisl tristique. Integer non mi ac eros vehicula pharetra. Curabitur risus augue, sollicitudin vitae pharetra interdum, sollicitudin sit amet magna. Nunc sit amet est lacus, vel sodales elit. Duis dolor lorem, convallis eu dignissim quis, vulputate at nibh.

\n" - . "

Praesent gravida, sapien aliquet interdum elementum, magna mauris hendrerit eros, blandit posuere lectus neque sed massa. Cras ultricies rhoncus mi, vitae posuere ligula scelerisque sit amet. Cras porttitor congue odio, sit amet tristique magna euismod id. Cras enim dolor, scelerisque eget egestas vel, consectetur vel purus. Aenean et convallis felis. Mauris in arcu sollicitudin ipsum lobortis fringilla. Suspendisse felis mauris, convallis ac blandit interdum, imperdiet eget massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris scelerisque velit quis augue commodo tristique. Maecenas dictum dui congue enim tristique vel mattis neque luctus. Fusce neque dui, laoreet suscipit varius sed, mattis sit amet diam. Nullam elementum, ante non cursus imperdiet, eros dui placerat elit, sit amet elementum erat risus eget nunc.

\n" - . "

Nam tellus nibh, vehicula a laoreet non, fermentum vel leo. Proin id augue tellus. Donec placerat pharetra interdum. Aliquam vestibulum viverra bibendum. Nullam auctor congue tortor. Sed sagittis, massa ac cursus malesuada, ipsum velit aliquam lectus, quis tincidunt tellus risus id justo. Suspendisse sodales adipiscing eros, ut pulvinar eros suscipit in. Fusce vel libero id urna blandit pharetra. Cras aliquam suscipit ultrices. Vivamus luctus tristique vestibulum. Nam placerat dolor ipsum. Nulla vitae tristique sapien. Nulla laoreet ante ut elit dictum ultricies. Fusce mi tortor, commodo sit amet tincidunt semper, pellentesque nec ante. Vestibulum nec dui at massa adipiscing pulvinar. Integer ultrices tristique odio, iaculis bibendum metus fringilla id. Ut ac elit ac enim convallis dignissim pharetra id purus. Nunc pulvinar blandit nulla, in ornare erat condimentum id. Sed sit amet placerat est. Curabitur pretium tellus in velit aliquet eu dictum arcu consectetur.

\n" - . "

In hac habitasse platea dictumst. Integer lectus augue, varius nec rutrum non, fringilla eu neque. Curabitur a gravida velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque vestibulum orci ac ligula interdum dapibus. Maecenas sollicitudin aliquet libero in sodales. In tempor orci vitae nisi imperdiet at varius sem dignissim. Aenean tortor libero, pellentesque eget hendrerit id, ullamcorper in justo. Sed euismod egestas est vitae convallis. Nunc tempus lacinia purus condimentum mattis. Sed id elementum est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In nec tempus eros.

\n" - . $bookEnd; -$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $chapter2, true, EPub::EXTERNAL_REF_ADD); - -$book->finalize(); // Finalize the book, and build the archive. - -// Send the book to the client. ".epub" will be appended if missing. -$zipData = $book->sendBook("ExampleBookSimple"); - -// After this point your script should call exit. If anything is written to the output, -// it'll be appended to the end of the book, causing the epub file to become corrupt. -?> \ No newline at end of file diff --git a/EPub.php b/EPub.php deleted file mode 100644 index 361a1c1..0000000 --- a/EPub.php +++ /dev/null @@ -1,2429 +0,0 @@ - - * @copyright 2009-2014 A. Grandt - * @license GNU LGPL 2.1 - * @version 3.20 - * @link http://www.phpclasses.org/package/6115 - * @link https://github.com/Grandt/PHPePub - * @uses Zip.php version 1.50; http://www.phpclasses.org/browse/package/6110.html or https://github.com/Grandt/PHPZip - */ -class EPub { - const VERSION = 3.20; - const REQ_ZIP_VERSION = 1.60; - - const IDENTIFIER_UUID = 'UUID'; - const IDENTIFIER_URI = 'URI'; - const IDENTIFIER_ISBN = 'ISBN'; - - /** Ignore all external references, and do not process the file for these */ - const EXTERNAL_REF_IGNORE = 0; - /** Process the file for external references and add them to the book */ - const EXTERNAL_REF_ADD = 1; - /** Process the file for external references and add them to the book, but remove images, and img tags */ - const EXTERNAL_REF_REMOVE_IMAGES = 2; - /** Process the file for external references and add them to the book, but replace images, and img tags with [image] */ - const EXTERNAL_REF_REPLACE_IMAGES = 3; - - const DIRECTION_LEFT_TO_RIGHT = "ltr"; - const DIRECTION_RIGHT_TO_LEFT = "rtl"; - - const BOOK_VERSION_EPUB2 = "2.0"; - const BOOK_VERSION_EPUB3 = "3.0"; - - private $bookVersion = EPub::BOOK_VERSION_EPUB2; - - public $maxImageWidth = 768; - public $maxImageHeight = 1024; - - public $splitDefaultSize = 250000; - /** Gifs can crash some early ADE based readers, and are disabled by default. - * getImage will convert these if it can, unless this is set to TRUE. - */ - public $isGifImagesEnabled = FALSE; - public $isReferencesAddedToToc = TRUE; - - private $zip; - - private $title = ""; - private $language = "en"; - private $identifier = ""; - private $identifierType = ""; - private $description = ""; - private $author = ""; - private $authorSortKey = ""; - private $publisherName = ""; - private $publisherURL = ""; - private $date = 0; - private $rights = ""; - private $coverage = ""; - private $relation = ""; - private $sourceURL = ""; - - private $chapterCount = 0; - private $opf = NULL; - private $ncx = NULL; - private $isFinalized = FALSE; - private $isCoverImageSet = FALSE; - private $buildTOC = FALSE; - private $tocTitle = NULL; - private $tocFileName = NULL; - private $tocCSSClass = NULL; - private $tocAddReferences = FALSE; - private $tocCssFileName = NULL; - - private $fileList = array(); - private $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT; - private $languageCode = "en"; - - /** - * Used for building the TOC. - * If this list is overwritten it MUST contain at least "text" as an element. - */ - public $referencesOrder = NULL; - - private $dateformat = 'Y-m-d\TH:i:s.000000P'; // ISO 8601 long - private $dateformatShort = 'Y-m-d'; // short date format to placate ePubChecker. - private $headerDateFormat = "D, d M Y H:i:s T"; - - protected $isCurlInstalled; - protected $isGdInstalled; - protected $isExifInstalled; - protected $isFileGetContentsInstalled; - protected $isFileGetContentsExtInstalled; - - private $bookRoot = "OEBPS/"; - private $docRoot = NULL; - private $EPubMark = TRUE; - private $generator = ""; - - private $log = NULL; - public $isLogging = TRUE; - - public $encodeHTML = FALSE; - - private $mimetypes = array( - "js" => "application/x-javascript", "swf" => "application/x-shockwave-flash", "xht" => "application/xhtml+xml", "xhtml" => "application/xhtml+xml", "zip" => "application/zip", - "aif" => "audio/x-aiff", "aifc" => "audio/x-aiff", "aiff" => "audio/x-aiff", "au" => "audio/basic", "kar" => "audio/midi", "m3u" => "audio/x-mpegurl", "mid" => "audio/midi", "midi" => "audio/midi", "mp2" => "audio/mpeg", "mp3" => "audio/mpeg", "mpga" => "audio/mpeg", "oga" => "audio/ogg", "ogg" => "audio/ogg", "ra" => "audio/x-realaudio", "ram" => "audio/x-pn-realaudio", "rm" => "audio/x-pn-realaudio", "rpm" => "audio/x-pn-realaudio-plugin", "snd" => "audio/basic", "wav" => "audio/x-wav", - "bmp" => "image/bmp", "djv" => "image/vnd.djvu", "djvu" => "image/vnd.djvu", "gif" => "image/gif", "ief" => "image/ief", "jpe" => "image/jpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "pbm" => "image/x-portable-bitmap", "pgm" => "image/x-portable-graymap", "png" => "image/png", "pnm" => "image/x-portable-anymap", "ppm" => "image/x-portable-pixmap", "ras" => "image/x-cmu-raster", "rgb" => "image/x-rgb", "tif" => "image/tif", "tiff" => "image/tiff", "wbmp" => "image/vnd.wap.wbmp", "xbm" => "image/x-xbitmap", "xpm" => "image/x-xpixmap", "xwd" => "image/x-windowdump", - "asc" => "text/plain", "css" => "text/css", "etx" => "text/x-setext", "htm" => "text/html", "html" => "text/html", "rtf" => "text/rtf", "rtx" => "text/richtext", "sgm" => "text/sgml", "sgml" => "text/sgml", "tsv" => "text/tab-seperated-values", "txt" => "text/plain", "wml" => "text/vnd.wap.wml", "wmls" => "text/vnd.wap.wmlscript", "xml" => "text/xml", "xsl" => "text/xml", - "avi" => "video/x-msvideo", "mov" => "video/quicktime", "movie" => "video/x-sgi-movie", "mp4" => "video/mp4", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mxu" => "video/vnd.mpegurl", "ogv" => "video/ogg", "qt" => "video/quicktime", "webm" => "video/webm"); - - // These are the ONLY allowed types in that these are the ones ANY reader must support, any other MUST have the fallback attribute pointing to one of these. - private $coreMediaTypes = array("image/gif", "image/jpeg", "image/png", "image/svg+xml", "application/xhtml+xml", "application/x-dtbook+xml", "application/xml", "application/x-dtbncx+xml", "text/css", "text/x-oeb1-css", "text/x-oeb1-document"); - - private $opsContentTypes = array("application/xhtml+xml", "application/x-dtbook+xml", "application/xml", "application/x-dtbncx+xml", "text/x-oeb1-document"); - - private $forbiddenCharacters = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%"); - - private $htmlContentHeader = "\n\n\n\n\n \n\n"; - private $htmlContentFooter = "\n\n"; - - /** - * Class constructor. - * - * @return void - */ - function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) { - include_once("Zip.php"); - include_once("Logger.php"); - - $this->bookVersion = $bookVersion; - $this->writingDirection = $writingDirection; - $this->languageCode = $languageCode; - - $this->log = new Logger("EPub", $this->isLogging); - - /* Prepare Logging. Just in case it's used. later */ - if ($this->isLogging) { - $this->log->logLine("EPub class version....: " . self::VERSION); - $this->log->logLine("EPub req. Zip version.: " . self::REQ_ZIP_VERSION); - $this->log->logLine("Zip version...........: " . Zip::VERSION); - $this->log->dumpInstalledModules(); - } - - if (!defined("Zip::VERSION") || Zip::VERSION < self::REQ_ZIP_VERSION) { - die("

EPub version " . self::VERSION . " requires Zip.php at version " . self::REQ_ZIP_VERSION . " or higher.
You can obtain the latest version from http://www.phpclasses.org/browse/package/6110.html.

"); - } - - include_once("EPubChapterSplitter.php"); - include_once("EPub.HtmlEntities.php"); - include_once("EPub.NCX.php"); - include_once("EPub.OPF.php"); - - $this->initialize(); - } - - /** - * Class destructor - * - * @return void - * @TODO make sure elements in the destructor match the current class elements - */ - function __destruct() { - unset($this->bookVersion, $this->maxImageWidth, $this->maxImageHeight); - unset($this->splitDefaultSize, $this->isGifImagesEnabled, $this->isReferencesAddedToToc); - unset($this->zip, $this->title, $this->language, $this->identifier, $this->identifierType); - unset($this->description, $this->author, $this->authorSortKey, $this->publisherName); - unset($this->publisherURL, $this->date, $this->rights, $this->coverage, $this->relation); - unset($this->sourceURL, $this->chapterCount, $this->opf, $this->ncx, $this->isFinalized); - unset($this->isCoverImageSet, $this->fileList, $this->writingDirection, $this->languageCode); - unset($this->referencesOrder, $this->dateformat, $this->dateformatShort, $this->headerDateFormat); - unset($this->isCurlInstalled, $this->isGdInstalled, $this->isExifInstalled); - unset($this->isFileGetContentsInstalled, $this->isFileGetContentsExtInstalled, $this->bookRoot); - unset($this->docRoot, $this->EPubMark, $this->generator, $this->log, $this->isLogging); - unset($this->encodeHTML, $this->mimetypes, $this->coreMediaTypes, $this->opsContentTypes); - unset($this->forbiddenCharacters, $this->htmlContentHeader, $this->htmlContentFooter); - unset($this->buildTOC, $this->tocTitle, $this->tocCSSClass, $this->tocAddReferences); - unset($this->tocFileName, $this->tocCssFileName); - } - - /** - * initialize defaults. - */ - private function initialize() { - $this->referencesOrder = array( - Reference::COVER => "Cover Page", - Reference::TITLE_PAGE => "Title Page", - Reference::ACKNOWLEDGEMENTS => "Acknowledgements", - Reference::BIBLIOGRAPHY => "Bibliography", - Reference::COLOPHON => "Colophon", - Reference::COPYRIGHT_PAGE => "Copyright", - Reference::DEDICATION => "Dedication", - Reference::EPIGRAPH => "Epigraph", - Reference::FOREWORD => "Foreword", - Reference::TABLE_OF_CONTENTS => "Table of Contents", - Reference::NOTES => "Notes", - Reference::PREFACE => "Preface", - Reference::TEXT => "First Page", - Reference::LIST_OF_ILLUSTRATIONS => "List of Illustrations", - Reference::LIST_OF_TABLES => "List of Tables", - Reference::GLOSSARY => "Glossary", - Reference::INDEX => "Index"); - - $this->docRoot = filter_input(INPUT_SERVER, "DOCUMENT_ROOT") . "/"; - - $this->isCurlInstalled = extension_loaded('curl') && function_exists('curl_version'); - $this->isGdInstalled = extension_loaded('gd') && function_exists('gd_info'); - $this->isExifInstalled = extension_loaded('exif') && function_exists('exif_imagetype'); - $this->isFileGetContentsInstalled = function_exists('file_get_contents'); - $this->isFileGetContentsExtInstalled = $this->isFileGetContentsInstalled && ini_get('allow_url_fopen'); - - $this->zip = new Zip(); - $this->zip->setExtraField(FALSE); - $this->zip->addFile("application/epub+zip", "mimetype"); - $this->zip->setExtraField(TRUE); - $this->zip->addDirectory("META-INF"); - - $this->content = "\n\n\t\n\t\tbookRoot . "book.opf\" media-type=\"application/oebps-package+xml\" />\n\t\n\n"; - - if (!$this->isEPubVersion2()) { - $this->htmlContentHeader = "\n" - . "\n" - . "" - . "\n" - . "\n" - . " \n" - . "\n"; - } - - $this->zip->addFile($this->content, "META-INF/container.xml", 0, NULL, FALSE); - $this->content = NULL; - $this->ncx = new Ncx(NULL, NULL, NULL, $this->languageCode, $this->writingDirection); - $this->opf = new Opf(); - $this->ncx->setVersion($this->bookVersion); - $this->opf->setVersion($this->bookVersion); - $this->opf->addItem("ncx", "book.ncx", Ncx::MIMETYPE); - $this->chapterCount = 0; - } - - /** - * Add dynamically generated data as a file to the book. - * - * @param string $fileName Filename to use for the file, must be unique for the book. - * @param string $fileId Unique identifier for the file. - * @param string $fileData File data - * @param string $mimetype file mime type - * @return bool $success - */ - function addFile($fileName, $fileId, $fileData, $mimetype) { - if ($this->isFinalized || array_key_exists($fileName, $this->fileList)) { - return FALSE; - } - - $fileName = $this->normalizeFileName($fileName); - - $compress = (strpos($mimetype, "image/") !== 0); - - $this->zip->addFile($fileData, $this->bookRoot.$fileName, 0, NULL, $compress); - $this->fileList[$fileName] = $fileName; - $this->opf->addItem($fileId, $fileName, $mimetype); - return TRUE; - } - - /** - * Add a large file directly from the filestystem to the book. - * - * @param string $fileName Filename to use for the file, must be unique for the book. - * @param string $fileId Unique identifier for the file. - * @param string $filePath File path - * @param string $mimetype file mime type - * @return bool $success - */ - function addLargeFile($fileName, $fileId, $filePath, $mimetype) { - if ($this->isFinalized || array_key_exists($fileName, $this->fileList)) { - return FALSE; - } - $fileName = $this->normalizeFileName($fileName); - - if ($this->zip->addLargeFile($filePath, $this->bookRoot.$fileName)) { - $this->fileList[$fileName] = $fileName; - $this->opf->addItem($fileId, $fileName, $mimetype); - return TRUE; - } - return FALSE; - } - - /** - * Add a CSS file to the book. - * - * @param string $fileName Filename to use for the CSS file, must be unique for the book. - * @param string $fileId Unique identifier for the file. - * @param string $fileData CSS data - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? See documentation for processCSSExternalReferences for explanation. Default is EPub::EXTERNAL_REF_IGNORE. - * @param string $baseDir Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE. - * - * @return bool $success - */ - function addCSSFile($fileName, $fileId, $fileData, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "") { - if ($this->isFinalized || array_key_exists($fileName, $this->fileList)) { - return FALSE; - } - $fileName = Zip::getRelativePath($fileName); - $fileName = preg_replace('#^[/\.]+#i', "", $fileName); - - if ($externalReferences !== EPub::EXTERNAL_REF_IGNORE) { - $cssDir = pathinfo($fileName); - $cssDir = preg_replace('#^[/\.]+#i', "", $cssDir["dirname"] . "/"); - if (!empty($cssDir)) { - $cssDir = preg_replace('#[^/]+/#i', "../", $cssDir); - } - - $this->processCSSExternalReferences($fileData, $externalReferences, $baseDir, $cssDir); - } - - $this->addFile($fileName, "css_" . $fileId, $fileData, "text/css"); - - return TRUE; - } - - /** - * Add a chapter to the book, as a chapter should not exceed 250kB, you can parse an array with multiple parts as $chapterData. - * These will still only show up as a single chapter in the book TOC. - * - * @param string $chapterName Name of the chapter, will be use din the TOC - * @param string $fileName Filename to use for the chapter, must be unique for the book. - * @param string $chapter Chapter text in XHTML or array $chapterData valid XHTML data for the chapter. File should NOT exceed 250kB. - * @param bool $autoSplit Should the chapter be split if it exceeds the default split size? Default=FALSE, only used if $chapterData is a string. - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? See documentation for processChapterExternalReferences for explanation. Default is EPub::EXTERNAL_REF_IGNORE. - * @param string $baseDir Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE. - * @return mixed $success FALSE if the addition failed, else the new NavPoint. - */ - function addChapter($chapterName, $fileName, $chapterData = NULL, $autoSplit = FALSE, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "") { - if ($this->isFinalized) { - return FALSE; - } - $fileName = Zip::getRelativePath($fileName); - $fileName = preg_replace('#^[/\.]+#i', "", $fileName); - - $chapter = $chapterData; - if ($autoSplit && is_string($chapterData) && mb_strlen($chapterData) > $this->splitDefaultSize) { - $splitter = new EPubChapterSplitter(); - - $chapterArray = $splitter->splitChapter($chapterData); - if (count($chapterArray) > 1) { - $chapter = $chapterArray; - } - } - - if (!empty($chapter) && is_string($chapter)) { - if ($externalReferences !== EPub::EXTERNAL_REF_IGNORE) { - $htmlDirInfo = pathinfo($fileName); - $htmlDir = preg_replace('#^[/\.]+#i', "", $htmlDirInfo["dirname"] . "/"); - $this->processChapterExternalReferences($chapter, $externalReferences, $baseDir, $htmlDir); - } - - if ($this->encodeHTML === TRUE) { - $chapter = $this->encodeHtml($chapter); - } - - $this->chapterCount++; - $this->addFile($fileName, "chapter" . $this->chapterCount, $chapter, "application/xhtml+xml"); - $this->opf->addItemRef("chapter" . $this->chapterCount); - - $navPoint = new NavPoint($this->decodeHtmlEntities($chapterName), $fileName, "chapter" . $this->chapterCount); - $this->ncx->addNavPoint($navPoint); - $this->ncx->chapterList[$chapterName] = $navPoint; - } else if (is_array($chapter)) { - $fileNameParts = pathinfo($fileName); - $extension = $fileNameParts['extension']; - $name = $fileNameParts['filename']; - - $partCount = 0; - $this->chapterCount++; - - $oneChapter = each($chapter); - while ($oneChapter) { - list($k, $v) = $oneChapter; - if ($this->encodeHTML === TRUE) { - $v = $this->encodeHtml($v); - } - - if ($externalReferences !== EPub::EXTERNAL_REF_IGNORE) { - $this->processChapterExternalReferences($v, $externalReferences, $baseDir); - } - $partCount++; - $partName = $name . "_" . $partCount; - $this->addFile($partName . "." . $extension, $partName, $v, "application/xhtml+xml"); - $this->opf->addItemRef($partName); - - $oneChapter = each($chapter); - } - $partName = $name . "_1." . $extension; - $navPoint = new NavPoint($this->decodeHtmlEntities($chapterName), $partName, $partName); - $this->ncx->addNavPoint($navPoint); - - $this->ncx->chapterList[$chapterName] = $navPoint; - } else if (!isset($chapterData) && strpos($fileName, "#") > 0) { - $this->chapterCount++; - //$this->opf->addItemRef("chapter" . $this->chapterCount); - - $navPoint = new NavPoint($this->decodeHtmlEntities($chapterName), $fileName, "chapter" . $this->chapterCount); - $this->ncx->addNavPoint($navPoint); - $this->ncx->chapterList[$chapterName] = $navPoint; - } else if (!isset($chapterData) && $fileName=="TOC.xhtml") { - $this->chapterCount++; - $this->opf->addItemRef("toc"); - - $navPoint = new NavPoint($this->decodeHtmlEntities($chapterName), $fileName, "chapter" . $this->chapterCount); - $this->ncx->addNavPoint($navPoint); - $this->ncx->chapterList[$chapterName] = $navPoint; - } - return $navPoint; - } - - /** - * Add one chapter level. - * - * Subsequent chapters will be added to this level. - * - * @param string $navTitle - * @param string $navId - * @param string $navClass - * @param int $isNavHidden - * @param string $writingDirection - * @return NavPoint The new NavPoint for that level. - */ - function subLevel($navTitle = NULL, $navId = NULL, $navClass = NULL, $isNavHidden = FALSE, $writingDirection = NULL) { - return $this->ncx->subLevel($this->decodeHtmlEntities($navTitle), $navId, $navClass, $isNavHidden, $writingDirection); - } - - /** - * Step back one chapter level. - * - * Subsequent chapters will be added to this chapters parent level. - */ - function backLevel() { - $this->ncx->backLevel(); - } - - /** - * Step back to the root level. - * - * Subsequent chapters will be added to the rooot NavMap. - */ - function rootLevel() { - $this->ncx->rootLevel(); - } - - /** - * Step back to the given level. - * Useful for returning to a previous level from deep within the structure. - * Values below 2 will have the same effect as rootLevel() - * - * @param int $newLevel - */ - function setCurrentLevel($newLevel) { - $this->ncx->setCurrentLevel($newLevel); - } - - /** - * Get current level count. - * The indentation of the current structure point. - * - * @return current level count; - */ - function getCurrentLevel() { - return $this->ncx->getCurrentLevel(); - } - - /** - * Wrap ChapterContent with Head and Footer - * - * @param $content - * @return string $content - */ - private function wrapChapter($content) { - return $this->htmlContentHeader . "\n" . $content . "\n" . $this->htmlContentFooter; - } - - /** - * Reference pages is usually one or two pages for items such as Table of Contents, reference lists, Author notes or Acknowledgements. - * These do not show up in the regular navigation list. - * - * As they are supposed to be short. - * - * @param string $pageName Name of the chapter, will be use din the TOC - * @param string $fileName Filename to use for the chapter, must be unique for the book. - * @param string $pageData Page content in XHTML. File should NOT exceed 250kB. - * @param string $reference Reference key - * @param int $externalReferences How to handle external references. See documentation for processChapterExternalReferences for explanation. Default is EPub::EXTERNAL_REF_IGNORE. - * @param string $baseDir Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE. - * @return bool $success - */ - function addReferencePage($pageName, $fileName, $pageData, $reference, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "") { - if ($this->isFinalized) { - return FALSE; - } - $fileName = Zip::getRelativePath($fileName); - $fileName = preg_replace('#^[/\.]+#i', "", $fileName); - - - if (!empty($pageData) && is_string($pageData)) { - if ($this->encodeHTML === TRUE) { - $pageData = $this->encodeHtml($pageData); - } - - $this->wrapChapter($pageData); - - if ($externalReferences !== EPub::EXTERNAL_REF_IGNORE) { - $htmlDirInfo = pathinfo($fileName); - $htmlDir = preg_replace('#^[/\.]+#i', "", $htmlDirInfo["dirname"] . "/"); - $this->processChapterExternalReferences($pageData, $externalReferences, $baseDir, $htmlDir); - } - - $this->addFile($fileName, "ref_" . $reference, $pageData, "application/xhtml+xml"); - - if ($reference !== Reference::TABLE_OF_CONTENTS || !isset($this->ncx->referencesList[$reference])) { - $this->opf->addItemRef("ref_" . $reference, FALSE); - $this->opf->addReference($reference, $pageName, $fileName); - - $this->ncx->referencesList[$reference] = $fileName; - $this->ncx->referencesName[$reference] = $pageName; - } - return TRUE; - } - return TRUE; - } - - /** - * Add custom metadata to the book. - * - * It is up to the builder to make sure there are no collisions. Metadata are just key value pairs. - * - * @param string $name - * @param string $content - */ - function addCustomMetadata($name, $content) { - $this->opf->addMeta($name, $content); - } - - /** - * Add DublinCore metadata to the book - * - * Use the DublinCore constants included in EPub, ie DublinCore::DATE - * - * @param string $dublinCore name - * @param string $value - */ - function addDublinCoreMetadata($dublinCoreConstant, $value) { - if ($this->isFinalized) { - return; - } - - $this->opf->addDCMeta($dublinCoreConstant, $this->decodeHtmlEntities($value)); - } - - /** - * Add a cover image to the book. - * If the $imageData is not set, the function assumes the $fileName is the path to the image file. - * - * The styling and structure of the generated XHTML is heavily inspired by the XHTML generated by Calibre. - * - * @param string $fileName Filename to use for the image, must be unique for the book. - * @param string $imageData Binary image data - * @param string $mimetype Image mimetype, such as "image/jpeg" or "image/png". - * @return bool $success - */ - function setCoverImage($fileName, $imageData = NULL, $mimetype = NULL) { - if ($this->isFinalized || $this->isCoverImageSet || array_key_exists("CoverPage.html", $this->fileList)) { - return FALSE; - } - - if ($imageData == NULL) { - // assume $fileName is the valid file path. - if (!file_exists($fileName)) { - // Attempt to locate the file using the doc root. - $rp = realpath($this->docRoot . "/" . $fileName); - - if ($rp !== FALSE) { - // only assign the docroot path if it actually exists there. - $fileName = $rp; - } - } - $image = $this->getImage($fileName); - $imageData = $image['image']; - $mimetype = $image['mime']; - $fileName = preg_replace("#\.[^\.]+$#", "." . $image['ext'], $fileName); - } - - - $path = pathinfo($fileName); - $imgPath = "images/" . $path["basename"]; - - if (empty($mimetype) && file_exists($fileName)) { - list($width, $height, $type, $attr) = getimagesize($fileName); - $mimetype = image_type_to_mime_type($type); - } - if (empty($mimetype)) { - $ext = strtolower($path['extension']); - if ($ext == "jpg") { - $ext = "jpeg"; - } - $mimetype = "image/" . $ext; - } - - $coverPage = ""; - - if ($this->isEPubVersion2()) { - $coverPage = "\n" - . "\n" - . "\n" - . "\t\n" - . "\t\t\n" - . "\t\tCover Image\n" - . "\t\t\n" - . "\t \n" - . "\t\n" - . "\t\t
\n" - . "\t\t\t\"Cover\n" - . "\t\t
\n" - . "\t\n" - . "\n"; - } else { - $coverPage = "\n" - . "\n" - . "" - . "\t\n" - . "\t\tCover Image\n" - . "\t\t\n" - . "\t \n" - . "\t\n" - . "\t\t
\n" - . "\t\t\t\"Cover\n" - . "\t\t
\n" - . "\t\n" - . "\n"; - } - $coverPageCss = "@page, body, div, img {\n" - . "\tpadding: 0pt;\n" - . "\tmargin:0pt;\n" - . "}\n\nbody {\n" - . "\ttext-align: center;\n" - . "}\n"; - - $this->addCSSFile("Styles/CoverPage.css", "CoverPageCss", $coverPageCss); - $this->addFile($imgPath, "CoverImage", $imageData, $mimetype); - $this->addReferencePage("CoverPage", "CoverPage.xhtml", $coverPage, "cover"); - $this->isCoverImageSet = TRUE; - return TRUE; - } - - /** - * Process external references from a HTML to the book. The chapter itself is not stored. - * the HTML is scanned for <link..., <style..., and <img tags. - * Embedded CSS styles and links will also be processed. - * Script tags are not processed, as scripting should be avoided in e-books. - * - * EPub keeps track of added files, and duplicate files referenced across multiple - * chapters, are only added once. - * - * If the $doc is a string, it is assumed to be the content of an HTML file, - * else is it assumes to be a DOMDocument. - * - * Basedir is the root dir the HTML is supposed to "live" in, used to resolve - * relative references such as <img src="../images/image.png"/> - * - * $externalReferences determines how the function will handle external references. - * - * @param mixed &$doc (referenced) - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? Default is EPub::EXTERNAL_REF_ADD. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * - * @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE). - */ - protected function processChapterExternalReferences(&$doc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "") { - if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) { - return FALSE; - } - - $backPath = preg_replace('#[^/]+/#i', "../", $htmlDir); - $isDocAString = is_string($doc); - $xmlDoc = NULL; - - if ($isDocAString) { - $xmlDoc = new DOMDocument(); - @$xmlDoc->loadHTML($doc); - } else { - $xmlDoc = $doc; - } - - $this->processChapterStyles($xmlDoc, $externalReferences, $baseDir, $htmlDir); - $this->processChapterLinks($xmlDoc, $externalReferences, $baseDir, $htmlDir, $backPath); - $this->processChapterImages($xmlDoc, $externalReferences, $baseDir, $htmlDir, $backPath); - $this->processChapterSources($xmlDoc, $externalReferences, $baseDir, $htmlDir, $backPath); - - if ($isDocAString) { - //$html = $xmlDoc->saveXML(); - - $htmlNode = $xmlDoc->getElementsByTagName("html"); - $headNode = $xmlDoc->getElementsByTagName("head"); - $bodyNode = $xmlDoc->getElementsByTagName("body"); - - $htmlNS = ""; - for ($index = 0; $index < $htmlNode->item(0)->attributes->length; $index++) { - $nodeName = $htmlNode->item(0)->attributes->item($index)->nodeName; - $nodeValue = $htmlNode->item(0)->attributes->item($index)->nodeValue; - - if ($nodeName != "xmlns") { - $htmlNS .= " $nodeName=\"$nodeValue\""; - } - } - - $xml = new DOMDocument('1.0', "utf-8"); - $xml->lookupPrefix("http://www.w3.org/1999/xhtml"); - $xml->preserveWhiteSpace = FALSE; - $xml->formatOutput = TRUE; - - $xml2Doc = new DOMDocument('1.0', "utf-8"); - $xml2Doc->lookupPrefix("http://www.w3.org/1999/xhtml"); - $xml2Doc->loadXML("\n\n\n\n"); - $html = $xml2Doc->getElementsByTagName("html")->item(0); - $html->appendChild($xml2Doc->importNode($headNode->item(0), TRUE)); - $html->appendChild($xml2Doc->importNode($bodyNode->item(0), TRUE)); - - // force pretty printing and correct formatting, should not be needed, but it is. - $xml->loadXML($xml2Doc->saveXML()); - $doc = $xml->saveXML(); - - if (!$this->isEPubVersion2()) { - $doc = preg_replace('#^\s*\s*#im', '', $doc); - } - } - return TRUE; - } - - /** - * Process images referenced from an CSS file to the book. - * - * $externalReferences determins how the function will handle external references. - * - * @param string &$cssFile (referenced) - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? Default is EPub::EXTERNAL_REF_ADD. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $cssDir The of the CSS file's directory from the root of the archive. - * - * @return bool FALSE if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE). - */ - protected function processCSSExternalReferences(&$cssFile, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $cssDir = "") { - if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) { - return FALSE; - } - - $backPath = preg_replace('#[^/]+/#i', "../", $cssDir); - $imgs = null; - preg_match_all('#url\s*\([\'\"\s]*(.+?)[\'\"\s]*\)#im', $cssFile, $imgs, PREG_SET_ORDER); - - $itemCount = count($imgs); - for ($idx = 0; $idx < $itemCount; $idx++) { - $img = $imgs[$idx]; - if ($externalReferences === EPub::EXTERNAL_REF_REMOVE_IMAGES || $externalReferences === EPub::EXTERNAL_REF_REPLACE_IMAGES) { - $cssFile = str_replace($img[0], "", $cssFile); - } else { - $source = $img[1]; - - $pathData = pathinfo($source); - $internalSrc = $pathData['basename']; - $internalPath = ""; - $isSourceExternal = FALSE; - - if ($this->resolveImage($source, $internalPath, $internalSrc, $isSourceExternal, $baseDir, $cssDir, $backPath)) { - $cssFile = str_replace($img[0], "url('" . $backPath . $internalPath . "')", $cssFile); - } else if ($isSourceExternal) { - $cssFile = str_replace($img[0], "", $cssFile); // External image is missing - } // else do nothing, if the image is local, and missing, assume it's been generated. - } - } - return TRUE; - } - - /** - * Process style tags in a DOMDocument. Styles will be passed as CSS files and reinserted into the document. - * - * @param DOMDocument &$xmlDoc (referenced) - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? Default is EPub::EXTERNAL_REF_ADD. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * - * @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE). - */ - protected function processChapterStyles(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "") { - if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) { - return FALSE; - } - // process inlined CSS styles in style tags. - $styles = $xmlDoc->getElementsByTagName("style"); - $styleCount = $styles->length; - for ($styleIdx = 0; $styleIdx < $styleCount; $styleIdx++) { - $style = $styles->item($styleIdx); - - $styleData = preg_replace('#[/\*\s]*\<\!\[CDATA\[[\s\*/]*#im', "", $style->nodeValue); - $styleData = preg_replace('#[/\*\s]*\]\]\>[\s\*/]*#im', "", $styleData); - - $this->processCSSExternalReferences($styleData, $externalReferences, $baseDir, $htmlDir); - $style->nodeValue = "\n" . trim($styleData) . "\n"; - } - return TRUE; - } - - /** - * Process link tags in a DOMDocument. Linked files will be loaded into the archive, and the link src will be rewritten to point to that location. - * Link types text/css will be passed as CSS files. - * - * @param DOMDocument &$xmlDoc (referenced) - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? Default is EPub::EXTERNAL_REF_ADD. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * @param string $backPath The path to get back to the root of the archive from $htmlDir. - * - * @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE). - */ - protected function processChapterLinks(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "") { - if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) { - return FALSE; - } - // process link tags. - $links = $xmlDoc->getElementsByTagName("link"); - $linkCount = $links->length; - for ($linkIdx = 0; $linkIdx < $linkCount; $linkIdx++) { - $link = $links->item($linkIdx); - $source = $link->attributes->getNamedItem("href")->nodeValue; - $sourceData = NULL; - - $pathData = pathinfo($source); - $internalSrc = $pathData['basename']; - - if (preg_match('#^(http|ftp)s?://#i', $source) == 1) { - $urlinfo = parse_url($source); - - if (strpos($urlinfo['path'], $baseDir."/") !== FALSE) { - $internalSrc = substr($urlinfo['path'], strpos($urlinfo['path'], $baseDir."/") + strlen($baseDir) + 1); - } - - @$sourceData = getFileContents($source); - } else if (strpos($source, "/") === 0) { - @$sourceData = file_get_contents($this->docRoot . $source); - } else { - @$sourceData = file_get_contents($this->docRoot . $baseDir . "/" . $source); - } - - if (!empty($sourceData)) { - if (!array_key_exists($internalSrc, $this->fileList)) { - $mime = $link->attributes->getNamedItem("type")->nodeValue; - if (empty($mime)) { - $mime = "text/plain"; - } - if ($mime == "text/css") { - $this->processCSSExternalReferences($sourceData, $externalReferences, $baseDir, $htmlDir); - $this->addCSSFile($internalSrc, $internalSrc, $sourceData, EPub::EXTERNAL_REF_IGNORE, $baseDir); - $link->setAttribute("href", $backPath . $internalSrc); - } else { - $this->addFile($internalSrc, $internalSrc, $sourceData, $mime); - } - $this->fileList[$internalSrc] = $source; - } else { - $link->setAttribute("href", $backPath . $internalSrc); - } - } // else do nothing, if the link is local, and missing, assume it's been generated. - } - return TRUE; - } - - /** - * Process img tags in a DOMDocument. - * $externalReferences will determine what will happen to these images, and the img src will be rewritten accordingly. - * - * @param DOMDocument &$xmlDoc (referenced) - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? Default is EPub::EXTERNAL_REF_ADD. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * @param string $backPath The path to get back to the root of the archive from $htmlDir. - * - * @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE). - */ - protected function processChapterImages(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "") { - if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) { - return FALSE; - } - // process img tags. - $postProcDomElememts = array(); - $images = $xmlDoc->getElementsByTagName("img"); - $itemCount = $images->length; - - for ($idx = 0; $idx < $itemCount; $idx++) { - $img = $images->item($idx); - - if ($externalReferences === EPub::EXTERNAL_REF_REMOVE_IMAGES) { - $postProcDomElememts[] = $img; - } else if ($externalReferences === EPub::EXTERNAL_REF_REPLACE_IMAGES) { - $altNode = $img->attributes->getNamedItem("alt"); - $alt = "image"; - if ($altNode !== NULL && strlen($altNode->nodeValue) > 0) { - $alt = $altNode->nodeValue; - } - $postProcDomElememts[] = array($img, $this->createDomFragment($xmlDoc, "[" . $alt . "]")); - } else { - $source = $img->attributes->getNamedItem("src")->nodeValue; - - $parsedSource = parse_url($source); - $internalSrc = $this->sanitizeFileName(urldecode(pathinfo($parsedSource['path'], PATHINFO_BASENAME))); - $internalPath = ""; - $isSourceExternal = FALSE; - - if ($this->resolveImage($source, $internalPath, $internalSrc, $isSourceExternal, $baseDir, $htmlDir, $backPath)) { - $img->setAttribute("src", $backPath . $internalPath); - } else if ($isSourceExternal) { - $postProcDomElememts[] = $img; // External image is missing - } // else do nothing, if the image is local, and missing, assume it's been generated. - } - } - - foreach ($postProcDomElememts as $target) { - if (is_array($target)) { - $target[0]->parentNode->replaceChild($target[1], $target[0]); - } else { - $target->parentNode->removeChild($target); - } - } - return TRUE; - } - - /** - * Process source tags in a DOMDocument. - * $externalReferences will determine what will happen to these images, and the img src will be rewritten accordingly. - * - * @param DOMDocument &$xmlDoc (referenced) - * @param int $externalReferences How to handle external references, EPub::EXTERNAL_REF_IGNORE, EPub::EXTERNAL_REF_ADD or EPub::EXTERNAL_REF_REMOVE_IMAGES? Default is EPub::EXTERNAL_REF_ADD. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * @param string $backPath The path to get back to the root of the archive from $htmlDir. - * - * @return bool FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE). - */ - protected function processChapterSources(&$xmlDoc, $externalReferences = EPub::EXTERNAL_REF_ADD, $baseDir = "", $htmlDir = "", $backPath = "") { - if ($this->isFinalized || $externalReferences === EPub::EXTERNAL_REF_IGNORE) { - return FALSE; - } - - if ($this->bookVersion !== EPub::BOOK_VERSION_EPUB3) { - // ePub 2 does not support multimedia formats, and they must be removed. - $externalReferences = EPub::EXTERNAL_REF_REMOVE_IMAGES; - } - - $postProcDomElememts = array(); - $images = $xmlDoc->getElementsByTagName("source"); - $itemCount = $images->length; - for ($idx = 0; $idx < $itemCount; $idx++) { - $img = $images->item($idx); - if ($externalReferences === EPub::EXTERNAL_REF_REMOVE_IMAGES) { - $postProcDomElememts[] = $img; - } else if ($externalReferences === EPub::EXTERNAL_REF_REPLACE_IMAGES) { - $altNode = $img->attributes->getNamedItem("alt"); - $alt = "image"; - if ($altNode !== NULL && strlen($altNode->nodeValue) > 0) { - $alt = $altNode->nodeValue; - } - $postProcDomElememts[] = array($img, $this->createDomFragment($xmlDoc, "[" . $alt . "]")); - } else { - $source = $img->attributes->getNamedItem("src")->nodeValue; - - $parsedSource = parse_url($source); - $internalSrc = $this->sanitizeFileName(urldecode(pathinfo($parsedSource['path'], PATHINFO_BASENAME))); - $internalPath = ""; - $isSourceExternal = FALSE; - - if ($this->resolveMedia($source, $internalPath, $internalSrc, $isSourceExternal, $baseDir, $htmlDir, $backPath)) { - $img->setAttribute("src", $backPath . $internalPath); - } else if ($isSourceExternal) { - $postProcDomElememts[] = $img; // External image is missing - } // else do nothing, if the image is local, and missing, assume it's been generated. - } - } - } - - /** - * Resolve an image src and determine it's target location and add it to the book. - * - * @param string $source Image Source link. - * @param string &$internalPath (referenced) Return value, will be set to the target path and name in the book. - * @param string &$internalSrc (referenced) Return value, will be set to the target name in the book. - * @param string &$isSourceExternal (referenced) Return value, will be set to TRUE if the image originated from a full URL. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * @param string $backPath The path to get back to the root of the archive from $htmlDir. - */ - protected function resolveImage($source, &$internalPath, &$internalSrc, &$isSourceExternal, $baseDir = "", $htmlDir = "", $backPath = "") { - if ($this->isFinalized) { - return FALSE; - } - $imageData = NULL; - - if (preg_match('#^(http|ftp)s?://#i', $source) == 1) { - $urlinfo = parse_url($source); - $urlPath = pathinfo($urlinfo['path']); - - if (strpos($urlinfo['path'], $baseDir."/") !== FALSE) { - $internalSrc = $this->sanitizeFileName(urldecode(substr($urlinfo['path'], strpos($urlinfo['path'], $baseDir."/") + strlen($baseDir) + 1))); - } - $internalPath = $urlinfo["scheme"] . "/" . $urlinfo["host"] . "/" . pathinfo($urlinfo["path"], PATHINFO_DIRNAME); - $isSourceExternal = TRUE; - $imageData = $this->getImage($source); - } else if (strpos($source, "/") === 0) { - $internalPath = pathinfo($source, PATHINFO_DIRNAME); - - $path = $source; - if (!file_exists($path)) { - $path = $this->docRoot . $path; - } - - $imageData = $this->getImage($path); - } else { - $internalPath = $htmlDir . "/" . preg_replace('#^[/\.]+#', '', pathinfo($source, PATHINFO_DIRNAME)); - - $path = $baseDir . "/" . $source; - if (!file_exists($path)) { - $path = $this->docRoot . $path; - } - - $imageData = $this->getImage($path); - } - if ($imageData !== FALSE) { - $iSrcInfo = pathinfo($internalSrc); - if (!empty($imageData['ext']) && $imageData['ext'] != $iSrcInfo['extension']) { - $internalSrc = $iSrcInfo['filename'] . "." . $imageData['ext']; - } - $internalPath = Zip::getRelativePath("images/" . $internalPath . "/" . $internalSrc); - if (!array_key_exists($internalPath, $this->fileList)) { - $this->addFile($internalPath, "i_" . $internalSrc, $imageData['image'], $imageData['mime']); - $this->fileList[$internalPath] = $source; - } - return TRUE; - } - return FALSE; - } - - /** - * Resolve a media src and determine it's target location and add it to the book. - * - * @param string $source Source link. - * @param string $internalPath (referenced) Return value, will be set to the target path and name in the book. - * @param string $internalSrc (referenced) Return value, will be set to the target name in the book. - * @param string $isSourceExternal (referenced) Return value, will be set to TRUE if the image originated from a full URL. - * @param string $baseDir Default is "", meaning it is pointing to the document root. - * @param string $htmlDir The path to the parent HTML file's directory from the root of the archive. - * @param string $backPath The path to get back to the root of the archive from $htmlDir. - */ - protected function resolveMedia($source, &$internalPath, &$internalSrc, &$isSourceExternal, $baseDir = "", $htmlDir = "", $backPath = "") { - if ($this->isFinalized) { - return FALSE; - } - $mediaPath = NULL; - $tmpFile; - - if (preg_match('#^(http|ftp)s?://#i', $source) == 1) { - $urlinfo = parse_url($source); - - if (strpos($urlinfo['path'], $baseDir."/") !== FALSE) { - $internalSrc = substr($urlinfo['path'], strpos($urlinfo['path'], $baseDir."/") + strlen($baseDir) + 1); - } - $internalPath = $urlinfo["scheme"] . "/" . $urlinfo["host"] . "/" . pathinfo($urlinfo["path"], PATHINFO_DIRNAME); - $isSourceExternal = TRUE; - $mediaPath = $this->getFileContents($source, true); - $tmpFile = $mediaPath; - } else if (strpos($source, "/") === 0) { - $internalPath = pathinfo($source, PATHINFO_DIRNAME); - - $mediaPath = $source; - if (!file_exists($mediaPath)) { - $mediaPath = $this->docRoot . $mediaPath; - } - } else { - $internalPath = $htmlDir . "/" . preg_replace('#^[/\.]+#', '', pathinfo($source, PATHINFO_DIRNAME)); - - $mediaPath = $baseDir . "/" . $source; - if (!file_exists($mediaPath)) { - $mediaPath = $this->docRoot . $mediaPath; - } - } - - if ($mediaPath !== FALSE) { - $mime = $this->getMime($source); - $internalPath = Zip::getRelativePath("media/" . $internalPath . "/" . $internalSrc); - - if (!array_key_exists($internalPath, $this->fileList) && - $this->addLargeFile($internalPath, "m_" . $internalSrc, $mediaPath, $mime)) { - $this->fileList[$internalPath] = $source; - } - if (isset($tmpFile)) { - unlink($tmpFile); - } - return TRUE; - } - return FALSE; - } - - /** - * Get Book Chapter count. - * - * @access public - * @return number of chapters - */ - function getChapterCount() { - return $this->chapterCount; - } - - /** - * Book title, mandatory. - * - * Used for the dc:title metadata parameter in the OPF file as well as the DocTitle attribute in the NCX file. - * - * @param string $title - * @access public - * @return bool $success - */ - function setTitle($title) { - if ($this->isFinalized) { - return FALSE; - } - $this->title = $title; - return TRUE; - } - - /** - * Get Book title. - * - * @access public - * @return $title - */ - function getTitle() { - return $this->title; - } - - /** - * Book language, mandatory - * - * Use the RFC3066 Language codes, such as "en", "da", "fr" etc. - * Defaults to "en". - * - * Used for the dc:language metadata parameter in the OPF file. - * - * @param string $language - * @access public - * @return bool $success - */ - function setLanguage($language) { - if ($this->isFinalized || mb_strlen($language) != 2) { - return FALSE; - } - $this->language = $language; - return TRUE; - } - - /** - * Get Book language. - * - * @access public - * @return $language - */ - function getLanguage() { - return $this->language; - } - - /** - * Unique book identifier, mandatory. - * Use the URI, or ISBN if available. - * - * An unambiguous reference to the resource within a given context. - * - * Recommended best practice is to identify the resource by means of a - * string conforming to a formal identification system. - * - * Used for the dc:identifier metadata parameter in the OPF file, as well - * as dtb:uid in the NCX file. - * - * Identifier type should only be: - * EPub::IDENTIFIER_URI - * EPub::IDENTIFIER_ISBN - * EPub::IDENTIFIER_UUID - * - * @param string $identifier - * @param string $identifierType - * @access public - * @return bool $success - */ - function setIdentifier($identifier, $identifierType) { - if ($this->isFinalized || ($identifierType !== EPub::IDENTIFIER_URI && $identifierType !== EPub::IDENTIFIER_ISBN && $identifierType !== EPub::IDENTIFIER_UUID)) { - return FALSE; - } - $this->identifier = $identifier; - $this->identifierType = $identifierType; - return TRUE; - } - - /** - * Get Book identifier. - * - * @access public - * @return $identifier - */ - function getIdentifier() { - return $this->identifier; - } - - /** - * Get Book identifierType. - * - * @access public - * @return $identifierType - */ - function getIdentifierType() { - return $this->identifierType; - } - - /** - * Book description, optional. - * - * An account of the resource. - * - * Description may include but is not limited to: an abstract, a table of - * contents, a graphical representation, or a free-text account of the - * resource. - * - * Used for the dc:source metadata parameter in the OPF file - * - * @param string $description - * @access public - * @return bool $success - */ - function setDescription($description) { - if ($this->isFinalized) { - return FALSE; - } - $this->description = $description; - return TRUE; - } - - /** - * Get Book description. - * - * @access public - * @return $description - */ - function getDescription() { - return $this->description; - } - - /** - * Book author or creator, optional. - * The $authorSortKey is basically how the name is to be sorted, usually - * it's "Lastname, First names" where the $author is the straight - * "Firstnames Lastname" - * - * An entity primarily responsible for making the resource. - * - * Examples of a Creator include a person, an organization, or a service. - * Typically, the name of a Creator should be used to indicate the entity. - * - * Used for the dc:creator metadata parameter in the OPF file and the - * docAuthor attribure in the NCX file. - * The sort key is used for the opf:file-as attribute in dc:creator. - * - * @param string $author - * @param string $authorSortKey - * @access public - * @return bool $success - */ - function setAuthor($author, $authorSortKey) { - if ($this->isFinalized) { - return FALSE; - } - $this->author = $author; - $this->authorSortKey = $authorSortKey; - return TRUE; - } - - /** - * Get Book author. - * - * @access public - * @return $author - */ - function getAuthor() { - return $this->author; - } - - /** - * Publisher Information, optional. - * - * An entity responsible for making the resource available. - * - * Examples of a Publisher include a person, an organization, or a service. - * Typically, the name of a Publisher should be used to indicate the entity. - * - * Used for the dc:publisher and dc:relation metadata parameters in the OPF file. - * - * @param string $publisherName - * @param string $publisherURL - * @access public - * @return bool $success - */ - function setPublisher($publisherName, $publisherURL) { - if ($this->isFinalized) { - return FALSE; - } - $this->publisherName = $publisherName; - $this->publisherURL = $publisherURL; - return TRUE; - } - - /** - * Get Book publisherName. - * - * @access public - * @return $publisherName - */ - function getPublisherName() { - return $this->publisherName; - } - - /** - * Get Book publisherURL. - * - * @access public - * @return $publisherURL - */ - function getPublisherURL() { - return $this->publisherURL; - } - - /** - * Release date, optional. If left blank, the time of the finalization will - * be used. - * - * A point or period of time associated with an event in the lifecycle of - * the resource. - * - * Date may be used to express temporal information at any level of - * granularity. Recommended best practice is to use an encoding scheme, - * such as the W3CDTF profile of ISO 8601 [W3CDTF]. - * - * Used for the dc:date metadata parameter in the OPF file - * - * @param long $timestamp - * @access public - * @return bool $success - */ - function setDate($timestamp) { - if ($this->isFinalized) { - return FALSE; - } - $this->date = $timestamp; - $this->opf->date = $timestamp; - return TRUE; - } - - /** - * Get Book date. - * - * @access public - * @return $date - */ - function getDate() { - return $this->date; - } - - /** - * Book (copy)rights, optional. - * - * Information about rights held in and over the resource. - * - * Typically, rights information includes a statement about various - * property rights associated with the resource, including intellectual - * property rights. - * - * Used for the dc:rights metadata parameter in the OPF file - * - * @param string $rightsText - * @access public - * @return bool $success - */ - function setRights($rightsText) { - if ($this->isFinalized) { - return FALSE; - } - $this->rights = $rightsText; - return TRUE; - } - - /** - * Get Book rights. - * - * @access public - * @return $rights - */ - function getRights() { - return $this->rights; - } - - /** - * Add book Subject. - * - * The topic of the resource. - * - * Typically, the subject will be represented using keywords, key phrases, - * or classification codes. Recommended best practice is to use a - * controlled vocabulary. To describe the spatial or temporal topic of the - * resource, use the Coverage element. - * - * @param string $subject - */ - function setSubject($subject) { - if ($this->isFinalized) { - return; - } - $this->opf->addDCMeta(DublinCore::SUBJECT, $this->decodeHtmlEntities($subject)); - } - - /** - * Book source URL, optional. - * - * A related resource from which the described resource is derived. - * - * The described resource may be derived from the related resource in whole - * or in part. Recommended best practice is to identify the related - * resource by means of a string conforming to a formal identification system. - * - * Used for the dc:source metadata parameter in the OPF file - * - * @param string $sourceURL - * @access public - * @return bool $success - */ - function setSourceURL($sourceURL) { - if ($this->isFinalized) { - return FALSE; - } - $this->sourceURL = $sourceURL; - return TRUE; - } - - /** - * Get Book sourceURL. - * - * @access public - * @return $sourceURL - */ - function getSourceURL() { - return $this->sourceURL; - } - - /** - * Coverage, optional. - * - * The spatial or temporal topic of the resource, the spatial applicability - * of the resource, or the jurisdiction under which the resource is relevant. - * - * Spatial topic and spatial applicability may be a named place or a location - * specified by its geographic coordinates. Temporal topic may be a named - * period, date, or date range. A jurisdiction may be a named administrative - * entity or a geographic place to which the resource applies. Recommended - * best practice is to use a controlled vocabulary such as the Thesaurus of - * Geographic Names [TGN]. Where appropriate, named places or time periods - * can be used in preference to numeric identifiers such as sets of - * coordinates or date ranges. - * - * Used for the dc:coverage metadata parameter in the OPF file - * - * Same as ->addDublinCoreMetadata(DublinCore::COVERAGE, $coverage); - * - * @param string $coverage - * @access public - * @return bool $success - */ - function setCoverage($coverage) { - if ($this->isFinalized) { - return FALSE; - } - $this->coverage = $coverage; - return TRUE; - } - - /** - * Get Book coverage. - * - * @access public - * @return $coverage - */ - function getCoverage() { - return $this->coverage; - } - - /** - * Set book Relation. - * - * A related resource. - * - * Recommended best practice is to identify the related resource by means - * of a string conforming to a formal identification system. - * - * @param string $relation - */ - function setRelation($relation) { - if ($this->isFinalized) { - return; - } - $this->relation = $relation; - } - - /** - * Get the book relation. - * - * @return string The relation. - */ - function getRelation() { - return $this->relation; - } - - /** - * Set book Generator. - * - * The generator is a meta tag added to the ncx file, it is not visible - * from within the book, but is a kind of electronic watermark. - * - * @param string $generator - */ - function setGenerator($generator) { - if ($this->isFinalized) { - return; - } - $this->generator = $generator; - } - - /** - * Get the book relation. - * - * @return string The generator identity string. - */ - function getGenerator() { - return $this->generator; - } - - /** - * Set ePub date formate to the short yyyy-mm-dd form, for compliance with - * a bug in EpubCheck, prior to its version 1.1. - * - * The latest version of ePubCheck can be obtained here: - * http://code.google.com/p/epubcheck/ - * - * @access public - * @return bool $success - */ - function setShortDateFormat() { - if ($this->isFinalized) { - return FALSE; - } - $this->dateformat = $this->dateformatShort; - return TRUE; - } - - /** - * @Deprecated - */ - function setIgnoreEmptyBuffer($ignoreEmptyBuffer = TRUE) { - die ("Function was deprecated, functionality is no longer needed."); - } - - /** - * Set the references title for the ePub 3 landmarks section - * - * @param string $referencesTitle - * @param string $referencesId - * @param string $referencesClass - * @return bool - */ - function setReferencesTitle($referencesTitle = "Guide", $referencesId = "", $referencesClass = "references") { - if ($this->isFinalized) { - return FALSE; - } - $this->ncx->referencesTitle = is_string($referencesTitle) ? trim($referencesTitle) : "Guide"; - $this->ncx->referencesId = is_string($referencesId) ? trim($referencesId) : "references"; - $this->ncx->referencesClass = is_string($referencesClass) ? trim($referencesClass) : "references"; - return TRUE; - } - - /** - * Set the references title for the ePub 3 landmarks section - * - * @param bool $referencesTitle - */ - function setisReferencesAddedToToc($isReferencesAddedToToc = TRUE) { - if ($this->isFinalized) { - return FALSE; - } - $this->isReferencesAddedToToc = $isReferencesAddedToToc === TRUE; - return TRUE; - } - - /** - * Get Book status. - * - * @access public - * @return bool - */ - function isFinalized() { - return $this->isFinalized; - } - - /** - * Build the Table of Contents. This is not strictly necessary, as most eReaders will build it from the navigation structure in the .ncx file. - * - * @param string $cssFileName Include a link to this css file in the TOC html. - * @param string $tocCSSClass The TOC is a
, if you need special formatting, you can add a css class for that div. Default is "toc". - * @param string $title Title of the Table of contents. Default is "Table of Contents". Use this for ie. languages other than English. - * @param bool $addReferences include reference pages in the TOC, using the $referencesOrder array to determine the order of the pages in the TOC. Default is TRUE. - * @param bool $addToIndex Add the TOC to the NCX index at the current leve/position. Default is FALSE - * @param string $tocFileName Change teh default name of the TOC file. The default is "TOC.xhtml" - */ - function buildTOC($cssFileName = NULL, $tocCSSClass = "toc", $title = "Table of Contents", $addReferences = TRUE, $addToIndex = FALSE, $tocFileName = "TOC.xhtml") { - if ($this->isFinalized) { - return FALSE; - } - $this->buildTOC = TRUE; - $this->tocTitle = $title; - $this->tocFileName = $this->normalizeFileName($tocFileName); - if (!empty($cssFileName)) { - $this->tocCssFileName = $this->normalizeFileName($cssFileName); - } - $this->tocCSSClass = $tocCSSClass; - $this->tocAddReferences = $addReferences; - - $this->opf->addItemRef("ref_" . Reference::TABLE_OF_CONTENTS, FALSE); - $this->opf->addReference(Reference::TABLE_OF_CONTENTS, $title, $this->tocFileName); - - if ($addToIndex) { - $navPoint = new NavPoint($this->decodeHtmlEntities($title), $this->tocFileName, "ref_" . Reference::TABLE_OF_CONTENTS); - $this->ncx->addNavPoint($navPoint); - } else { - $this->ncx->referencesList[Reference::TABLE_OF_CONTENTS] = $this->tocFileName; - $this->ncx->referencesName[Reference::TABLE_OF_CONTENTS] = $title; - } - } - - private function finalizeTOC() { - if (!$this->buildTOC) { - return FALSE; - } - - if (empty($this->tocTitle)) { - $this->tocTitle = "Table of Contents"; - } - - $tocData = "\n"; - - if ($this->isEPubVersion2()) { - $tocData .= "\n" - . "\n" - . "\n\n"; - } else { - $tocData .= "\n" - . "\n\n"; - } - - if (!empty($this->tocCssFileName)) { - $tocData .= "tocCssFileName . "\" />\n"; - } - - $tocData .= "" . $this->tocTitle . "\n" - . " \n" - . "\n" - . "

" . $this->tocTitle . "

\ntocCSSClass)) { - $tocData .= " class=\"" . $this->tocCSSClass . "\""; - } - $tocData .= ">\n"; - - while (list($item, $descriptive) = each($this->referencesOrder)) { - if ($item === "text") { - while (list($chapterName, $navPoint) = each($this->ncx->chapterList)) { - $fileName = $navPoint->getContentSrc(); - $level = $navPoint->getLevel() -2; - $tocData .= "\t

" . str_repeat("      ", $level) . "" . $chapterName . "

\n"; - } - } else if ($this->tocAddReferences === TRUE) { - if (array_key_exists($item, $this->ncx->referencesList)) { - $tocData .= "\t

ncx->referencesList[$item] . "\">" . $descriptive . "

\n"; - } else if ($item === "toc") { - $tocData .= "\t

" . $this->tocTitle . "

\n"; - } else if ($item === "cover" && $this->isCoverImageSet) { - $tocData .= "\t

" . $descriptive . "

\n"; - } - } - } - $tocData .= "
\n\n\n"; - - $this->addReferencePage($this->tocTitle, $this->tocFileName, $tocData, Reference::TABLE_OF_CONTENTS); - - } - - /** - * @return bool - */ - function isEPubVersion2() { - return $this->bookVersion === EPub::BOOK_VERSION_EPUB2; - } - - /** - * @param string $cssFileName - * @param string $title - * @return string - */ - function buildEPub3TOC($cssFileName = NULL, $title = "Table of Contents") { - $this->ncx->referencesOrder = $this->referencesOrder; - $this->ncx->setDocTitle($this->decodeHtmlEntities($this->title)); - return $this->ncx->finalizeEPub3($title, $cssFileName); - } - - /** - * @param string $fileName - * @param string $tocData - * @return bool - */ - function addEPub3TOC($fileName, $tocData) { - if ($this->isEPubVersion2() || $this->isFinalized || array_key_exists($fileName, $this->fileList)) { - return FALSE; - } - $fileName = Zip::getRelativePath($fileName); - $fileName = preg_replace('#^[/\.]+#i', "", $fileName); - - $this->zip->addFile($tocData, $this->bookRoot.$fileName); - - $this->fileList[$fileName] = $fileName; - $this->opf->addItem("toc", $fileName, "application/xhtml+xml", "nav"); - return TRUE; - } - - /** - * Check for mandatory parameters and finalize the e-book. - * Once finalized, the book is locked for further additions. - * - * @return bool $success - */ - function finalize() { - if ($this->isFinalized || $this->chapterCount == 0 || empty($this->title) || empty($this->language)) { - return FALSE; - } - - if (empty($this->identifier) || empty($this->identifierType)) { - $this->setIdentifier($this->createUUID(4), EPub::IDENTIFIER_UUID); - } - - if ($this->date == 0) { - $this->date = time(); - } - - if (empty($this->sourceURL)) { - $this->sourceURL = $this->getCurrentPageURL(); - } - - if (empty($this->publisherURL)) { - $this->sourceURL = $this->getCurrentServerURL(); - } - - // Generate OPF data: - $this->opf->setIdent("BookId"); - $this->opf->initialize($this->title, $this->language, $this->identifier, $this->identifierType); - - $DCdate = new DublinCore(DublinCore::DATE, gmdate($this->dateformat, $this->date)); - $DCdate->addOpfAttr("event", "publication"); - $this->opf->metadata->addDublinCore($DCdate); - - if (!empty($this->description)) { - $this->opf->addDCMeta(DublinCore::DESCRIPTION, $this->decodeHtmlEntities($this->description)); - } - - if (!empty($this->publisherName)) { - $this->opf->addDCMeta(DublinCore::PUBLISHER, $this->decodeHtmlEntities($this->publisherName)); - } - - if (!empty($this->publisherURL)) { - $this->opf->addDCMeta(DublinCore::RELATION, $this->decodeHtmlEntities($this->publisherURL)); - } - - if (!empty($this->author)) { - $author = $this->decodeHtmlEntities($this->author); - $this->opf->addCreator($author, $this->decodeHtmlEntities($this->authorSortKey), MarcCode::AUTHOR); - $this->ncx->setDocAuthor($author); - } - - if (!empty($this->rights)) { - $this->opf->addDCMeta(DublinCore::RIGHTS, $this->decodeHtmlEntities($this->rights)); - } - - if (!empty($this->coverage)) { - $this->opf->addDCMeta(DublinCore::COVERAGE, $this->decodeHtmlEntities($this->coverage)); - } - - if (!empty($this->sourceURL)) { - $this->opf->addDCMeta(DublinCore::SOURCE, $this->sourceURL); - } - - if (!empty($this->relation)) { - $this->opf->addDCMeta(DublinCore::RELATION, $this->decodeHtmlEntities($this->relation)); - } - - if ($this->isCoverImageSet) { - $this->opf->addMeta("cover", "CoverImage"); - } - - if (!empty($this->generator)) { - $gen = $this->decodeHtmlEntities($this->generator); - $this->opf->addMeta("generator", $gen); - $this->ncx->addMetaEntry("dtb:generator", $gen); - } - - if ($this->EPubMark) { - $this->opf->addMeta("generator", "EPub (Version " . self::VERSION . ") by A. Grandt, http://www.phpclasses.org/package/6115"); - } - - reset($this->ncx->chapterList); - list($firstChapterName, $firstChapterNavPoint) = each($this->ncx->chapterList); - $firstChapterFileName = $firstChapterNavPoint->getContentSrc(); - $this->opf->addReference(Reference::TEXT, $this->decodeHtmlEntities($firstChapterName), $firstChapterFileName); - - $this->ncx->setUid($this->identifier); - - $this->ncx->setDocTitle($this->decodeHtmlEntities($this->title)); - - $this->ncx->referencesOrder = $this->referencesOrder; - if ($this->isReferencesAddedToToc) { - $this->ncx->finalizeReferences(); - } - - $this->finalizeTOC(); - - if (!$this->isEPubVersion2()) { - $this->addEPub3TOC("epub3toc.xhtml", $this->buildEPub3TOC()); - } - - $opfFinal = $this->fixEncoding($this->opf->finalize()); - $ncxFinal = $this->fixEncoding($this->ncx->finalize()); - - if (mb_detect_encoding($opfFinal, 'UTF-8', true) === "UTF-8") { - $this->zip->addFile($opfFinal, $this->bookRoot."book.opf"); - } else { - $this->zip->addFile(mb_convert_encoding($opfFinal, "UTF-8"), $this->bookRoot."book.opf"); - } - - if (mb_detect_encoding($ncxFinal, 'UTF-8', true) === "UTF-8") { - $this->zip->addFile($ncxFinal, $this->bookRoot."book.ncx"); - } else { - $this->zip->addFile(mb_convert_encoding($ncxFinal, "UTF-8"), $this->bookRoot."book.ncx"); - } - - $this->opf = NULL; - $this->ncx = NULL; - - $this->isFinalized = TRUE; - return TRUE; - } - - /** - * Ensure the encoded string is a valid UTF-8 string. - * - * Note, that a mb_detect_encoding on the returned string will still return ASCII if the entire string is comprized of characters in the 1-127 range. - * - * @link: http://snippetdb.com/php/convert-string-to-utf-8-for-mysql - * @param string $in_str - * @return string converted string. - */ - function fixEncoding($in_str) { - if (mb_detect_encoding($in_str) == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) { - return $in_str; - } else { - return utf8_encode($in_str); - } - } - - /** - * Return the finalized book. - * - * @return string with the book in binary form. - */ - function getBook() { - if (!$this->isFinalized) { - $this->finalize(); - } - - return $this->zip->getZipData(); - } - - /** - * Remove disallowed characters from string to get a nearly safe filename - * - * @param string $fileName - * @return mixed|string - */ - function sanitizeFileName($fileName) { - $fileName1 = str_replace($this->forbiddenCharacters, '', $fileName); - $fileName2 = preg_replace('/[\s-]+/', '-', $fileName1); - return trim($fileName2, '.-_'); - - } - - /** - * Cleanup the filepath, and remove leading . and / characters. - * - * Sometimes, when a path is generated from multiple fragments, - * you can get something like "../data/html/../images/image.jpeg" - * ePub files don't work well with that, this will normalize that - * example path to "data/images/image.jpeg" - * - * @param string $fileName - * @return string normalized filename - */ - function normalizeFileName($fileName) { - return preg_replace('#^[/\.]+#i', "", Zip::getRelativePath($fileName)); - } - - /** - * Save the ePub file to local disk. - * - * @param string $fileName - * @param string $baseDir If empty baseDir is absolute to server path, if omitted it's relative to script path - * @return The sent file name if successfull, FALSE if it failed. - */ - function saveBook($fileName, $baseDir = '.') { - - // Make fileName safe - $fileName = $this->sanitizeFileName($fileName); - - // Finalize book, if it's not done already - if (!$this->isFinalized) { - $this->finalize(); - } - - if (stripos(strrev($fileName), "bupe.") !== 0) { - $fileName .= ".epub"; - } - - // Try to open file access - $fh = fopen($baseDir.'/'.$fileName, "w"); - - if ($fh) { - fputs($fh, $this->getBook()); - fclose($fh); - - // if file is written return TRUE - return $fileName; - } - - // return FALSE by default - return FALSE; - } - - /** - * Return the finalized book size. - * - * @return string - */ - function getBookSize() { - if (!$this->isFinalized) { - $this->finalize(); - } - - return $this->zip->getArchiveSize(); - } - - /** - * Send the book as a zip download - * - * Sending will fail if the output buffer is in use. You can override this limit by - * calling setIgnoreEmptyBuffer(TRUE), though the function will still fail if that - * buffer is not empty. - * - * @param string $fileName The name of the book without the .epub at the end. - * @return The sent file name if successfull, FALSE if it failed. - */ - function sendBook($fileName) { - if (!$this->isFinalized) { - $this->finalize(); - } - - if (stripos(strrev($fileName), "bupe.") !== 0) { - $fileName .= ".epub"; - } - - if (TRUE === $this->zip->sendZip($fileName, "application/epub+zip")) { - return $fileName; - } - return FALSE; - } - - /** - * Generates an UUID. - * - * Default version (4) will generate a random UUID, version 3 will URL based UUID. - * - * Added for convinience - * - * @param int $bookVersion UUID version to retrieve, See lib.uuid.manual.html for details. - * @param string $url - * @return string The formatted uuid - */ - function createUUID($bookVersion = 4, $url = NULL) { - include_once("lib.uuid.php"); - return UUID::mint($bookVersion, $url, UUID::nsURL); - } - - /** - * Get the url of the current page. - * Example use: Default Source URL - * - * $return string Page URL. - */ - function getCurrentPageURL() { - $pageURL = $this->getCurrentServerURL() . filter_input(INPUT_SERVER, "REQUEST_URI"); - return $pageURL; - } - - /** - * Get the url of the server. - * Example use: Default Publisher URL - * - * $return string Server URL. - */ - function getCurrentServerURL() { - $serverURL = 'http'; - $https = filter_input(INPUT_SERVER, "HTTPS"); - $port = filter_input(INPUT_SERVER, "SERVER_PORT"); - - if ($https === "on") { - $serverURL .= "s"; - } - $serverURL .= "://" . filter_input(INPUT_SERVER, "SERVER_NAME"); - if ($port != "80") { - $serverURL .= ":" . $port; - } - return $serverURL . '/'; - } - - /** - * Try to determine the mimetype of the file path. - * - * @param string $source Path - * @return string mimetype, or FALSE. - */ - function getMime($source) { - return $this->mimetypes[pathinfo($source, PATHINFO_EXTENSION)]; - } - - /** - * Get an image from a file or url, return it resized if the image exceeds the $maxImageWidth or $maxImageHeight directives. - * - * The return value is an array. - * ['width'] is the width of the image. - * ['height'] is the height of the image. - * ['mime'] is the mime type of the image. Resized images are always in jpeg format. - * ['image'] is the image data. - * ['ext'] is the extension of the image file. - * - * @param string $source path or url to file. - * $return array - */ - function getImage($source) { - $width = -1; - $height = -1; - $mime = "application/octet-stream"; - $type = FALSE; - $ext = ""; - - - $image = $this->getFileContents($source); - - if ($image !== FALSE && strlen($image) > 0) { - $imageFile = imagecreatefromstring($image); - if ($imageFile !== false) { - $width = ImageSX($imageFile); - $height = ImageSY($imageFile); - } - if ($this->isExifInstalled) { - @$type = exif_imagetype($source); - $mime = image_type_to_mime_type($type); - } - if ($mime === "application/octet-stream") { - $mime = $this->image_file_type_from_binary($image); - } - if ($mime === "application/octet-stream") { - $mime = $this->getMimeTypeFromUrl($source); - } - } else { - return FALSE; - } - - if ($width <= 0 || $height <= 0) { - return FALSE; - } - - $ratio = 1; - - if ($this->isGdInstalled) { - if ($width > $this->maxImageWidth) { - $ratio = $this->maxImageWidth/$width; - } - if ($height*$ratio > $this->maxImageHeight) { - $ratio = $this->maxImageHeight/$height; - } - - if ($ratio < 1 || empty($mime) || ($this->isGifImagesEnabled !== FALSE && $mime == "image/gif")) { - $image_o = imagecreatefromstring($image); - $image_p = imagecreatetruecolor($width*$ratio, $height*$ratio); - - if ($mime == "image/png") { - imagealphablending($image_p, false); - imagesavealpha($image_p, true); - imagealphablending($image_o, true); - - imagecopyresampled($image_p, $image_o, 0, 0, 0, 0, ($width*$ratio), ($height*$ratio), $width, $height); - ob_start(); - imagepng($image_p, NULL, 9); - $image = ob_get_contents(); - ob_end_clean(); - - $ext = "png"; - } else { - imagecopyresampled($image_p, $image_o, 0, 0, 0, 0, ($width*$ratio), ($height*$ratio), $width, $height); - ob_start(); - imagejpeg($image_p, NULL, 80); - $image = ob_get_contents(); - ob_end_clean(); - - $mime = "image/jpeg"; - $ext = "jpg"; - } - imagedestroy($image_o); - imagedestroy($image_p); - } - } - - if ($ext === "") { - static $mimeToExt = array ( - 'image/jpeg' => 'jpg', - 'image/gif' => 'gif', - 'image/png' => 'png' - ); - - if (isset($mimeToExt[$mime])) { - $ext = $mimeToExt[$mime]; - } - } - - $rv = array(); - $rv['width'] = $width*$ratio; - $rv['height'] = $height*$ratio; - $rv['mime'] = $mime; - $rv['image'] = $image; - $rv['ext'] = $ext; - - return $rv; - } - - /** - * Get file contents, using curl if available, else file_get_contents - * - * @param string $source - * @return bool - */ - function getFileContents($source, $toTempFile = FALSE) { - $isExternal = preg_match('#^(http|ftp)s?://#i', $source) == 1; - - if ($isExternal && $this->isCurlInstalled) { - $ch = curl_init(); - $outFile = NULL; - $fp = NULL; - $res = FALSE; - $info = array('http_code' => 500); - - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_URL, str_replace(" ","%20",$source)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_BUFFERSIZE, 4096); - - if ($toTempFile) { - $outFile = tempnam(sys_get_temp_dir(), "EPub_v" . EPub::VERSION . "_"); - $fp = fopen($outFile, "w+b"); - curl_setopt($ch, CURLOPT_FILE, $fp); - - $res = curl_exec($ch); - $info = curl_getinfo($ch); - - curl_close($ch); - fclose($fp); - } else { - $res = curl_exec($ch); - $info = curl_getinfo($ch); - - curl_close($ch); - } - - if ($info['http_code'] == 200 && $res != false) { - if ($toTempFile) { - return $outFile; - } - return $res; - } - return FALSE; - } - - if ($this->isFileGetContentsInstalled && (!$isExternal || $this->isFileGetContentsExtInstalled)) { - @$data = file_get_contents($source); - return $data; - } - return FALSE; - } - - /** - * get mime type from image data - * - * By fireweasel found on http://stackoverflow.com/questions/2207095/get-image-mimetype-from-resource-in-php-gd - * @staticvar array $type - * @param object $binary - * @return string - */ - function image_file_type_from_binary($binary) { - $hits = 0; - if (!preg_match( - '/\A(?:(\xff\xd8\xff)|(GIF8[79]a)|(\x89PNG\x0d\x0a)|(BM)|(\x49\x49(?:\x2a\x00|\x00\x4a))|(FORM.{4}ILBM))/', - $binary, $hits)) { - return 'application/octet-stream'; - } - static $type = array ( - 1 => 'image/jpeg', - 2 => 'image/gif', - 3 => 'image/png', - 4 => 'image/x-windows-bmp', - 5 => 'image/tiff', - 6 => 'image/x-ilbm', - ); - return $type[count($hits) - 1]; - } - - /** - * @param string $source URL Source - * @return string MimeType - */ - function getMimeTypeFromUrl($source) { - $ext = FALSE; - - $srev = strrev($source); - $pos = strpos($srev, "?"); - if ($pos !== FALSE) { - $srev = substr($srev, $pos+1); - } - - $pos = strpos($srev, "."); - if ($pos !== FALSE) { - $ext = strtolower(strrev(substr($srev, 0, $pos))); - } - - if ($ext !== FALSE) { - return $this->getMimeTypeFromExtension($ext); - } - return "application/octet-stream"; - } - - /** - * @param string $ext Extension - * @return string MimeType - */ - function getMimeTypeFromExtension($ext) { - switch ($ext) { - case "jpg": - case "jpe": - case "jpeg": - return 'image/jpeg'; - case "gif": - return 'image/gif'; - case "png": - return 'image/png'; - case "bmp": - return 'image/x-windows-bmp'; - case "tif": - case "tiff": - case "cpt": - return 'image/tiff'; - case "lbm": - case "ilbm": - return 'image/x-ilbm'; - default: - return "application/octet-stream"; - } - } - - /** - * Encode html code to use html entities, safeguarding it from potential character encoding peoblems - * This function is a bit different from the vanilla htmlentities function in that it does not encode html tags. - * - * The regexp is taken from the PHP Manual discussion, it was written by user "busbyjon". - * http://www.php.net/manual/en/function.htmlentities.php#90111 - * - * @param string $string string to encode. - */ - public function encodeHtml($string) { - $string = strtr($string, $this->html_encoding_characters); - - //return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/", "&\\1", $string); - //return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/", "&", $string); - return $string; - } - - /** - * Helper function to create a DOM fragment with given markup. - * - * @author Adam Schmalhofer - * - * @param DOMDocument $dom - * @param string $markup - * @return DOMNode fragment in a node. - */ - protected function createDomFragment($dom, $markup) { - $node = $dom->createDocumentFragment(); - $node->appendXML($markup); - return $node; - } - - /** - * Retrieve an array of file names currently added to the book. - * $key is the filename used in the book - * $value is the original filename, will be the same as $key for most entries - * - * @return array file list - */ - function getFileList() { - return $this->fileList; - } - - /** - * @deprecated Use Zip::getRelativePath($relPath) instead. - */ - function relPath($relPath) { - die ("Function was deprecated, use Zip::getRelativePath(\$relPath); instead"); - } - - /** - * Set default chapter target size. - * Default is 250000 bytes, and minimum is 10240 bytes. - * - * @param int $size segment size in bytes - * @return void - */ - function setSplitSize($size) { - $this->splitDefaultSize = (int)$size; - if ($size < 10240) { - $this->splitDefaultSize = 10240; // Making the file smaller than 10k is not a good idea. - } - } - - /** - * Get the chapter target size. - * - * @return $size - */ - function getSplitSize() { - return $this->splitDefaultSize; - } - - /** - * Remove all non essential html tags and entities. - * - * @global type $htmlEntities - * @param string $string - * @return string with the stripped entities. - */ - function decodeHtmlEntities($string) { - global $htmlEntities; - - $string = preg_replace('~\s*\s*~i', "\n", $string); - $string = preg_replace('~\s*\s*~i', "\n\n", $string); - $string = preg_replace('~<[^>]*>~', '', $string); - - $string = strtr($string, $htmlEntities); - - $string = str_replace('&', '&', $string); - $string = str_replace('&amp;', '&', $string); - $string = preg_replace('~&(#x*[a-fA-F0-9]+;)~', '&\1', $string); - $string = str_replace('<', '<', $string); - $string = str_replace('>', '>', $string); - - return $string; - } - - /** - * Simply remove all HTML tags, brute force and no finesse. - * - * @param string $string html - * @return string - */ - function html2text($string) { - return preg_replace('~<[^>]*>~', '', $string); - } - - /** - * @return string - */ - function getLog() { - return $this->log->getLog(); - } -} diff --git a/EPubChapterSplitter.php b/EPubChapterSplitter.php deleted file mode 100644 index 1d44f23..0000000 --- a/EPubChapterSplitter.php +++ /dev/null @@ -1,201 +0,0 @@ - - * @copyright 2009-2014 A. Grandt - * @license GNU LGPL 2.1 - * @link http://www.phpclasses.org/package/6115 - * @link https://github.com/Grandt/PHPePub - * @version 3.20 - */ -class EPubChapterSplitter { - const VERSION = 3.20; - - private $splitDefaultSize = 250000; - private $bookVersion = EPub::BOOK_VERSION_EPUB2; - - /** - * - * Enter description here ... - * - * @param unknown_type $ident - */ - function setVersion($bookVersion) { - $this->bookVersion = is_string($bookVersion) ? trim($bookVersion) : EPub::BOOK_VERSION_EPUB2; - } - - /** - * Set default chapter target size. - * Default is 250000 bytes, and minimum is 10240 bytes. - * - * @param $size segment size in bytes - * @return void - */ - function setSplitSize($size) { - $this->splitDefaultSize = (int)$size; - if ($size < 10240) { - $this->splitDefaultSize = 10240; // Making the file smaller than 10k is not a good idea. - } - } - - /** - * Get the chapter target size. - * - * @return $size - */ - function getSplitSize() { - return $this->splitDefaultSize; - } - - /** - * Split $chapter into multiple parts. - * - * The search string can either be a regular string or a PHP PECL Regular Expression pattern as defined here: http://www.php.net/manual/en/pcre.pattern.php - * If the search string is a regular string, the matching will be for lines in the HTML starting with the string given - * - * @param String $chapter XHTML file - * @param Bool $splitOnSearchString Split on chapter boundaries, Splitting on search strings disables the split size check. - * @param String $searchString Chapter string to search for can be fixed text, or a regular expression pattern. - * - * @return array with 1 or more parts - */ - function splitChapter($chapter, $splitOnSearchString = false, $searchString = '/^Chapter\\ /i') { - $chapterData = array(); - $isSearchRegexp = $splitOnSearchString && (preg_match('#^(\D|\S|\W).+\1[imsxeADSUXJu]*$#m', $searchString) == 1); - if ($splitOnSearchString && !$isSearchRegexp) { - $searchString = '#^<.+?>' . preg_quote($searchString, '#') . "#"; - } - - if (!$splitOnSearchString && strlen($chapter) <= $this->splitDefaultSize) { - return array($chapter); - } - - $xmlDoc = new DOMDocument(); - @$xmlDoc->loadHTML($chapter); - - $head = $xmlDoc->getElementsByTagName("head"); - $body = $xmlDoc->getElementsByTagName("body"); - - $htmlPos = stripos($chapter, "", $htmlPos); - $newXML = substr($chapter, 0, $htmlEndPos+1) . "\n"; - if (strpos(trim($newXML), "\n" . $newXML; - } - $headerLength = strlen($newXML); - - $files = array(); - $chapterNames = array(); - $domDepth = 0; - $domPath = array(); - $domClonedPath = array(); - - $curFile = $xmlDoc->createDocumentFragment(); - $files[] = $curFile; - $curParent = $curFile; - $curSize = 0; - - $bodyLen = strlen($xmlDoc->saveXML($body->item(0))); - $headLen = strlen($xmlDoc->saveXML($head->item(0))) + $headerLength; - - $partSize = $this->splitDefaultSize - $headLen; - - if ($bodyLen > $partSize) { - $parts = ceil($bodyLen / $partSize); - $partSize = ($bodyLen / $parts) - $headLen; - } - - $node = $body->item(0)->firstChild; - - do { - $nodeData = $xmlDoc->saveXML($node); - $nodeLen = strlen($nodeData); - - if ($nodeLen > $partSize && $node->hasChildNodes()) { - $domPath[] = $node; - $domClonedPath[] = $node->cloneNode(false); - $domDepth++; - - $node = $node->firstChild; - } - - $node2 = $node->nextSibling; - - if ($node != null && $node->nodeName != "#text") { - $doSplit = false; - if ($splitOnSearchString) { - $doSplit = preg_match($searchString, $nodeData) == 1; - if ($doSplit) { - $chapterNames[] = trim($nodeData); - } - } - - if ($curSize > 0 && ($doSplit || (!$splitOnSearchString && $curSize + $nodeLen > $partSize))) { - $curFile = $xmlDoc->createDocumentFragment(); - $files[] = $curFile; - $curParent = $curFile; - if ($domDepth > 0) { - reset($domPath); - reset($domClonedPath); - $oneDomClonedPath = each($domClonedPath); - while ($oneDomClonedPath) { - list($k, $v) = $oneDomClonedPath; - $newParent = $v->cloneNode(false); - $curParent->appendChild($newParent); - $curParent = $newParent; - $oneDomClonedPath = each($domClonedPath); - } - } - $curSize = strlen($xmlDoc->saveXML($curFile)); - } - $curParent->appendChild($node->cloneNode(true)); - $curSize += $nodeLen; - } - - $node = $node2; - while ($node == null && $domDepth > 0) { - $domDepth--; - $node = end($domPath)->nextSibling; - array_pop($domPath); - array_pop($domClonedPath); - $curParent = $curParent->parentNode; - } - } while ($node != null); - - $curFile = null; - $curSize = 0; - - $xml = new DOMDocument('1.0', $xmlDoc->xmlEncoding); - $xml->lookupPrefix("http://www.w3.org/1999/xhtml"); - $xml->preserveWhiteSpace = false; - $xml->formatOutput = true; - - for ($idx = 0; $idx < count($files); $idx++) { - $xml2Doc = new DOMDocument('1.0', $xmlDoc->xmlEncoding); - $xml2Doc->lookupPrefix("http://www.w3.org/1999/xhtml"); - $xml2Doc->loadXML($newXML); - $html = $xml2Doc->getElementsByTagName("html")->item(0); - $html->appendChild($xml2Doc->importNode($head->item(0), true)); - $body = $xml2Doc->createElement("body"); - $html->appendChild($body); - $body->appendChild($xml2Doc->importNode($files[$idx], true)); - - // force pretty printing and correct formatting, should not be needed, but it is. - $xml->loadXML($xml2Doc->saveXML()); - - $doc = $xml->saveXML(); - - if ($this->bookVersion === EPub::BOOK_VERSION_EPUB3) { - $doc = preg_replace('#^\s*\s*#im', '', $doc); - } - - $chapterData[$splitOnSearchString ? $chapterNames[$idx] : $idx] = $doc; - } - - return $chapterData; - } -} -?> diff --git a/Logger.php b/Logger.php deleted file mode 100644 index 314019c..0000000 --- a/Logger.php +++ /dev/null @@ -1,92 +0,0 @@ - - * @copyright 2012-2013 A. Grandt - * @license GNU LGPL, Attribution required for commercial implementations, requested for everything else. - * @version 1.00 - */ -class Logger { - const VERSION = 1.00; - - private $log = ""; - private $tStart; - private $tLast; - private $name = NULL; - private $isLogging = FALSE; - private $isDebugging = FALSE; - - /** - * Class constructor. - * - * @return void - */ - function __construct($name = NULL, $isLogging = FALSE) { - if ($name === NULL) { - $this->name = ""; - } else { - $this->name = $name . " : "; - } - $this->isLogging = $isLogging; - $this->start(); - } - - /** - * Class destructor - * - * @return void - * @TODO make sure elements in the destructor match the current class elements - */ - function __destruct() { - unset($this->log); - } - - function start() { - /* Prepare Logging. Just in case it's used. later */ - if ($this->isLogging) { - $this->tStart = gettimeofday(); - $this->tLast = $this->tStart; - $this->log = "

Log: " . $this->name . "

\n
Started: " . gmdate("D, d M Y H:i:s T", $this->tStart['sec']) . "\n Δ Start ;  Δ Last  ;";
-			$this->logLine("Start");
-		}
-    }
-
-    function dumpInstalledModules() {
-        if ($this->isLogging) {
-            $isCurlInstalled = extension_loaded('curl') && function_exists('curl_version');
-            $isGdInstalled = extension_loaded('gd') && function_exists('gd_info');
-            $isExifInstalled = extension_loaded('exif') && function_exists('exif_imagetype');
-            $isFileGetContentsInstalled = function_exists('file_get_contents');
-            $isFileGetContentsExtInstalled = $isFileGetContentsInstalled && ini_get('allow_url_fopen');
-
-            $this->logLine("isCurlInstalled...............: " . ($isCurlInstalled ? "Yes" : "No"));
-            $this->logLine("isGdInstalled.................: " . ($isGdInstalled ? "Yes" : "No"));
-            $this->logLine("isExifInstalled...............: " . ($isExifInstalled ? "Yes" : "No"));
-            $this->logLine("isFileGetContentsInstalled....: " . ($isFileGetContentsInstalled ? "Yes" : "No"));
-            $this->logLine("isFileGetContentsExtInstalled.: " . ($isFileGetContentsExtInstalled ? "Yes" : "No"));
-        }
-    }
-
-    function logLine($line) {
-        if ($this->isLogging) {
-            $tTemp = gettimeofday();
-            $tS = $this->tStart['sec'] + (((int)($this->tStart['usec']/100))/10000);
-            $tL = $this->tLast['sec'] + (((int)($this->tLast['usec']/100))/10000);
-            $tT = $tTemp['sec'] + (((int)($tTemp['usec']/100))/10000);
-
-			$logline = sprintf("\n+%08.04f; +%08.04f; ", ($tT-$tS), ($tT-$tL)) . $this->name . $line;
-            $this->log .= $logline;
-            $this->tLast = $tTemp;
-
-		    if ($this->isDebugging) {
-				echo "
" . $logline . "\n
\n"; - } - } - } - - function getLog() { - return $this->log; - } -} -?> \ No newline at end of file diff --git a/demo/512x700.jpg b/demo/512x700.jpg deleted file mode 100644 index 43586ba..0000000 Binary files a/demo/512x700.jpg and /dev/null differ diff --git a/demo/512x700.xcf b/demo/512x700.xcf deleted file mode 100644 index e31a57d..0000000 Binary files a/demo/512x700.xcf and /dev/null differ diff --git a/demo/512x700_1.jpg b/demo/512x700_1.jpg deleted file mode 100644 index 1bad681..0000000 Binary files a/demo/512x700_1.jpg and /dev/null differ diff --git a/demo/512x700_2.jpg b/demo/512x700_2.jpg deleted file mode 100644 index b6028c6..0000000 Binary files a/demo/512x700_2.jpg and /dev/null differ diff --git a/demo/512x700_3.jpg b/demo/512x700_3.jpg deleted file mode 100644 index da4c2f9..0000000 Binary files a/demo/512x700_3.jpg and /dev/null differ diff --git a/demo/512x700_g1.gif b/demo/512x700_g1.gif deleted file mode 100644 index 89fcc9e..0000000 Binary files a/demo/512x700_g1.gif and /dev/null differ diff --git a/demo/DemoInlineImage.jpg b/demo/DemoInlineImage.jpg deleted file mode 100644 index 277696e..0000000 Binary files a/demo/DemoInlineImage.jpg and /dev/null differ diff --git a/demo/cover-image.jpg b/demo/cover-image.jpg deleted file mode 100644 index 86ad7d6..0000000 Binary files a/demo/cover-image.jpg and /dev/null differ diff --git a/demo/rxhVVUP.gif b/demo/rxhVVUP.gif deleted file mode 100644 index 3ba43be..0000000 Binary files a/demo/rxhVVUP.gif and /dev/null differ