PHP Класс PressBooks\Modules\Import\Epub\Epub201

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

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

Свойство Тип Описание
$authors string String for authors, contributors
$basedir string OPF Basedir
$isPbEpub boolean If Pressbooks generated the epub file
$zip ZipArchive Reference to the object that represents the Epub zip folder

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

Метод Описание
__construct ( )
import ( array $current_import ) : boolean
setCurrentImportOption ( array $upload ) : boolean

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

Метод Описание
fetchAndSaveUniqueImage ( $url, string $href ) : string Extract url from zip and load into WP using media_handle_sideload() Will return an empty string if something went wrong.
getOpf ( ) : SimpleXMLElement Return book.opf as a SimpleXML object
getZipContent ( $file, boolean $as_xml = true ) : string | SimpleXMLElement Locates an entry using its name, returns the entry contents
kneadAndInsert ( string $href, string $post_type, integer $chapter_parent ) Pummel then insert HTML into our database
kneadHref ( DOMDocument $doc, string $type, string $href ) : DOMDocument Change hrefs
kneadHtml ( string $html, string $type, string $href ) : string Pummel the HTML into WordPress compatible dough.
parseManifest ( SimpleXMLElement $xml, array $match_ids, $chapter_parent ) Parse OPF manifest nodes
parseMetadata ( SimpleXMLElement $xml ) Parse OPF metadata nodes
pbCheck ( string $copyrightFile ) : boolean Is it an EPUB generated by PB?
regexSearchReplace ( string $html ) : string Cleans imported html of unwanted tags
scrapeAndKneadImages ( DOMDocument $doc, string $href ) : DOMDocument Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
setCurrentZip ( string $fullpath ) Opens a new Epub for reading, writing or modifying
tidy ( string $html ) : string

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

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

public __construct ( )

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

Extract url from zip and load into WP using media_handle_sideload() Will return an empty string if something went wrong.
См. также: media_handle_sideload
protected fetchAndSaveUniqueImage ( $url, string $href ) : string
$url string
$href string original filename, with (relative) path
Результат string filename

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

Return book.opf as a SimpleXML object
protected getOpf ( ) : SimpleXMLElement
Результат SimpleXMLElement

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

Locates an entry using its name, returns the entry contents
protected getZipContent ( $file, boolean $as_xml = true ) : string | SimpleXMLElement
$file
$as_xml boolean
Результат string | SimpleXMLElement

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

public import ( array $current_import ) : boolean
$current_import array
Результат boolean

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

Pummel then insert HTML into our database
protected kneadAndInsert ( string $href, string $post_type, integer $chapter_parent )
$href string
$post_type string
$chapter_parent integer

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

Change hrefs
protected kneadHref ( DOMDocument $doc, string $type, string $href ) : DOMDocument
$doc DOMDocument
$type string front-matter, part, chapter, back-matter, ...
$href string original filename, with (relative) path
Результат DOMDocument

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

Pummel the HTML into WordPress compatible dough.
protected kneadHtml ( string $html, string $type, string $href ) : string
$html string
$type string front-matter, part, chapter, back-matter, ...
$href string original filename, with (relative) path
Результат string

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

Parse OPF manifest nodes
protected parseManifest ( SimpleXMLElement $xml, array $match_ids, $chapter_parent )
$xml SimpleXMLElement
$match_ids array
$chapter_parent

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

Parse OPF metadata nodes
protected parseMetadata ( SimpleXMLElement $xml )
$xml SimpleXMLElement

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

Is it an EPUB generated by PB?
См. также: createCopyright() in /export/epub/class-pb-epub201.php
protected pbCheck ( string $copyrightFile ) : boolean
$copyrightFile string
Результат boolean

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

Cleans imported html of unwanted tags
protected regexSearchReplace ( string $html ) : string
$html string
Результат string

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

Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
protected scrapeAndKneadImages ( DOMDocument $doc, string $href ) : DOMDocument
$doc DOMDocument
$href string original filename, with (relative) path
Результат DOMDocument

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

public setCurrentImportOption ( array $upload ) : boolean
$upload array
Результат boolean

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

Opens a new Epub for reading, writing or modifying
protected setCurrentZip ( string $fullpath )
$fullpath string

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

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

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

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

String for authors, contributors
protected string $authors
Результат string

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

OPF Basedir
protected string $basedir
Результат string

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

If Pressbooks generated the epub file
protected bool $isPbEpub
Результат boolean

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

Reference to the object that represents the Epub zip folder
protected ZipArchive $zip
Результат ZipArchive