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

Показать файл Открыть проект

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

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

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

Метод Описание
createTmpFile ( ) : string Create a temporary file that automatically gets deleted on __sleep()
formSubmit ( ) Catch form submissions
import ( array $current_import ) : boolean
isFormSubmission ( ) : boolean Check if a user submitted something to options-general.php?page=pb_import
log ( string $message, array $more_info = [] ) Log something using wp_mail() and error_log(), include useful WordPress info.
revokeCurrentImport ( ) : boolean Delete 'pressbooks_current_import' option, delete the file too.
setCurrentImportOption ( array $upload ) : boolean Mandatory setCurrentImportOption() method, creates WP option 'pressbooks_current_import'

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

Метод Описание
determinePostType ( string $id ) : string Check against what the user selected for post_type in our form
flaggedForImport ( $id ) : boolean Check against what the user selected for import in our form
getChapterParent ( ) : integer Get a valid Part id to act as post_parent to a Chapter
properImageExtension ( string $path_to_file, string $filename ) : string Checks if the file extension matches its mimetype, returns a modified filename if they don't match.
tidy ( string $html ) : string Tidy HTML

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

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

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

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

Check against what the user selected for post_type in our form
protected determinePostType ( string $id ) : string
$id string
Результат string

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

Check against what the user selected for import in our form
protected flaggedForImport ( $id ) : boolean
$id
Результат boolean

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

Catch form submissions
public static formSubmit ( )

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

Get a valid Part id to act as post_parent to a Chapter
protected getChapterParent ( ) : integer
Результат integer

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

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

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

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

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

Note: This method is here temporarily. We are using it to find & fix bugs for the first iterations of import. Do not count on this method being here in the future.
Устаревший:
static public log ( string $message, array $more_info = [] )
$message string
$more_info array

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

Checks if the file extension matches its mimetype, returns a modified filename if they don't match.
protected properImageExtension ( string $path_to_file, string $filename ) : string
$path_to_file string
$filename string
Результат string - modified filename if the extension did not match the mimetype, otherwise returns the filename that was passed to it

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

Delete 'pressbooks_current_import' option, delete the file too.
public revokeCurrentImport ( ) : boolean
Результат boolean

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

$upload should look something like: Array ( [file] => /home/dac514/public_html/bdolor/wp-content/uploads/sites/2/2013/04/Hello-World-13662149822.epub [url] => http://localhost/~dac514/bdolor/helloworld/wp-content/uploads/sites/2/2013/04/Hello-World-13662149822.epub [type] => application/epub+zip ) 'pressbooks_current_import' should look something like: Array ( [file] => '/home/dac514/public_html/bdolor/wp-content/uploads/sites/2/imports/Hello-World-1366214982.epub' [file_type] => 'application/epub+zip' [type_of] => 'epub' [chapters] => Array ( [some-id] => 'Some title' [front-cover] => 'Front Cover' [chapter-001] => 'Some other title' ) )
См. также: wp_handle_upload
abstract public setCurrentImportOption ( array $upload ) : boolean
$upload array An associative array of file attributes
Результат boolean

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

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

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

$logsEmail статическое публичное свойство

Email addresses to send logs.
Устаревший:
static public array $logsEmail
Результат array