当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Import::allow_fetch_attachments方法代码示例

本文整理汇总了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");
    }
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:38,代码来源:vibeimport.php

示例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");
    }
}
开发者ID:nikitansk,项目名称:devschool,代码行数:40,代码来源:vibeimport.php

示例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;
 }
开发者ID:wilxsv,项目名称:prevensionPublicLibrary,代码行数:20,代码来源:demo-importer.php

示例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;
 }
开发者ID:mathewhtc,项目名称:cats-old,代码行数:21,代码来源:demo-importer.php


注:本文中的WP_Import::allow_fetch_attachments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。