本文整理汇总了PHP中WP_Import::allow_fetch_attachments方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Import::allow_fetch_attachments方法的具体用法?PHP WP_Import::allow_fetch_attachments怎么用?PHP WP_Import::allow_fetch_attachments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Import
的用法示例。
在下文中一共展示了WP_Import::allow_fetch_attachments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vibe_import
/**
* FILE: vibeimport.php
* Author: Mr.Vibe
* Credits: www.VibeThemes.com
* Project: WPLMS
*/
function vibe_import($file)
{
require_once ABSPATH . 'wp-admin/includes/import.php';
$file_path = apply_filters('wplms_setup_import_file_path', VIBE_PATH . "/setup/data/{$file}.xml", $file);
if (!class_exists('WP_Import')) {
require_once 'wordpress-importer.php';
}
if (class_exists('WP_Import')) {
if (file_exists($file_path)) {
do_action('wplms_before_sample_data_import', $file);
$WP_Import = new WP_Import();
if (!function_exists('wp_insert_category')) {
include ABSPATH . 'wp-admin/includes/taxonomy.php';
}
if (!function_exists('post_exists')) {
include ABSPATH . 'wp-admin/includes/post.php';
}
if (!function_exists('comment_exists')) {
include ABSPATH . 'wp-admin/includes/comment.php';
}
$WP_Import->fetch_attachments = true;
$WP_Import->allow_fetch_attachments();
$WP_Import->import($file_path);
do_action('wplms_after_sample_data_import', $file);
_e('Import Complete !', 'vibe');
} else {
echo __("Unable to locate Sample Data file.", 'vibe');
}
} else {
echo __("Couldn't install the test demo data as we were unable to use the WP_Import class.", "vibe");
}
}
示例2: vibe_import
/**
* FILE: vibeimport.php
* Author: Mr.Vibe
* Credits: www.VibeThemes.com
* Project: WPLMS
*/
function vibe_import($file)
{
require_once ABSPATH . 'wp-admin/includes/import.php';
$file_path = apply_filters('wplms_setup_import_file_path', VIBE_PATH . "/setup/data/{$file}.xml", $file);
if (!class_exists('WP_Import')) {
require_once 'wordpress-importer.php';
}
if (class_exists('WP_Import')) {
if (file_exists($file_path)) {
do_action('wplms_before_sample_data_import', $file);
$WP_Import = new WP_Import();
if (!function_exists('wp_insert_category')) {
include ABSPATH . 'wp-admin/includes/taxonomy.php';
}
if (!function_exists('post_exists')) {
include ABSPATH . 'wp-admin/includes/post.php';
}
if (!function_exists('comment_exists')) {
include ABSPATH . 'wp-admin/includes/comment.php';
}
$WP_Import->fetch_attachments = true;
$WP_Import->allow_fetch_attachments();
$WP_Import->import($file_path);
_e('Import Complete !', 'vibe');
echo '<a href="' . admin_url('options-permalink.php') . '" target="_blank" class="button button-primary" style="margin-top:15px;">' . __('Save Permalinks', 'vibe') . '</a><br />';
echo '<a href="' . admin_url('options-general.php?page=bp-components') . '" target="_blank" class="button button-primary" style="margin-top:15px;">' . __('Save Components', 'vibe') . '</a>';
do_action('wplms_after_sample_data_import', $file);
} else {
echo __("Unable to locate Sample Data file.", 'vibe');
}
} else {
echo __("Couldn't install the test demo data as we were unable to use the WP_Import class.", "vibe");
}
}
示例3: define
function vwdemo_start_import()
{
define('WP_LOAD_IMPORTERS', true);
// Load all importer functions
require VW_DEMO_IMPORT_PATH . '/wordpress-importer/wordpress-importer.php';
add_action('import_start', 'vwdemo_import_custom_sidebars', 91);
add_action('import_start', 'vwdemo_import_widgets', 92);
add_action('import_end', 'vwdemo_setup_menu');
add_action('import_end', 'vwdemo_setup_homepage');
add_action('import_end', 'vwdemo_setup_finish');
add_filter('http_request_args', 'vwdemo_disable_reject_unsafe_urls', 11, 2);
$wp_import = new WP_Import();
$wp_import->fetch_attachments = $wp_import->allow_fetch_attachments();
// Import
$file_path = VW_DEMO_IMPORT_PATH . '/demo-content/demo-content.xml';
if (file_exists($file_path)) {
$wp_import->import($file_path);
}
die;
}
示例4: define
function vwdemo_start_import()
{
define('WP_LOAD_IMPORTERS', true);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
if (!class_exists('WP_Import')) {
require_once get_template_directory() . '/framework/demo-importer/wordpress-importer/wordpress-importer.php';
}
add_action('import_start', 'vwdemo_import_custom_sidebars', 91);
add_action('import_start', 'vwdemo_import_widgets', 92);
add_action('import_end', 'vwdemo_setup_menu');
add_action('import_end', 'vwdemo_setup_homepage');
add_filter('http_request_args', 'vwdemo_disable_reject_unsafe_urls', 11, 2);
$wp_import = new WP_Import();
$wp_import->fetch_attachments = $wp_import->allow_fetch_attachments();
// Import
$file_path = VW_DEMO_IMPORT_PATH . '/demo-content.xml';
if (file_exists($file_path)) {
$wp_import->import($file_path);
}
die;
}