-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathReadme.txt
105 lines (47 loc) · 2.38 KB
/
Readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
BookGluttonEpub
Copyright (c) 2011, Aaron Miller
Licensed under the MIT license.
Core class for the BookGlutton publishing and social reading platform. Includes OPS virtualization, zip container manipulation, and more, in a single convenient class library. Zip container and file finder helper classes included.
DEPS
Requires epubcheck, zip, tidy, java, PHP mods for zip, dom_document, simple_xml, xpath, possibly others...
API documentation
Coming soon - There are many helpful convenience methods, and helpful comments, in the code. Please browse the main class file for more info on how to use this library.
TODO
1.Clean up the code! Production-tested but messy.
2.Add some test scripts and test epub/OPS content
Usage Examples:
Please see the test.php script for the simplest possible example of usage. More involved test scripts will be added when I get time. Do look through the main class file at some of the methods available. There is much useful there.
1. Open an epub from a file:
$epub = new BookGluttonEpub();
$epub->open($epub_filename);
2. Load an OPS structure into a virtualized Epub:
$epub = new BookGluttonEpub();
$epub->loadOPS($path_to_ops);
3. Open a remote epub by URL and echo its ISBN:
$epub = new BookGluttonEpub();
$epub->openRemote($href);
$epub->setPretty(true);
echo $epub->getIsbn();
4. Open an epub as a virtual zip epub and unzip its contents into an OPS structure:
$epub = new BookGluttonZipEpub();
$epub->ingestZipData($zipdata, $book->getPackagePath());
print_r($epub->getMetaPairs());
5. Load remote, modify and save local to OPS:
$epub = new BookGluttonEpub();
$epub->openRemote($href);
$epub->setTitle($book->getTitle());
$epub->setAuthor($book->getAuthor());
$epub->setDescription($book->getDescription());
$epub->setRights($book->getRights());
$epub->writeOPS();
6. Create a new virtual OPS, then load an HTML conversion source, then save locally as OPS:
$epub = new BookGluttonEpub();
$epub->create(array(
'title'=>$book->getTitle(),
'author'=>$book->getAuthor(),
'language'=>$book->getLanguage(),
'desc'=>$book->getDescription(),
'rights'=>$book->getRights()
));
$epub->loadSource($zipped_html_or_html);
$epub->moveOps($ops_repo_root, $unique_package_directory_id);