PHP 클래스 PressBooks\Modules\Import\Html\Xhtml

상속: extends PressBooks\Modules\Import\Import
파일 보기 프로젝트 열기: pressbooks/pressbooks

공개 메소드들

메소드 설명
import ( array $current_import ) : boolean
kneadHtml ( string $html, string $type, string $domain ) : string Pummel the HTML into WordPress compatible dough.
kneadandInsert ( $html, string $post_type, integer $chapter_parent, string $domain ) Pummel then insert HTML into our database
setCurrentImportOption ( array $upload ) : boolean

보호된 메소드들

메소드 설명
extractCCLicense ( string $url ) : string Expects a URL string with Creative Commons domain similar in form to: http://creativecommons.org/licenses/by-sa/4.0/
fetchAndSaveUniqueImage ( string $url ) : string Extract url and load into WP using media_handle_sideload() Will return an empty string if something went wrong.
getAuthors ( string $html ) : array Looks for meta data in the section of an HTML document.
getLicenseAttribution ( string $html ) : array Looks for div class created by the license module in PB, returns author and license information.
regexSearchReplace ( string $html ) : string Cherry pick likely content areas, then cull known, unwanted content areas
scrapeAndKneadImages ( DOMDocument $doc, string $domain ) : DOMDocument Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
scrapeAndKneadMeta ( DOMDocument $doc ) : array Extracts section/book author and section/book license if they exist.
tidy ( string $html ) : string Compliance with XHTML standards, rid cruft generated by word processors

메소드 상세

extractCCLicense() 보호된 메소드

Expects a URL string with Creative Commons domain similar in form to: http://creativecommons.org/licenses/by-sa/4.0/
protected extractCCLicense ( string $url ) : string
$url string
리턴 string license meta value

fetchAndSaveUniqueImage() 보호된 메소드

Extract url and load into WP using media_handle_sideload() Will return an empty string if something went wrong.
또한 보기: media_handle_sideload
protected fetchAndSaveUniqueImage ( string $url ) : string
$url string
리턴 string $src

getAuthors() 보호된 메소드

Priority is given to PB generated meta data.
protected getAuthors ( string $html ) : array
$html string
리턴 array $authors

getLicenseAttribution() 보호된 메소드

Looks for div class created by the license module in PB, returns author and license information.
protected getLicenseAttribution ( string $html ) : array
$html string
리턴 array $meta

import() 공개 메소드

public import ( array $current_import ) : boolean
$current_import array
리턴 boolean

kneadHtml() 공개 메소드

Pummel the HTML into WordPress compatible dough.
public kneadHtml ( string $html, string $type, string $domain ) : string
$html string
$type string front-matter, part, chapter, back-matter, ...
$domain string domain name of the webpage
리턴 string

kneadandInsert() 공개 메소드

Pummel then insert HTML into our database
public kneadandInsert ( $html, string $post_type, integer $chapter_parent, string $domain )
$post_type string
$chapter_parent integer
$domain string domain name of the webpage

regexSearchReplace() 보호된 메소드

Cherry pick likely content areas, then cull known, unwanted content areas
protected regexSearchReplace ( string $html ) : string
$html string
리턴 string $html

scrapeAndKneadImages() 보호된 메소드

Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
protected scrapeAndKneadImages ( DOMDocument $doc, string $domain ) : DOMDocument
$doc DOMDocument
$domain string domain name of the webpage
리턴 DOMDocument

scrapeAndKneadMeta() 보호된 메소드

Focus is given to CreativeCommons license information genereted by PB
protected scrapeAndKneadMeta ( DOMDocument $doc ) : array
$doc DOMDocument
리턴 array $meta

setCurrentImportOption() 공개 메소드

public setCurrentImportOption ( array $upload ) : boolean
$upload array
리턴 boolean

tidy() 보호된 메소드

Compliance with XHTML standards, rid cruft generated by word processors
protected tidy ( string $html ) : string
$html string
리턴 string $html