PHP Class Pressbooks\Modules\Import\WordPress\Wxr

Inheritance: extends PressBooks\Modules\Import\Import
Afficher le fichier Open project: pressbooks/pressbooks

Protected Properties

Свойство Type Description
$isPbWxr boolean If Pressbooks generated the WXR file

Méthodes publiques

Méthode Description
import ( array $current_import ) : boolean
setCurrentImportOption ( array $upload ) : boolean

Méthodes protégées

Méthode Description
bookInfoPid ( ) : integer Get existing Meta Post, if none exists create one
customNestedSort ( array $xml ) : array Custom sort for the xml posts to put them in correct nested order
fetchAndSaveUniqueImage ( string $url ) : string Load remote url of image into WP using media_handle_sideload() Will return an empty string if something went wrong.
importMetaBoxes ( integer $pid, array $p )
importPbPostMeta ( integer $pid, string $post_type, array $p ) Import Pressbooks specific post meta
insertNewPost ( string $post_type, array $p, string $html, integer $chapter_parent ) : integer Insert a new post
pbCheck ( array $xml ) Is it a WXR generated by PB?
scrapeAndKneadImages ( DOMDocument $doc ) : DOMDocument Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
searchForMetaValue ( $meta_key, array $postmeta ) : string Check for PB specific metadata, returns empty string if not found.

Method Details

bookInfoPid() protected méthode

Get existing Meta Post, if none exists create one
protected bookInfoPid ( ) : integer
Résultat integer Post ID

customNestedSort() protected méthode

Custom sort for the xml posts to put them in correct nested order
protected customNestedSort ( array $xml ) : array
$xml array
Résultat array sorted $xml

fetchAndSaveUniqueImage() protected méthode

Load remote url of image into WP using media_handle_sideload() Will return an empty string if something went wrong.
See also: media_handle_sideload
protected fetchAndSaveUniqueImage ( string $url ) : string
$url string
Résultat string filename

import() public méthode

public import ( array $current_import ) : boolean
$current_import array
Résultat boolean

importMetaBoxes() protected méthode

See also: Pressbooks\Admin\Metaboxes\add_meta_boxes
protected importMetaBoxes ( integer $pid, array $p )
$pid integer Post ID
$p array Single Item Returned From \Pressbooks\Modules\Import\WordPress\Parser::parse

importPbPostMeta() protected méthode

Import Pressbooks specific post meta
protected importPbPostMeta ( integer $pid, string $post_type, array $p )
$pid integer Post ID
$post_type string Post Type
$p array Single Item Returned From \Pressbooks\Modules\Import\WordPress\Parser::parse

insertNewPost() protected méthode

Insert a new post
protected insertNewPost ( string $post_type, array $p, string $html, integer $chapter_parent ) : integer
$post_type string Post Type
$p array Single Item Returned From \Pressbooks\Modules\Import\WordPress\Parser::parse
$html string
$chapter_parent integer
Résultat integer Post ID

pbCheck() protected méthode

Is it a WXR generated by PB?
protected pbCheck ( array $xml )
$xml array

scrapeAndKneadImages() protected méthode

Parse HTML snippet, save all found tags using media_handle_sideload(), return the HTML with changed paths.
protected scrapeAndKneadImages ( DOMDocument $doc ) : DOMDocument
$doc DOMDocument
Résultat DOMDocument

searchForMetaValue() protected méthode

Check for PB specific metadata, returns empty string if not found.
protected searchForMetaValue ( $meta_key, array $postmeta ) : string
$postmeta array
Résultat string meta field value

setCurrentImportOption() public méthode

public setCurrentImportOption ( array $upload ) : boolean
$upload array
Résultat boolean

Property Details

$isPbWxr protected_oe property

If Pressbooks generated the WXR file
protected bool $isPbWxr
Résultat boolean