當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。