PHP 클래스 WP_Import

상속: extends WP_Importer
파일 보기 프로젝트 열기: lucatume/wp-browser 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$author_mapping
$authors
$base_url
$categories
$featured_images
$fetch_attachments
$id max. supported WXR version
$max_wxr_version
$menu_item_orphans
$missing_menu_items
$post_orphans
$posts
$processed_authors mappings from old information to new
$processed_menu_items
$processed_posts
$processed_terms
$tags
$terms
$url_remap
$version information to import from WXR file

공개 메소드들

메소드 설명
WP_Import ( )
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 $n, 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
backfill_attachment_urls ( ) Use stored mapping information to update old attachment URLs
backfill_parents ( ) Attempt to associate posts and menu items with previously missing parents
bump_request_timeout ( $val ) : integer Added to http_request_timeout filter to force timeout at 60 seconds during import
cmpr_strlen ( $a, $b ) return the difference in length between two strings
dispatch ( ) Registered callback function for the WordPress Importer
fetch_remote_file ( string $url, array $post ) : array | WP_Error Attempt to download a remote file attachment
footer ( ) Close div.wrap
get_author_mapping ( ) Map old author logins to local user IDs based on decisions made in import options form. Can map to an existing user, create a new user or falls back to the current user in case of error with either of the previous
get_authors_from_import ( array $import_data ) Retrieve authors from parsed WXR data
greet ( ) Display introductory text and file upload form
handle_upload ( ) : boolean Handles the WXR upload and initial parsing of the file to prepare for displaying author import options
header ( ) Display import page title
import ( string $file ) The main controller for the actual import stage.
import_end ( ) Performs post-import cleanup of files and the cache
import_options ( ) Display pre-import options, author importing/mapping and option to fetch attachments
import_start ( string $file ) Parses the WXR file and prepares us for the task of processing parsed data
is_valid_meta_key ( string $key ) : string | boolean Decide if the given meta key maps to information we will want to import
max_attachment_size ( ) : integer Decide what the maximum file size for downloaded attachments is.
parse ( string $file ) : array Parse a WXR file
process_attachment ( array $post, string $url ) : integer | WP_Error If fetching attachments is enabled then attempt to create a new attachment
process_categories ( ) Create new categories based on import information
process_menu_item ( array $item ) Attempt to create a new menu item from import data
process_posts ( ) Create new posts based on import information
process_tags ( ) Create new post tags based on import information
process_terms ( ) Create new terms based on import information
remap_featured_images ( ) Update _thumbnail_id meta to new, imported attachment IDs

메소드 상세

WP_Import() 공개 메소드

public WP_Import ( )

allow_create_users() 공개 메소드

Default is true, can be filtered via import_allow_create_users
public allow_create_users ( ) : boolean
리턴 boolean True if creating users is allowed

allow_fetch_attachments() 공개 메소드

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.
public allow_fetch_attachments ( ) : boolean
리턴 boolean True if downloading attachments is allowed

author_select() 공개 메소드

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

backfill_attachment_urls() 공개 메소드

Use stored mapping information to update old attachment URLs

backfill_parents() 공개 메소드

An imported post's parent may not have been imported when it was first created so try again. Similarly for child menu items and menu items which were missing the object (e.g. post) they represent in the menu
public backfill_parents ( )

bump_request_timeout() 공개 메소드

Added to http_request_timeout filter to force timeout at 60 seconds during import
public bump_request_timeout ( $val ) : integer
리턴 integer 60

cmpr_strlen() 공개 메소드

return the difference in length between two strings
public cmpr_strlen ( $a, $b )

dispatch() 공개 메소드

Manages the three separate stages of the WXR import process
public dispatch ( )

fetch_remote_file() 공개 메소드

Attempt to download a remote file attachment
public fetch_remote_file ( string $url, array $post ) : array | WP_Error
$url string URL of item to fetch
$post array Attachment details
리턴 array | WP_Error Local file location details on success, WP_Error otherwise

get_author_mapping() 공개 메소드

Map old author logins to local user IDs based on decisions made in import options form. Can map to an existing user, create a new user or falls back to the current user in case of error with either of the previous
public get_author_mapping ( )

get_authors_from_import() 공개 메소드

Uses the provided author information from WXR 1.1 files or extracts info from each post for WXR 1.0 files
public get_authors_from_import ( array $import_data )
$import_data array Data returned by a WXR parser

greet() 공개 메소드

Display introductory text and file upload form
public greet ( )

handle_upload() 공개 메소드

Handles the WXR upload and initial parsing of the file to prepare for displaying author import options
public handle_upload ( ) : boolean
리턴 boolean False if error uploading or invalid file, true otherwise

header() 공개 메소드

Display import page title
public header ( )

import() 공개 메소드

The main controller for the actual import stage.
public import ( string $file )
$file string Path to the WXR file for importing

import_end() 공개 메소드

Performs post-import cleanup of files and the cache
public import_end ( )

import_options() 공개 메소드

Display pre-import options, author importing/mapping and option to fetch attachments
public import_options ( )

import_start() 공개 메소드

Parses the WXR file and prepares us for the task of processing parsed data
public import_start ( string $file )
$file string Path to the WXR file for importing

is_valid_meta_key() 공개 메소드

Decide if the given meta key maps to information we will want to import
public is_valid_meta_key ( string $key ) : string | boolean
$key string The meta key to check
리턴 string | boolean The key if we do want to import, false if not

max_attachment_size() 공개 메소드

Default is 0 (unlimited), can be filtered via import_attachment_size_limit
public max_attachment_size ( ) : integer
리턴 integer Maximum attachment file size to import

parse() 공개 메소드

Parse a WXR file
public parse ( string $file ) : array
$file string Path to WXR file for parsing
리턴 array Information gathered from the WXR file

process_attachment() 공개 메소드

If fetching attachments is enabled then attempt to create a new attachment
public process_attachment ( array $post, string $url ) : integer | WP_Error
$post array Attachment post details from WXR
$url string URL to fetch attachment from
리턴 integer | WP_Error Post ID on success, WP_Error otherwise

process_categories() 공개 메소드

Doesn't create a new category if its slug already exists
public process_categories ( )

process_menu_item() 공개 메소드

Fails for draft, orphaned menu items and those without an associated nav_menu or an invalid nav_menu term. If the post type or term object which the menu item represents doesn't exist then the menu item will not be imported (waits until the end of the import to retry again before discarding).
public process_menu_item ( array $item )
$item array Menu item details from WXR file

process_posts() 공개 메소드

Posts marked as having a parent which doesn't exist will become top level items. Doesn't create a new post if: the post type doesn't exist, the given post ID is already noted as imported or a post with the same title and date already exists. Note that new/updated terms, comments and meta are imported for the last of the above.
public process_posts ( )

process_tags() 공개 메소드

Doesn't create a tag if its slug already exists
public process_tags ( )

process_terms() 공개 메소드

Doesn't create a term its slug already exists
public process_terms ( )

프로퍼티 상세

$author_mapping 공개적으로 프로퍼티

public $author_mapping

$authors 공개적으로 프로퍼티

public $authors

$base_url 공개적으로 프로퍼티

public $base_url

$categories 공개적으로 프로퍼티

public $categories

$fetch_attachments 공개적으로 프로퍼티

public $fetch_attachments

$id 공개적으로 프로퍼티

max. supported WXR version
public $id

$max_wxr_version 공개적으로 프로퍼티

public $max_wxr_version

$menu_item_orphans 공개적으로 프로퍼티

public $menu_item_orphans

$missing_menu_items 공개적으로 프로퍼티

public $missing_menu_items

$post_orphans 공개적으로 프로퍼티

public $post_orphans

$posts 공개적으로 프로퍼티

public $posts

$processed_authors 공개적으로 프로퍼티

mappings from old information to new
public $processed_authors

$processed_menu_items 공개적으로 프로퍼티

public $processed_menu_items

$processed_posts 공개적으로 프로퍼티

public $processed_posts

$processed_terms 공개적으로 프로퍼티

public $processed_terms

$tags 공개적으로 프로퍼티

public $tags

$terms 공개적으로 프로퍼티

public $terms

$url_remap 공개적으로 프로퍼티

public $url_remap

$version 공개적으로 프로퍼티

information to import from WXR file
public $version