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

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$errorsEmail array Email addresses to send log errors.

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

Свойство Тип Описание
$outputPath Location where data is held until ready to be displayed.
$reservedIds array Reserved html IDs.

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

Метод Описание
convert ( ) : boolean Mandatory convert method, create $this->outputPath
createTmpFile ( ) : string Create a temporary file that automatically gets deleted on __sleep()
fixAnnoyingCharacters ( string $html ) : string Fix annoying characters that the user probably didn't do on purpose
formSubmit ( ) Catch form submissions
getExportFolder ( ) : string Get the fullpath to the Exports folder.
getExportScriptPath ( string $type ) : string Return the fullpath to an export module's Javascript file.
getExportStylePath ( string $type ) : string Return the fullpath to an export module's style file.
getOutputPath ( ) : string Return $this->outputPath
injectHouseStyles ( string $css ) : string Inject house styles into CSS
isFormSubmission ( ) : boolean Check if a user submitted something to admin.php?page=pb_export
isParsingSubsections ( ) : boolean Is section parsing enabled?
logError ( string $message, array $more_info = [] ) Log errors using wp_mail() and error_log(), include useful WordPress info.
mimeType ( string $file ) : string Detect MIME Content-type for a file.
nonce ( string $timestamp ) : string Create a NONCE using WordPress' NONCE_KEY and a Unix timestamp.
setLocale ( string $lang ) : string Hook for add_filter('locale ', .
timestampedFileName ( string $extension, boolean $fullpath = true ) : string Create a timestamped filename.
validate ( ) : boolean Mandatory validate method, check the sanity of $this->outputPath
verifyNonce ( string $timestamp, string $md5 ) : boolean Verify that a NONCE was created within a range of 5 minutes and is valid.

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

Метод Описание
createTmpDir ( ) : string Create a temporary directory, no trailing slash!
doCopyrightLicense ( array $metadata, string $title = '', integer $id = null, string $section_author = '' ) : string Will create an html blob of copyright information, returns empty string if user doesn't want it displayed
downloadExportFile ( string $filename ) Download an .htaccess protected file from the exports directory.
loadTemplate ( string $path, array $vars = [] ) : string Simple template system.
obliterateDir ( string $dirname, boolean $only_empty = false ) : boolean Recursively delete all contents of a directory.
preProcessPostName ( string $id ) : string Check a post_name against a list of reserved IDs, sanitize for use as an XML ID.
transformXML ( string $content, string $path_to_xsl ) : string Convert an XML string via XSLT file.

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

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

Mandatory convert method, create $this->outputPath
abstract public convert ( ) : boolean
Результат boolean

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

Create a temporary directory, no trailing slash!
protected createTmpDir ( ) : string
Результат string

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

Create a temporary file that automatically gets deleted on __sleep()
public createTmpFile ( ) : string
Результат string fullpath

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

Will create an html blob of copyright information, returns empty string if user doesn't want it displayed
protected doCopyrightLicense ( array $metadata, string $title = '', integer $id = null, string $section_author = '' ) : string
$metadata array
$title string
$id integer
$section_author string
Результат string $html blob

downloadExportFile() защищенный статический Метод

Download an .htaccess protected file from the exports directory.
protected static downloadExportFile ( string $filename )
$filename string sanitized $_GET['download_export_file']

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

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

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

Catch form submissions
static public formSubmit ( )

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

Create if not there. Create .htaccess protection if missing.
static public getExportFolder ( ) : string
Результат string fullpath

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

Return the fullpath to an export module's Javascript file.
public getExportScriptPath ( string $type ) : string
$type string
Результат string

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

Return the fullpath to an export module's style file.
public getExportStylePath ( string $type ) : string
$type string
Результат string

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

Return $this->outputPath
public getOutputPath ( ) : string
Результат string

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

Inject house styles into CSS
static public injectHouseStyles ( string $css ) : string
$css string
Результат string

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

Check if a user submitted something to admin.php?page=pb_export
static public isFormSubmission ( ) : boolean
Результат boolean

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

Is section parsing enabled?
static public isParsingSubsections ( ) : boolean
Результат boolean

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

Simple template system.
protected loadTemplate ( string $path, array $vars = [] ) : string
$path string
$vars array (optional)
Результат string

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

Log errors using wp_mail() and error_log(), include useful WordPress info.
public logError ( string $message, array $more_info = [] )
$message string
$more_info array

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

Detect MIME Content-type for a file.
static public mimeType ( string $file ) : string
$file string fullpath
Результат string

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

Create a NONCE using WordPress' NONCE_KEY and a Unix timestamp.
См. также: verifyNonce
public nonce ( string $timestamp ) : string
$timestamp string unix timestamp
Результат string

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

Recursively delete all contents of a directory.
protected obliterateDir ( string $dirname, boolean $only_empty = false ) : boolean
$dirname string
$only_empty boolean
Результат boolean

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

Check a post_name against a list of reserved IDs, sanitize for use as an XML ID.
protected preProcessPostName ( string $id ) : string
$id string
Результат string

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

..), change the book language
static public setLocale ( string $lang ) : string
$lang string
Результат string

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

Create a timestamped filename.
public timestampedFileName ( string $extension, boolean $fullpath = true ) : string
$extension string
$fullpath boolean
Результат string

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

Convert an XML string via XSLT file.
protected transformXML ( string $content, string $path_to_xsl ) : string
$content string
$path_to_xsl string
Результат string

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

Mandatory validate method, check the sanity of $this->outputPath
abstract public validate ( ) : boolean
Результат boolean

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

Verify that a NONCE was created within a range of 5 minutes and is valid.
См. также: nonce
public verifyNonce ( string $timestamp, string $md5 ) : boolean
$timestamp string unix timestamp
$md5 string
Результат boolean

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

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

Email addresses to send log errors.
public array $errorsEmail
Результат array

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

Location where data is held until ready to be displayed.
protected $outputPath

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

Reserved html IDs.
protected array $reservedIds
Результат array