PHP 클래스 Pressbooks\Modules\Export\Epub\Epub201

상속: extends Pressbooks\Modules\Export\Export
파일 보기 프로젝트 열기: pressbooks/pressbooks 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$timeout integer Used with wp_remote_get()

보호된 프로퍼티들

프로퍼티 타입 설명
$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