PHP Класс 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 :)
Автор: A. Grandt ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
finalizeTOC ( ) : boolean Finalize and build final ePub structures.
initialize ( ) initialize defaults.
setUp ( )
wrapChapter ( $content ) : string Wrap ChapterContent with Head and Footer

Описание методов

DANGER_getNcx() публичный Метод

The Ncx data isn't generated before the ePub is finalized.
public DANGER_getNcx ( ) : null | PHPePub\Core\Structure\Ncx
Результат null | PHPePub\Core\Structure\Ncx The Ncx Navigation class

DANGER_getOpf() публичный Метод

The Opf data isn't generated before the ePub is finalized.
public DANGER_getOpf ( ) : null | Opf
Результат null | PHPePub\Core\Structure\Opf the Opf structure class.

DANGER_getZip() публичный Метод

See the phpzip/phpzip composer package for usage.
public DANGER_getZip ( ) : null | Zip
Результат null | PHPZip\Zip\File\Zip The actual zip file.

__construct() публичный Метод

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() публичный Метод

Class destructor
public __destruct ( ) : void
Результат void

addCSSFile() публичный Метод

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.
Результат boolean $success

addChapter() публичный Метод

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.
Результат mixed $success FALSE if the addition failed, else the new NavPoint.

addCustomMetaProperty() публичный Метод

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() публичный Метод

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() публичный Метод

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 addCustomNamespace ( string $nsName, string $nsURI )
$nsName string
$nsURI string

addCustomPrefix() публичный Метод

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

addDublinCoreMetadata() публичный Метод

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

addEPub3TOC() публичный Метод

public addEPub3TOC ( string $fileName, string $tocData ) : boolean
$fileName string
$tocData string
Результат boolean

addFile() публичный Метод

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
Результат boolean $success

addFileToMETAINF() публичный Метод

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
Результат boolean $success

addLargeFile() публичный Метод

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
Результат boolean $success

addReferencePage() публичный Метод

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.
Результат boolean $success

backLevel() публичный Метод

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

buildEPub3TOC() публичный Метод

public buildEPub3TOC ( string $cssFileName = null, string $title = "Table of Contents" ) : string
$cssFileName string
$title string
Результат string

buildTOC() публичный Метод

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"
Результат boolean

extractIdAttributes() публичный Метод

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

finalize() публичный Метод

Once finalized, the book is locked for further additions.
public finalize ( ) : boolean
Результат boolean $success

findIdAttributes() публичный Метод

find all id attributes in the html document.
public findIdAttributes ( string $chapterData ) : array
$chapterData string
Результат array

getAuthor() публичный Метод

Get Book author.
public getAuthor ( ) : string
Результат string $author

getBook() публичный Метод

Return the finalized book.
public getBook ( ) : string
Результат string with the book in binary form.

getBookSize() публичный Метод

Return the finalized book size.
public getBookSize ( ) : string
Результат string

getChapterCount() публичный Метод

Get Book Chapter count.
public getChapterCount ( ) : number
Результат number of chapters

getCoverage() публичный Метод

Get Book coverage.
public getCoverage ( ) : string
Результат string $coverage

getCurrentLevel() публичный Метод

The indentation of the current structure point.
public getCurrentLevel ( ) : integer
Результат integer current level count;

getDate() публичный Метод

Get Book date.
public getDate ( ) : string
Результат string $date

getDescription() публичный Метод

Get Book description.
public getDescription ( ) : string
Результат string $description

getFileList() публичный Метод

$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
Результат array file list

getGenerator() публичный Метод

Get the book relation.
public getGenerator ( ) : string
Результат string The generator identity string.

getIdentifier() публичный Метод

Get Book identifier.
public getIdentifier ( ) : string
Результат string $identifier

getIdentifierType() публичный Метод

Get Book identifierType.
public getIdentifierType ( ) : string
Результат string $identifierType

getLanguage() публичный Метод

Get Book language.
public getLanguage ( ) : string
Результат string $language

getLog() публичный Метод

public getLog ( ) : string
Результат string

getPublisherName() публичный Метод

Get Book publisherName.
public getPublisherName ( ) : string
Результат string $publisherName

getPublisherURL() публичный Метод

Get Book publisherURL.
public getPublisherURL ( ) : string
Результат string $publisherURL

getRelation() публичный Метод

Get the book relation.
public getRelation ( ) : string
Результат string The relation.

getRights() публичный Метод

Get Book rights.
public getRights ( ) : string
Результат string $rights

getSourceURL() публичный Метод

Get Book sourceURL.
public getSourceURL ( ) : string
Результат string $sourceURL

getSplitSize() публичный Метод

Get the chapter target size.
public getSplitSize ( ) : integer
Результат integer $size

getTitle() публичный Метод

Get Book title.
public getTitle ( ) : string
Результат string $title

getViewportMetaLine() публичный Метод

Generate the viewport meta line if the viewport is set.
public getViewportMetaLine ( ) : string
Результат string the meta data line, or an empty string if no viewport is defined.

isEPubVersion2() публичный Метод

public isEPubVersion2 ( ) : boolean
Результат boolean

isFinalized() публичный Метод

Get Book status.
public isFinalized ( ) : boolean
Результат boolean

processCSSExternalReferences() защищенный Метод

$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.
Результат boolean FALSE if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterExternalReferences() защищенный Метод

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.
Результат boolean false if unsuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterImages() защищенный Метод

$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.
Результат boolean FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterSources() защищенный Метод

$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.
Результат boolean FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

processChapterStyles() защищенный Метод

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.
Результат boolean FALSE if uncuccessful (book is finalized or $externalReferences == EXTERNAL_REF_IGNORE).

resolveImage() защищенный Метод

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.
Результат boolean

resolveMedia() защищенный Метод

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.
Результат boolean

rootLevel() публичный Метод

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

saveBook() публичный Метод

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
Результат string The sent file name if successful, FALSE if it failed.

sendBook() публичный Метод

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.
Результат string | boolean The sent file name if successful, FALSE if it failed.

setAuthor() публичный Метод

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
Результат boolean $success

setBookRoot() публичный Метод

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

setCoverImage() публичный Метод

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".
Результат boolean $success

setCoverage() публичный Метод

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
Результат boolean $success

setCurrentLevel() публичный Метод

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() публичный Метод

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

setDate() публичный Метод

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
Результат boolean $success

setDescription() публичный Метод

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
Результат boolean $success

setGenerator() публичный Метод

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() публичный Метод

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
Результат boolean $success

setLanguage() публичный Метод

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
Результат boolean $success

setPublisher() публичный Метод

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
Результат boolean $success

setReferencesTitle() публичный Метод

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
Результат boolean

setRelation() публичный Метод

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() публичный Метод

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
Результат boolean $success

setShortDateFormat() публичный Метод

The latest version of ePubCheck can be obtained here: http://code.google.com/p/epubcheck/
public setShortDateFormat ( ) : boolean
Результат boolean $success

setSourceURL() публичный Метод

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
Результат boolean $success

setSplitSize() публичный Метод

Default is 250000 bytes, and minimum is 10240 bytes.
public setSplitSize ( integer $size ) : void
$size integer segment size in bytes
Результат void

setSubject() публичный Метод

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() публичный Метод

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
Результат boolean $success

setViewport() публичный Метод

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() публичный Метод

Set the references title for the ePub 3 landmarks section
public setisReferencesAddedToToc ( boolean $isReferencesAddedToToc = true ) : boolean
$isReferencesAddedToToc boolean
Результат boolean

subLevel() публичный Метод

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
Результат boolean | PHPePub\Core\Structure\NCX\NavPoint The new NavPoint for that level.

Описание свойств

$encodeHTML публичное свойство

public $encodeHTML

$isGifImagesEnabled публичное свойство

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

$isLogging публичное свойство

public $isLogging

$isReferencesAddedToToc публичное свойство

public $isReferencesAddedToToc

$maxImageHeight публичное свойство

public $maxImageHeight

$maxImageWidth публичное свойство

public $maxImageWidth

$pluginDir публичное свойство

public $pluginDir

$referencesOrder публичное свойство

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

$splitDefaultSize публичное свойство

public $splitDefaultSize

$viewportMap публичное свойство

public $viewportMap