PHP Класс Pressbooks\Modules\Export\Epub\Epub201

Наследование: extends Pressbooks\Modules\Export\Export
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$timeout integer Used with wp_remote_get()

Защищенные свойства (Protected)

Свойство Тип Описание
$compressImages boolean
$coverImage string Used to set cover-image in OPF for kindlegen compatibility.
$cssOverrides string CSS overrides
$dir $var string
$exportStylePath string Fullpath to book CSS file.
$extraCss string Extra CSS (to be used by child classes if necessary)
$fetchedFontCache array
$fetchedImageCache array
$filext string
$fixme array Used by HtmLawed with $GLOBALS['hl_Ids']
$frontMatterLastPos integer | boolean Last known front matter position. Used to insert the TOC in the correct place.
$frontMatterPos integer Keep track of where we are using this variable.
$hasIntroduction boolean Sometimes the user will omit an introduction so we must inject the style in either the first part or the first chapter ourselves.
$lang string Main language of document, two letter code
$manifest array Generated by createOEPBS(), used by createToc(), createOPF(), and creatdNCX() Note: Only XHTML files go in the manifest array (images are done automatically)
$numbered boolean
$romanizePartNumbers boolean Hack to romanize part numbers
$stylesheet string
$suffix $var string
$supportedFontExtensions string Regular expression for supported fonts (used in #($supportedFontExtensions)#i')
$supportedImageExtensions string Regular expression for supported images (used in #($supportedImageExtensions)#i')
$tmpDir string Temporary directory used to build EPUB, no trailing slash!

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

Метод Описание
__construct ( array $args )
__destruct ( ) Delete temporary directory when done.
convert ( ) : boolean Create $this->outputPath
fixAnnoyingCharacters ( string $html ) : string | void Fix annoying characters that the user probably didn't do on purpose
hasDependencies ( ) : boolean Dependency check.
mediaType ( string $file ) : mixed | string Override mimeType, get rid of '; charset=binary'
validate ( ) : boolean Check the sanity of $this->outputPath

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

Метод Описание
buildManifestAssetsHtml ( ) : string Find all the image files, insert them into the OPF file
createBackMatter ( array $book_contents, array $metadata )
createBeforeTitle ( array $book_contents, array $metadata )
createContainer ( ) Create Open Publication Structure 2.0.1 container.
createCopyright ( array $book_contents, array $metadata )
createCover ( array $book_contents, array $metadata )
createDedicationAndEpigraph ( array $book_contents, array $metadata )
createFrontMatter ( array $book_contents, array $metadata )
createNCX ( array $book_contents, array $metadata ) Create NCX file.
createOEPBS ( array $book_contents, array $metadata ) Create OEBPS/* files.
createOPF ( array $book_contents, array $metadata ) Create OPF File.
createPartsAndChapters ( array $book_contents, array $metadata )
createPromo ( array $book_contents, array $metadata )
createStylesheet ( ) Create stylesheet. Change $this->stylesheet to a filename used by subsequent methods.
createTitle ( array $book_contents, array $metadata )
createToc ( array $book_contents, array $metadata ) Uses $this->manifest to generate itself.
deleteTmpDir ( ) Create a temporary directory
fetchAndSaveUniqueFont ( $url, $fullpath ) : string Fetch a font with wp_remote_get(), save it to $fullpath with a unique name.
fetchAndSaveUniqueImage ( $url, $fullpath ) : string Fetch an image with wp_remote_get(), save it to $fullpath with a unique name.
fuzzyHrefMatch ( $url, string $type, integer $pos ) : boolean | string Try to determine if a URL is pointing to internal content. TODO: Refactor, for the love of all that is holy.
fuzzyImageNameMatch ( string $file1, string $file2 ) : boolean Fuzzy image name match.
kneadHref ( DOMDocument $doc, string $type, integer $pos ) : DOMDocument Change hrefs
kneadHtml ( string $html, string $type, integer $pos ) : string Pummel the HTML into EPUB compatible dough.
positionOfToc ( ) : integer Determine position of TOC based on Chicago Manual Of Style.
preProcessBookContents ( $book_contents ) : mixed
preProcessPostContent ( string $content ) : string
scrapeAndKneadImages ( DOMDocument $doc ) : DOMDocument Parse HTML snippet, download all found tags into /OEBPS/assets/, return the HTML with changed paths.
scrapeAndKneadMedia ( DOMDocument $doc ) : DOMDocument This is a stub for an Epub3 feature Do nothing
scrapeKneadAndSaveCss ( string $path_to_original_stylesheet, string $path_to_copy_of_stylesheet ) Parse CSS, copy assets, rewrite copy.
themeOptionsOverrides ( ) Override based on Theme Options
tidy ( string $html ) : string Tidy HTML
zipEpub ( $filename ) : boolean Zip the contents of an EPUB following the conventions outlined in Open Publication Structure 2.0.1

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

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

public __construct ( array $args )
$args array

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

Delete temporary directory when done.
public __destruct ( )

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

Find all the image files, insert them into the OPF file
protected buildManifestAssetsHtml ( ) : string
Результат string

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

Create $this->outputPath
public convert ( ) : boolean
Результат boolean

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

protected createBackMatter ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

protected createBeforeTitle ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Create Open Publication Structure 2.0.1 container.
protected createContainer ( )

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

protected createCopyright ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

protected createCover ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

protected createDedicationAndEpigraph ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

protected createFrontMatter ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Create NCX file.
protected createNCX ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Create OEBPS/* files.
protected createOEPBS ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Create OPF File.
protected createOPF ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

protected createPartsAndChapters ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

protected createPromo ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Create stylesheet. Change $this->stylesheet to a filename used by subsequent methods.
protected createStylesheet ( )

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

protected createTitle ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Uses $this->manifest to generate itself.
protected createToc ( array $book_contents, array $metadata )
$book_contents array
$metadata array

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

Create a temporary directory
protected deleteTmpDir ( )

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

Will return an empty string if something went wrong.
protected fetchAndSaveUniqueFont ( $url, $fullpath ) : string
$url string
$fullpath string
Результат string filename

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

Will return an empty string if something went wrong.
protected fetchAndSaveUniqueImage ( $url, $fullpath ) : string
$url string
$fullpath string
Результат string filename

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

Fix annoying characters that the user probably didn't do on purpose
public fixAnnoyingCharacters ( string $html ) : string | void
$html string
Результат string | void

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

Try to determine if a URL is pointing to internal content. TODO: Refactor, for the love of all that is holy.
protected fuzzyHrefMatch ( $url, string $type, integer $pos ) : boolean | string
$url
$type string front-matter, part, chapter, back-matter, ...
$pos integer (optional) position of content, used when creating filenames like: chapter-001, chapter-002, ...
Результат boolean | string

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

For example: We consider both 'href' and 'src' above 'the same'
protected fuzzyImageNameMatch ( string $file1, string $file2 ) : boolean
$file1 string
$file2 string
Результат boolean

hasDependencies() статический публичный Метод

Dependency check.
static public hasDependencies ( ) : boolean
Результат boolean

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

Change hrefs
protected kneadHref ( DOMDocument $doc, string $type, integer $pos ) : DOMDocument
$doc DOMDocument
$type string front-matter, part, chapter, back-matter, ...
$pos integer (optional) position of content, used when creating filenames like: chapter-001, chapter-002, ...
Результат DOMDocument

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

Pummel the HTML into EPUB compatible dough.
protected kneadHtml ( string $html, string $type, integer $pos ) : string
$html string
$type string front-matter, part, chapter, back-matter, ...
$pos integer (optional) position of content, used when creating filenames like: chapter-001, chapter-002, ...
Результат string

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

Override mimeType, get rid of '; charset=binary'
public mediaType ( string $file ) : mixed | string
$file string
Результат mixed | string

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

Determine position of TOC based on Chicago Manual Of Style.
protected positionOfToc ( ) : integer
Результат integer

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

protected preProcessBookContents ( $book_contents ) : mixed
$book_contents
Результат mixed

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

protected preProcessPostContent ( string $content ) : string
$content string
Результат string

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

Parse HTML snippet, download all found tags into /OEBPS/assets/, return the HTML with changed paths.
protected scrapeAndKneadImages ( DOMDocument $doc ) : DOMDocument
$doc DOMDocument
Результат DOMDocument

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

This is a stub for an Epub3 feature Do nothing
protected scrapeAndKneadMedia ( DOMDocument $doc ) : DOMDocument
$doc DOMDocument
Результат DOMDocument

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

Parse CSS, copy assets, rewrite copy.
protected scrapeKneadAndSaveCss ( string $path_to_original_stylesheet, string $path_to_copy_of_stylesheet )
$path_to_original_stylesheet string *
$path_to_copy_of_stylesheet string

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

Override based on Theme Options
protected themeOptionsOverrides ( )

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

Tidy HTML
protected tidy ( string $html ) : string
$html string
Результат string

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

Check the sanity of $this->outputPath
public validate ( ) : boolean
Результат boolean

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

Zip the contents of an EPUB following the conventions outlined in Open Publication Structure 2.0.1
protected zipEpub ( $filename ) : boolean
$filename
Результат boolean

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

$compressImages защищенное свойство

protected bool $compressImages
Результат boolean

$coverImage защищенное свойство

Used to set cover-image in OPF for kindlegen compatibility.
protected string $coverImage
Результат string

$cssOverrides защищенное свойство

CSS overrides
protected string $cssOverrides
Результат string

$dir защищенное свойство

$var string
protected $dir

$exportStylePath защищенное свойство

Fullpath to book CSS file.
protected string $exportStylePath
Результат string

$extraCss защищенное свойство

Extra CSS (to be used by child classes if necessary)
protected string $extraCss
Результат string

$fetchedFontCache защищенное свойство

protected array $fetchedFontCache
Результат array

$fetchedImageCache защищенное свойство

protected array $fetchedImageCache
Результат array

$filext защищенное свойство

protected string $filext
Результат string

$fixme защищенное свойство

Used by HtmLawed with $GLOBALS['hl_Ids']
protected array $fixme
Результат array

$frontMatterLastPos защищенное свойство

Last known front matter position. Used to insert the TOC in the correct place.
protected int|bool $frontMatterLastPos
Результат integer | boolean

$frontMatterPos защищенное свойство

Keep track of where we are using this variable.
protected int $frontMatterPos
Результат integer

$hasIntroduction защищенное свойство

Sometimes the user will omit an introduction so we must inject the style in either the first part or the first chapter ourselves.
protected bool $hasIntroduction
Результат boolean

$lang защищенное свойство

Main language of document, two letter code
protected string $lang
Результат string

$manifest защищенное свойство

Generated by createOEPBS(), used by createToc(), createOPF(), and creatdNCX() Note: Only XHTML files go in the manifest array (images are done automatically)
protected array $manifest
Результат array

$numbered защищенное свойство

protected bool $numbered
Результат boolean

$romanizePartNumbers защищенное свойство

Hack to romanize part numbers
protected bool $romanizePartNumbers
Результат boolean

$stylesheet защищенное свойство

protected string $stylesheet
Результат string

$suffix защищенное свойство

$var string
protected $suffix

$supportedFontExtensions защищенное свойство

Regular expression for supported fonts (used in #($supportedFontExtensions)#i')
protected string $supportedFontExtensions
Результат string

$supportedImageExtensions защищенное свойство

Regular expression for supported images (used in #($supportedImageExtensions)#i')
protected string $supportedImageExtensions
Результат string

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

Used with wp_remote_get()
public int $timeout
Результат integer

$tmpDir защищенное свойство

Temporary directory used to build EPUB, no trailing slash!
protected string $tmpDir
Результат string