PHP Класс PressBooks\Modules\Import\Odf\Odt

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

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

Свойство Тип Описание
$authors string
$tag string
$zip ZipArchive

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

Метод Описание
__construct ( )
import ( array $current_import ) : boolean Imports content, only after options (chapters, parts) have been selected
setCurrentImportOption ( array $upload ) : boolean Chapter detection

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

Метод Описание
fetchAndSaveUniqueImage ( string $href ) : string Extract url from zip and load into WP using media_handle_sideload() Will return an empty string if something went wrong.
findTheNode ( DOMNode $node, string $chapter_name ) : DOMNode Recursive iterator to locate and return a specific node, targeting child nodes
getChapter ( DOMNodeList $dom_list, integer $index, string $chapter_title ) : string Find where to start, iterate through a list, add elements to a new DomDocument, return resulting xhtml
getFuzzyChapterTitles ( ) : array Returns an array of available chapters, or 'unknown' if none
getZipContent ( string $file, boolean $as_xml = true ) : boolean | DOMDocument Locates an entry using its name, returns the entry contents
isValidZip ( string $fullpath ) Checks for standard ODT file structure
kneadAndInsert ( string $html, string $title, string $post_type, integer $chapter_parent ) Pummel then insert HTML into our database
kneadHTML ( string $body ) : string Pummel the HTML into WordPress compatible dough.
parseContent ( DomDocument $xml, string $chapter_title ) : string Find and return the identified chapter
parseMetaData ( DOMDocument $meta ) Sets an instance variable with value(s) from metadata
scrapeAndKneadImages ( DOMDocument $doc ) : DOMDocument Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
tidy ( string $html ) : string Compliance with XTHML standards, rid cruft generated by word processors

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

__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 ( string $href ) : string
$href string original filename, with (relative) path
Результат string filename

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

Recursive iterator to locate and return a specific node, targeting child nodes
protected findTheNode ( DOMNode $node, string $chapter_name ) : DOMNode
$node DOMNode
$chapter_name string
Результат DOMNode

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

Find where to start, iterate through a list, add elements to a new DomDocument, return resulting xhtml
protected getChapter ( DOMNodeList $dom_list, integer $index, string $chapter_title ) : string
$dom_list DOMNodeList
$index integer
$chapter_title string
Результат string XHTML

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

Returns an array of available chapters, or 'unknown' if none
protected getFuzzyChapterTitles ( ) : array
Результат array Chapter titles

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

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

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

Imports content, only after options (chapters, parts) have been selected
public import ( array $current_import ) : boolean
$current_import array
Результат boolean - returns false if import fails

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

Checks for standard ODT file structure
protected isValidZip ( string $fullpath )
$fullpath string

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

Pummel then insert HTML into our database
protected kneadAndInsert ( string $html, string $title, string $post_type, integer $chapter_parent )
$html string
$title string
$post_type string (front-matter', 'chapter', 'back-matter')
$chapter_parent integer

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

Pummel the HTML into WordPress compatible dough.
protected kneadHTML ( string $body ) : string
$body string
Результат string - modified with correct image paths

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

Find and return the identified chapter
protected parseContent ( DomDocument $xml, string $chapter_title ) : string
$xml DomDocument
$chapter_title string
Результат string XML

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

Sets an instance variable with value(s) from metadata
protected parseMetaData ( DOMDocument $meta )
$meta DOMDocument

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

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

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

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

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

Compliance with XTHML standards, rid cruft generated by word processors
protected tidy ( string $html ) : string
$html string
Результат string

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

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

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

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

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

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

protected ZipArchive $zip
Результат ZipArchive