PHP Class WXR_Import_UI, WordPress-Importer

Afficher le fichier Open project: humanmade/WordPress-Importer

Protected Properties

Свойство Type Description
$fetch_attachments boolean Set in {@see \display_import_step}.

Méthodes publiques

Méthode Description
__construct ( ) Constructor.
add_mime_type_xml ( array $mimes ) Add .xml files as supported format in the uploader.
dispatch ( ) Render the import page.
handle_async_upload ( ) Handle an async upload.
imported_comment ( ) Send message when a comment has been imported.
imported_post ( integer $id, array $data ) Send message when a post has been imported.
imported_term ( ) Send message when a term has been imported.
imported_user ( ) Send message when a user has been imported.
on_load ( ) Handle load event for the importer.
show_updates_in_header ( ) Show an update notice in the importer header.
stream_import ( ) Run an import, and send an event-stream response.

Méthodes protégées

Méthode Description
allow_create_users ( ) : boolean Decide whether or not the importer is allowed to create users.
allow_fetch_attachments ( ) : boolean Decide whether or not the importer should attempt to download attachment files.
author_select ( integer $index, array $author ) Display import options for an individual author. That is, either create a new user based on import info or map to an existing user
display_author_step ( ) Display the author picker (or upload errors).
display_error ( WP_Error $err, $step )
display_import_step ( ) Display the actual import step.
display_intro_step ( ) Display introductory text and file upload form
emit_sse_message ( mixed $data ) Emit a Server-Sent Events message.
get_author_mapping ( array $args ) : array Get mapping data from request data.
get_data_for_attachment ( integer $id ) : WXR_Import_Info | WP_Error Get preliminary data for an import file.
get_import_options ( ) : array Get options for the importer.
get_importer ( ) : WXR_Importer Get the importer instance.
get_url ( integer $step ) Get the URL for the importer.
handle_select ( integer | string $id ) : boolean | WP_Error Handle a WXR file selected from the media browser.
handle_upload ( ) : boolean | WP_Error Handles the WXR upload and initial parsing of the file to prepare for displaying author import options
render_footer ( ) Render the importer footer.
render_header ( ) Render the importer header.
render_upload_form ( )

Method Details

__construct() public méthode

Constructor.
public __construct ( )

add_mime_type_xml() public méthode

Add .xml files as supported format in the uploader.
public add_mime_type_xml ( array $mimes )
$mimes array Already supported mime types.

allow_create_users() protected méthode

Default is true, can be filtered via import_allow_create_users
protected allow_create_users ( ) : boolean
Résultat boolean True if creating users is allowed

allow_fetch_attachments() protected méthode

Default is true, can be filtered via import_allow_fetch_attachments. The choice made at the import options screen must also be true, false here hides that checkbox.
protected allow_fetch_attachments ( ) : boolean
Résultat boolean True if downloading attachments is allowed

author_select() protected méthode

Display import options for an individual author. That is, either create a new user based on import info or map to an existing user
protected author_select ( integer $index, array $author )
$index integer Index for each author in the form
$author array Author information, e.g. login, display name, email

dispatch() public méthode

Render the import page.
public dispatch ( )

display_author_step() protected méthode

Display the author picker (or upload errors).
protected display_author_step ( )

display_error() protected méthode

protected display_error ( WP_Error $err, $step )
$err WP_Error

display_import_step() protected méthode

Display the actual import step.
protected display_import_step ( )

display_intro_step() protected méthode

Display introductory text and file upload form
protected display_intro_step ( )

emit_sse_message() protected méthode

Emit a Server-Sent Events message.
protected emit_sse_message ( mixed $data )
$data mixed Data to be JSON-encoded and sent in the message.

get_author_mapping() protected méthode

Parses form request data into an internally usable mapping format.
protected get_author_mapping ( array $args ) : array
$args array Raw (UNSLASHED) POST data to parse.
Résultat array Map containing `mapping` and `slug_overrides` keys.

get_data_for_attachment() protected méthode

This is a quick pre-parse to verify the file and grab authors from it.
protected get_data_for_attachment ( integer $id ) : WXR_Import_Info | WP_Error
$id integer Media item ID.
Résultat WXR_Import_Info | WP_Error Import info instance on success, error otherwise.

get_import_options() protected méthode

Get options for the importer.
protected get_import_options ( ) : array
Résultat array Options to pass to WXR_Importer::__construct

get_importer() protected méthode

Get the importer instance.
protected get_importer ( ) : WXR_Importer
Résultat WXR_Importer

get_url() protected méthode

Get the URL for the importer.
protected get_url ( integer $step )
$step integer Go to step rather than start.

handle_async_upload() public méthode

Triggers on async-upload.php?action=wxr-import-upload to handle Plupload requests from the importer.
public handle_async_upload ( )

handle_select() protected méthode

Handle a WXR file selected from the media browser.
protected handle_select ( integer | string $id ) : boolean | WP_Error
$id integer | string Media item to import from.
Résultat boolean | WP_Error True on success, error object otherwise.

handle_upload() protected méthode

Handles the WXR upload and initial parsing of the file to prepare for displaying author import options
protected handle_upload ( ) : boolean | WP_Error
Résultat boolean | WP_Error True on success, error object otherwise.

imported_comment() public méthode

Send message when a comment has been imported.
public imported_comment ( )

imported_post() public méthode

Send message when a post has been imported.
public imported_post ( integer $id, array $data )
$id integer Post ID.
$data array Post data saved to the DB.

imported_term() public méthode

Send message when a term has been imported.
public imported_term ( )

imported_user() public méthode

Send message when a user has been imported.
public imported_user ( )

on_load() public méthode

Handle load event for the importer.
public on_load ( )

render_header() protected méthode

Render the importer header.
protected render_header ( )

render_upload_form() protected méthode

protected render_upload_form ( )

show_updates_in_header() public méthode

Show an update notice in the importer header.

stream_import() public méthode

Streams logs and success messages to the browser to allow live status and updates.
public stream_import ( )

Property Details

$fetch_attachments protected_oe property

Set in {@see \display_import_step}.
protected bool $fetch_attachments
Résultat boolean