PHP Class PHPePub\Core\EPub

Please note, once finalized a book can no longer have chapters of data added or changed. License: GNU LGPL 2.1. Thanks to: Adam Schmalhofer and Kirstyn Fox for invaluable input and for "nudging" me in the right direction :)
Afficher le fichier Open project: grandt/phpepub Class Usage Examples

Méthodes publiques

Свойство Type Description
$encodeHTML
$isGifImagesEnabled getImage will convert these if it can, unless this is set to TRUE.
$isLogging
$isReferencesAddedToToc
$maxImageHeight
$maxImageWidth
$pluginDir
$referencesOrder If this list is overwritten it MUST contain at least "text" as an element.
$splitDefaultSize
$viewportMap

Méthodes publiques

Méthode Description
DANGER_getNcx ( ) : null | PHPePub\Core\Structure\Ncx The Ncx data isn't generated before the ePub is finalized.
DANGER_getOpf ( ) : null | Opf The Opf data isn't generated before the ePub is finalized.
DANGER_getZip ( ) : null | Zip The Zip file isn't completed before the ePub is finalized, however files added ARE packed and written to it immediately, and their contents can't be altered.
__construct ( string $bookVersion = EPub::BOOK_VERSION_EPUB2, string $languageCode = 'en', string $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT ) Class constructor.
__destruct ( ) : void Class destructor
addCSSFile ( string $fileName, string $fileId, string $fileData, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : boolean Add a CSS file to the book.
addChapter ( string $chapterName, string $fileName, string $chapterData = null, boolean $autoSplit = false, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : mixed Add a chapter to the book, as a chapter should not exceed 250kB, you can parse an array with multiple parts as $chapterData.
addCustomMetaProperty ( string $name, string $content ) Add a Meta property value to the metadata
addCustomMetaValue ( PHPePub\Core\Structure\OPF\MetaValue $value ) Add a custom meta data value to the OPF metadata.
addCustomMetadata ( string $name, string $content ) Add custom metadata to the book.
addCustomNamespace ( string $nsName, string $nsURI )
addCustomPrefix ( string $name, string $URI ) Add a prefix declaration to the OPF file.
addDublinCoreMetadata ( string $dublinCoreConstant, string $value ) Add DublinCore metadata to the book
addEPub3TOC ( string $fileName, string $tocData ) : boolean
addFile ( string $fileName, string $fileId, string $fileData, string $mimetype ) : boolean Add dynamically generated data as a file to the book.
addFileToMETAINF ( string $fileName, string $fileData ) : boolean Add a file to the META-INF directory.
addLargeFile ( string $fileName, string $fileId, string $filePath, string $mimetype ) : boolean Add a large file directly from the filestystem to the book.
addReferencePage ( string $pageName, string $fileName, string $pageData, string $reference, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : boolean Reference pages is usually one or two pages for items such as Table of Contents, reference lists, Author notes or Acknowledgements.
backLevel ( ) Step back one chapter level.
buildEPub3TOC ( string $cssFileName = null, string $title = "Table of Contents" ) : string
buildTOC ( string $cssFileName = null, string $tocCSSClass = "toc", string $title = "Table of Contents", boolean $addReferences = true, boolean $addToIndex = false, string $tocFileName = "TOC.xhtml" ) : boolean Build the Table of Contents. This is not strictly necessary, as most eReaders will build it from the navigation structure in the .ncx file.
extractIdAttributes ( string $partName, string $chapterData )
finalize ( ) : boolean Check for mandatory parameters and finalize the e-book.
findIdAttributes ( string $chapterData ) : array find all id attributes in the html document.
getAuthor ( ) : string Get Book author.
getBook ( ) : string Return the finalized book.
getBookSize ( ) : string Return the finalized book size.
getChapterCount ( ) : number Get Book Chapter count.
getCoverage ( ) : string Get Book coverage.
getCurrentLevel ( ) : integer Get current level count.
getDate ( ) : string Get Book date.
getDescription ( ) : string Get Book description.
getFileList ( ) : array Retrieve an array of file names currently added to the book.
getGenerator ( ) : string Get the book relation.
getIdentifier ( ) : string Get Book identifier.
getIdentifierType ( ) : string Get Book identifierType.
getLanguage ( ) : string Get Book language.
getLog ( ) : string
getPublisherName ( ) : string Get Book publisherName.
getPublisherURL ( ) : string Get Book publisherURL.
getRelation ( ) : string Get the book relation.
getRights ( ) : string Get Book rights.
getSourceURL ( ) : string Get Book sourceURL.
getSplitSize ( ) : integer Get the chapter target size.
getTitle ( ) : string Get Book title.
getViewportMetaLine ( ) : string Generate the viewport meta line if the viewport is set.
isEPubVersion2 ( ) : boolean
isFinalized ( ) : boolean Get Book status.
rootLevel ( ) Step back to the root level.
saveBook ( string $fileName, string $baseDir = '.' ) : string Save the ePub file to local disk.
sendBook ( string $fileName ) : string | boolean Send the book as a zip download
setAuthor ( string $author, string $authorSortKey ) : boolean Book author or creator, optional.
setBookRoot ( string $bookRoot ) The bookRoot is the root directory inside the ePub book, defaults to "OEBPS/"
setCoverImage ( string $fileName, string $imageData = null, string $mimetype = null ) : boolean Add a cover image to the book.
setCoverage ( string $coverage ) : boolean Coverage, optional.
setCurrentLevel ( integer $newLevel ) Step back to the given level.
setDangermode ( boolean $dangermode ) Set or clear "Dangermode"
setDate ( integer $timestamp ) : boolean Release date, optional. If left blank, the time of the finalization will be used.
setDescription ( string $description ) : boolean Book description, optional.
setGenerator ( string $generator ) Set book Generator.
setIdentifier ( string $identifier, string $identifierType ) : boolean Unique book identifier, mandatory.
setLanguage ( string $language ) : boolean Book language, mandatory
setPublisher ( string $publisherName, string $publisherURL ) : boolean Publisher Information, optional.
setReferencesTitle ( string $referencesTitle = "Guide", string $referencesId = "", string $referencesClass = "references" ) : boolean Set the references title for the ePub 3 landmarks section
setRelation ( string $relation ) Set book Relation.
setRights ( string $rightsText ) : boolean Book (copy)rights, optional.
setShortDateFormat ( ) : boolean Set ePub date formate to the short yyyy-mm-dd form, for compliance with a bug in EpubCheck, prior to its version 1.1.
setSourceURL ( string $sourceURL ) : boolean Book source URL, optional.
setSplitSize ( integer $size ) : void Set default chapter target size.
setSubject ( string $subject ) Add book Subject.
setTitle ( string $title ) : boolean Book title, mandatory.
setViewport ( integer | string $width = null, integer $height = null ) Viewport is used for fixed-layout books, specifically ePub 3 books using the Rendition metadata.
setisReferencesAddedToToc ( boolean $isReferencesAddedToToc = true ) : boolean Set the references title for the ePub 3 landmarks section
subLevel ( string $navTitle = null, string $navId = null, string $navClass = null, boolean $isNavHidden = false, string $writingDirection = null ) : boolean | NavPoint Add one chapter level.

Méthodes protégées

Méthode Description
processCSSExternalReferences ( &$cssFile, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $cssDir = "" ) : boolean Process images referenced from an CSS file to the book.
processChapterExternalReferences ( &$doc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "" ) : boolean Process external references from a HTML to the book. The chapter itself is not stored.
processChapterImages ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "", string $backPath = "" ) : boolean Process img tags in a DOMDocument.
processChapterLinks ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "", string $backPath = "" ) : boolean 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.
processChapterSources ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "", string $backPath = "" ) : boolean Process source tags in a DOMDocument.
processChapterStyles ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "" ) : boolean Process style tags in a DOMDocument. Styles will be passed as CSS files and reinserted into the document.
resolveImage ( string $source, &$internalPath, &$internalSrc, &$isSourceExternal, string $baseDir = "", string $htmlDir = "" ) : boolean Resolve an image src and determine it's target location and add it to the book.
resolveMedia ( string $source, string &$internalPath, string &$internalSrc, string &$isSourceExternal, string $baseDir = "", string $htmlDir = "" ) : boolean Resolve a media src and determine it's target location and add it to the book.

Private Methods

Méthode Description
finalizeTOC ( ) : boolean Finalize and build final ePub structures.
initialize ( ) initialize defaults.
setUp ( )
wrapChapter ( $content ) : string Wrap ChapterContent with Head and Footer

Method Details

DANGER_getNcx() public méthode

The Ncx data isn't generated before the ePub is finalized.
public DANGER_getNcx ( ) : null | PHPePub\Core\Structure\Ncx
Résultat null | PHPePub\Core\Structure\Ncx The Ncx Navigation class

DANGER_getOpf() public méthode

The Opf data isn't generated before the ePub is finalized.
public DANGER_getOpf ( ) : null | Opf
Résultat null | PHPePub\Core\Structure\Opf the Opf structure class.

DANGER_getZip() public méthode

See the phpzip/phpzip composer package for usage.
public DANGER_getZip ( ) : null | Zip
Résultat null | PHPZip\Zip\File\Zip The actual zip file.

__construct() public méthode

Class constructor.
public __construct ( string $bookVersion = EPub::BOOK_VERSION_EPUB2, string $languageCode = 'en', string $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT )
$bookVersion string
$languageCode string
$writingDirection string

__destruct() public méthode

Class destructor
public __destruct ( ) : void
Résultat void

addCSSFile() public méthode

Add a CSS file to the book.
public addCSSFile ( string $fileName, string $fileId, string $fileData, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : boolean
$fileName string Filename to use for the CSS file, must be unique for the book.
$fileId string Unique identifier for the file.
$fileData string CSS data
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE.
Résultat boolean $success

addChapter() public méthode

These will still only show up as a single chapter in the book TOC.
public addChapter ( string $chapterName, string $fileName, string $chapterData = null, boolean $autoSplit = false, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : mixed
$chapterName string Name of the chapter, will be use din the TOC
$fileName string Filename to use for the chapter, must be unique for the book.
$chapterData string Chapter text in XHTML or array $chapterData valid XHTML data for the chapter. File should NOT exceed 250kB.
$autoSplit boolean Should the chapter be split if it exceeds the default split size? Default=FALSE, only used if $chapterData is a string.
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE.
Résultat mixed $success FALSE if the addition failed, else the new NavPoint.

addCustomMetaProperty() public méthode

Properties in the metadata looks like: value Remember to add the namespace as well.
public addCustomMetaProperty ( string $name, string $content )
$name string property name, including the namespace declaration, ie. "dcterms:modified"
$content string

addCustomMetaValue() public méthode

Remember to add the namespace as well. Metadata comes in the form: value
public addCustomMetaValue ( PHPePub\Core\Structure\OPF\MetaValue $value )
$value PHPePub\Core\Structure\OPF\MetaValue

addCustomMetadata() public méthode

It is up to the builder to make sure there are no collisions. Metadata are just key value pairs.
public addCustomMetadata ( string $name, string $content )
$name string
$content string

addCustomNamespace() public méthode

public addCustomNamespace ( string $nsName, string $nsURI )
$nsName string
$nsURI string

addCustomPrefix() public méthode

Only supported on EPUB3 books.
public addCustomPrefix ( string $name, string $URI )
$name string
$URI string

addDublinCoreMetadata() public méthode

Use the DublinCore constants included in EPub, ie DublinCore::DATE
public addDublinCoreMetadata ( string $dublinCoreConstant, string $value )
$dublinCoreConstant string name
$value string

addEPub3TOC() public méthode

public addEPub3TOC ( string $fileName, string $tocData ) : boolean
$fileName string
$tocData string
Résultat boolean

addFile() public méthode

Add dynamically generated data as a file to the book.
public addFile ( string $fileName, string $fileId, string $fileData, string $mimetype ) : boolean
$fileName string Filename to use for the file, must be unique for the book.
$fileId string Unique identifier for the file.
$fileData string File data
$mimetype string file mime type
Résultat boolean $success

addFileToMETAINF() public méthode

Bloody Apple and their bloody proprietary ways of doing things.
public addFileToMETAINF ( string $fileName, string $fileData ) : boolean
$fileName string Filename to use for the file, must be unique for the book.
$fileData string File data
Résultat boolean $success

addLargeFile() public méthode

Add a large file directly from the filestystem to the book.
public addLargeFile ( string $fileName, string $fileId, string $filePath, string $mimetype ) : boolean
$fileName string Filename to use for the file, must be unique for the book.
$fileId string Unique identifier for the file.
$filePath string File path
$mimetype string file mime type
Résultat boolean $success

addReferencePage() public méthode

These do not show up in the regular navigation list. As they are supposed to be short.
public addReferencePage ( string $pageName, string $fileName, string $pageData, string $reference, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : boolean
$pageName string Name of the chapter, will be use din the TOC
$fileName string Filename to use for the chapter, must be unique for the book.
$pageData string Page content in XHTML. File should NOT exceed 250kB.
$reference string Reference key
$externalReferences integer How to handle external references. See documentation for processChapterExternalReferences for explanation. Default is EPub::EXTERNAL_REF_IGNORE.
$baseDir string Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE.
Résultat boolean $success

backLevel() public méthode

Subsequent chapters will be added to this chapters parent level.
public backLevel ( )

buildEPub3TOC() public méthode

public buildEPub3TOC ( string $cssFileName = null, string $title = "Table of Contents" ) : string
$cssFileName string
$title string
Résultat string

buildTOC() public méthode

Build the Table of Contents. This is not strictly necessary, as most eReaders will build it from the navigation structure in the .ncx file.
public buildTOC ( string $cssFileName = null, string $tocCSSClass = "toc", string $title = "Table of Contents", boolean $addReferences = true, boolean $addToIndex = false, string $tocFileName = "TOC.xhtml" ) : boolean
$cssFileName string Include a link to this css file in the TOC html.
$tocCSSClass string The TOC is a
, if you need special formatting, you can add a css class for that div. Default is "toc".
$title string Title of the Table of contents. Default is "Table of Contents". Use this for ie. languages other than English.
$addReferences boolean include reference pages in the TOC, using the $referencesOrder array to determine the order of the pages in the TOC. Default is TRUE.
$addToIndex boolean Add the TOC to the NCX index at the current leve/position. Default is FALSE
$tocFileName string Change the default name of the TOC file. The default is "TOC.xhtml"
Résultat boolean

extractIdAttributes() public méthode

public extractIdAttributes ( string $partName, string $chapterData )
$partName string
$chapterData string

finalize() public méthode

Once finalized, the book is locked for further additions.
public finalize ( ) : boolean
Résultat boolean $success

findIdAttributes() public méthode

find all id attributes in the html document.
public findIdAttributes ( string $chapterData ) : array
$chapterData string
Résultat array

getAuthor() public méthode

Get Book author.
public getAuthor ( ) : string
Résultat string $author

getBook() public méthode

Return the finalized book.
public getBook ( ) : string
Résultat string with the book in binary form.

getBookSize() public méthode

Return the finalized book size.
public getBookSize ( ) : string
Résultat string

getChapterCount() public méthode

Get Book Chapter count.
public getChapterCount ( ) : number
Résultat number of chapters

getCoverage() public méthode

Get Book coverage.
public getCoverage ( ) : string
Résultat string $coverage

getCurrentLevel() public méthode

The indentation of the current structure point.
public getCurrentLevel ( ) : integer
Résultat integer current level count;

getDate() public méthode

Get Book date.
public getDate ( ) : string
Résultat string $date

getDescription() public méthode

Get Book description.
public getDescription ( ) : string
Résultat string $description

getFileList() public méthode

$key is the filename used in the book $value is the original filename, will be the same as $key for most entries
public getFileList ( ) : array
Résultat array file list

getGenerator() public méthode

Get the book relation.
public getGenerator ( ) : string
Résultat string The generator identity string.

getIdentifier() public méthode

Get Book identifier.
public getIdentifier ( ) : string
Résultat string $identifier

getIdentifierType() public méthode

Get Book identifierType.
public getIdentifierType ( ) : string
Résultat string $identifierType

getLanguage() public méthode

Get Book language.
public getLanguage ( ) : string
Résultat string $language

getLog() public méthode

public getLog ( ) : string
Résultat string

getPublisherName() public méthode

Get Book publisherName.
public getPublisherName ( ) : string
Résultat string $publisherName

getPublisherURL() public méthode

Get Book publisherURL.
public getPublisherURL ( ) : string
Résultat string $publisherURL

getRelation() public méthode

Get the book relation.
public getRelation ( ) : string
Résultat string The relation.

getRights() public méthode

Get Book rights.
public getRights ( ) : string
Résultat string $rights

getSourceURL() public méthode

Get Book sourceURL.
public getSourceURL ( ) : string
Résultat string $sourceURL

getSplitSize() public méthode

Get the chapter target size.
public getSplitSize ( ) : integer
Résultat integer $size

getTitle() public méthode

Get Book title.
public getTitle ( ) : string
Résultat string $title

getViewportMetaLine() public méthode

Generate the viewport meta line if the viewport is set.
public getViewportMetaLine ( ) : string
Résultat string the meta data line, or an empty string if no viewport is defined.

isEPubVersion2() public méthode

public isEPubVersion2 ( ) : boolean
Résultat boolean

isFinalized() public méthode

Get Book status.
public isFinalized ( ) : boolean
Résultat boolean

processCSSExternalReferences() protected méthode

$externalReferences determins how the function will handle external references.
protected processCSSExternalReferences ( &$cssFile, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $cssDir = "" ) : boolean
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root.
$cssDir string The of the CSS file's directory from the root of the archive.
Résultat boolean FALSE if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterExternalReferences() protected méthode

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.
protected processChapterExternalReferences ( &$doc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "" ) : boolean
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root.
$htmlDir string The path to the parent HTML file's directory from the root of the archive.
Résultat boolean false if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterImages() protected méthode

$externalReferences will determine what will happen to these images, and the img src will be rewritten accordingly.
protected processChapterImages ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "", string $backPath = "" ) : boolean
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root.
$htmlDir string The path to the parent HTML file's directory from the root of the archive.
$backPath string The path to get back to the root of the archive from $htmlDir.
Résultat boolean FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterSources() protected méthode

$externalReferences will determine what will happen to these images, and the img src will be rewritten accordingly.
protected processChapterSources ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "", string $backPath = "" ) : boolean
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root.
$htmlDir string The path to the parent HTML file's directory from the root of the archive.
$backPath string The path to get back to the root of the archive from $htmlDir.
Résultat boolean FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterStyles() protected méthode

Process style tags in a DOMDocument. Styles will be passed as CSS files and reinserted into the document.
protected processChapterStyles ( &$xmlDoc, integer $externalReferences = EPub::EXTERNAL_REF_ADD, string $baseDir = "", string $htmlDir = "" ) : boolean
$externalReferences integer 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.
$baseDir string Default is "", meaning it is pointing to the document root.
$htmlDir string The path to the parent HTML file's directory from the root of the archive.
Résultat boolean FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

resolveImage() protected méthode

Resolve an image src and determine it's target location and add it to the book.
protected resolveImage ( string $source, &$internalPath, &$internalSrc, &$isSourceExternal, string $baseDir = "", string $htmlDir = "" ) : boolean
$source string Image Source link.
$baseDir string Default is "", meaning it is pointing to the document root.
$htmlDir string The path to the parent HTML file's directory from the root of the archive.
Résultat boolean

resolveMedia() protected méthode

Resolve a media src and determine it's target location and add it to the book.
protected resolveMedia ( string $source, string &$internalPath, string &$internalSrc, string &$isSourceExternal, string $baseDir = "", string $htmlDir = "" ) : boolean
$source string Source link.
$internalPath string (referenced) Return value, will be set to the target path and name in the book.
$internalSrc string (referenced) Return value, will be set to the target name in the book.
$isSourceExternal string (referenced) Return value, will be set to TRUE if the image originated from a full URL.
$baseDir string Default is "", meaning it is pointing to the document root.
$htmlDir string The path to the parent HTML file's directory from the root of the archive.
Résultat boolean

rootLevel() public méthode

Subsequent chapters will be added to the rooot NavMap.
public rootLevel ( )

saveBook() public méthode

Save the ePub file to local disk.
public saveBook ( string $fileName, string $baseDir = '.' ) : string
$fileName string
$baseDir string If empty baseDir is absolute to server path, if omitted it's relative to script path
Résultat string The sent file name if successful, FALSE if it failed.

sendBook() public méthode

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.
public sendBook ( string $fileName ) : string | boolean
$fileName string The name of the book without the .epub at the end.
Résultat string | boolean The sent file name if successful, FALSE if it failed.

setAuthor() public méthode

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.
public setAuthor ( string $author, string $authorSortKey ) : boolean
$author string
$authorSortKey string
Résultat boolean $success

setBookRoot() public méthode

The bookRoot is the root directory inside the ePub book, defaults to "OEBPS/"
public setBookRoot ( string $bookRoot )
$bookRoot string

setCoverImage() public méthode

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.
public setCoverImage ( string $fileName, string $imageData = null, string $mimetype = null ) : boolean
$fileName string Filename to use for the image, must be unique for the book.
$imageData string Binary image data
$mimetype string Image mimetype, such as "image/jpeg" or "image/png".
Résultat boolean $success

setCoverage() public méthode

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);
public setCoverage ( string $coverage ) : boolean
$coverage string
Résultat boolean $success

setCurrentLevel() public méthode

Useful for returning to a previous level from deep within the structure. Values below 2 will have the same effect as rootLevel()
public setCurrentLevel ( integer $newLevel )
$newLevel integer

setDangermode() public méthode

Dangermode allows the user to access the structure of the ePub directly, potentially leading to defective files.
public setDangermode ( boolean $dangermode )
$dangermode boolean

setDate() public méthode

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
public setDate ( integer $timestamp ) : boolean
$timestamp integer
Résultat boolean $success

setDescription() public méthode

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
public setDescription ( string $description ) : boolean
$description string
Résultat boolean $success

setGenerator() public méthode

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.
public setGenerator ( string $generator )
$generator string

setIdentifier() public méthode

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
public setIdentifier ( string $identifier, string $identifierType ) : boolean
$identifier string
$identifierType string
Résultat boolean $success

setLanguage() public méthode

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.
public setLanguage ( string $language ) : boolean
$language string
Résultat boolean $success

setPublisher() public méthode

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.
public setPublisher ( string $publisherName, string $publisherURL ) : boolean
$publisherName string
$publisherURL string
Résultat boolean $success

setReferencesTitle() public méthode

Set the references title for the ePub 3 landmarks section
public setReferencesTitle ( string $referencesTitle = "Guide", string $referencesId = "", string $referencesClass = "references" ) : boolean
$referencesTitle string
$referencesId string
$referencesClass string
Résultat boolean

setRelation() public méthode

A related resource. Recommended best practice is to identify the related resource by means of a string conforming to a formal identification system.
public setRelation ( string $relation )
$relation string

setRights() public méthode

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
public setRights ( string $rightsText ) : boolean
$rightsText string
Résultat boolean $success

setShortDateFormat() public méthode

The latest version of ePubCheck can be obtained here: http://code.google.com/p/epubcheck/
public setShortDateFormat ( ) : boolean
Résultat boolean $success

setSourceURL() public méthode

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
public setSourceURL ( string $sourceURL ) : boolean
$sourceURL string
Résultat boolean $success

setSplitSize() public méthode

Default is 250000 bytes, and minimum is 10240 bytes.
public setSplitSize ( integer $size ) : void
$size integer segment size in bytes
Résultat void

setSubject() public méthode

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.
public setSubject ( string $subject )
$subject string

setTitle() public méthode

Used for the dc:title metadata parameter in the OPF file as well as the DocTitle attribute in the NCX file.
public setTitle ( string $title ) : boolean
$title string
Résultat boolean $success

setViewport() public méthode

Calling this function without arguments clears the viewport. The predefined viewports can be accessed with $this->viewportMap
public setViewport ( integer | string $width = null, integer $height = null )
$width integer | string integer for the width, or a string referencing an entry in the $viewportMap.
$height integer

setisReferencesAddedToToc() public méthode

Set the references title for the ePub 3 landmarks section
public setisReferencesAddedToToc ( boolean $isReferencesAddedToToc = true ) : boolean
$isReferencesAddedToToc boolean
Résultat boolean

subLevel() public méthode

Subsequent chapters will be added to this level.
public subLevel ( string $navTitle = null, string $navId = null, string $navClass = null, boolean $isNavHidden = false, string $writingDirection = null ) : boolean | NavPoint
$navTitle string
$navId string
$navClass string
$isNavHidden boolean
$writingDirection string
Résultat boolean | PHPePub\Core\Structure\NCX\NavPoint The new NavPoint for that level.

Property Details

$encodeHTML public_oe property

public $encodeHTML

$isGifImagesEnabled public_oe property

getImage will convert these if it can, unless this is set to TRUE.
public $isGifImagesEnabled

$isLogging public_oe property

public $isLogging

$isReferencesAddedToToc public_oe property

public $isReferencesAddedToToc

$maxImageHeight public_oe property

public $maxImageHeight

$maxImageWidth public_oe property

public $maxImageWidth

$pluginDir public_oe property

public $pluginDir

$referencesOrder public_oe property

If this list is overwritten it MUST contain at least "text" as an element.
public $referencesOrder

$splitDefaultSize public_oe property

public $splitDefaultSize

$viewportMap public_oe property

public $viewportMap