function epl_wpimport_register_fields()
{
    global $epl_ai_meta_fields, $epl_wpimport;
    // Initialize EPL WP All Import Pro add-on.
    $epl_wpimport = new RapidAddon('Easy Property Listings Custom Fields', 'epl_wpimport_addon');
    if (!empty($epl_ai_meta_fields)) {
        foreach ($epl_ai_meta_fields as $epl_meta_box) {
            if (!empty($epl_meta_box['groups'])) {
                foreach ($epl_meta_box['groups'] as $group) {
                    $epl_wpimport->add_title($group['label'], $group['label']);
                    $fields = $group['fields'];
                    $fields = array_filter($fields);
                    if (!empty($fields)) {
                        foreach ($fields as $field) {
                            switch ($field['type']) {
                                case 'textarea':
                                    $epl_wpimport->add_field($field['name'], $field['label'], 'textarea');
                                    break;
                                case 'url':
                                case 'date':
                                case 'sold-date':
                                case 'sold-date':
                                case 'auction-date':
                                case 'decimal':
                                case 'number':
                                case 'checkbox':
                                case 'checkbox_single':
                                    $epl_wpimport->add_field($field['name'], $field['label'], 'text');
                                    break;
                                case 'select':
                                case 'radio':
                                    $opts = isset($field['opts']) ? $field['opts'] : array();
                                    if (!empty($opts)) {
                                        foreach ($opts as $opt_key => &$opt_value) {
                                            if (is_array($opt_value)) {
                                                $opts[$opt_key] = $opt_value['label'];
                                            }
                                        }
                                    }
                                    $epl_wpimport->add_field($field['name'], $field['label'], 'radio', array());
                                    break;
                                default:
                                    $type = in_array($field['type'], array('text', 'hidden')) ? 'text' : $field['type'];
                                    $epl_wpimport->add_field($field['name'], $field['label'], $type);
                                    break;
                            }
                        }
                    }
                }
            }
        }
        // Register Import Function
        $epl_wpimport->set_import_function('epl_wpimport_import_function');
        // display a dismiss able notice warning the user to install WP All Import to use the add-on.
        $epl_wpimport->admin_notice("Easy Property Listings Importer plugin recommends you install <a href='http://www.wpallimport.com/'>WP All Import Pro 4.2.6+</a>");
        // the add-on will run for all themes/post types if no arguments are passed to run()
        $epl_wpimport->run(array("post_types" => epl_get_core_post_types()));
    }
}
/*
Plugin Name: Yoast SEO Add-On
Description: A complete example add-on for importing data to certain Yoast SEO fields.
Version: 1.0
Author: WP All Import
*/
include "rapid-addon.php";
$yoast_seo_addon = new RapidAddon('Yoast SEO Add-On', 'yoast_seo_addon');
$yoast_seo_addon->add_field('yoast_wpseo_title', 'SEO Title', 'text');
$yoast_seo_addon->add_field('yoast_wpseo_metadesc', 'Meta Description', 'text');
$yoast_seo_addon->add_field('yoast_wpseo_meta-robots-noindex', 'Meta Robots Index', 'radio', array('' => 'default', '1' => 'noindex', '2' => 'index'));
$yoast_seo_addon->add_field('yoast_wpseo_opengraph-image', 'Facebook Image', 'image');
$yoast_seo_addon->set_import_function('yoast_seo_addon_import');
// display a dismissable notice warning the user to install WP All Import to use the add-on.
// Customize the notice text by passing a string to admin_notice(), i.e. admin_notice("XYZ Theme recommends you install WP All Import (free | pro)")
$yoast_seo_addon->admin_notice();
// the add-on will run for all themes/post types if no arguments are passed to run()
$yoast_seo_addon->run();
function yoast_seo_addon_import($post_id, $data, $import_options)
{
    global $yoast_seo_addon;
    if ($yoast_seo_addon->can_update_meta('_yoast_wpseo_title', $import_options)) {
        update_post_meta($post_id, '_yoast_wpseo_title', $data['yoast_wpseo_title']);
    }
    if ($yoast_seo_addon->can_update_meta('_yoast_wpseo_metadesc', $import_options)) {
        update_post_meta($post_id, '_yoast_wpseo_metadesc', $data['yoast_wpseo_metadesc']);
    }
    if ($yoast_seo_addon->can_update_meta('_yoast_wpseo_meta-robots-noindex', $import_options)) {
        update_post_meta($post_id, '_yoast_wpseo_meta-robots-noindex', $data['yoast_wpseo_meta-robots-noindex']);
    }
    if ($yoast_seo_addon->can_update_image($import_options)) {
Пример #3
0
Version: 1.1.0
Author: Soflyy
*/
include "rapid-addon.php";
include_once ABSPATH . 'wp-admin/includes/plugin.php';
$yoast_addon = new RapidAddon('Yoast WordPress SEO Add-On', 'yoast_addon');
$yoast_addon->add_field('_yoast_wpseo_focuskw', 'Focus Keyword', 'text', null, 'Pick the main keyword or keyphrase that this post/page is about.');
$yoast_addon->add_field('_yoast_wpseo_title', 'SEO Title', 'text', null, 'The SEO title defaults to what is generated based on this sites title template for this posttype.');
$yoast_addon->add_field('_yoast_wpseo_metadesc', 'Meta Description', 'text', null, 'The meta description will be limited to 156 chars. It is often shown as the black text under the title in a search result. For this to work it has to contain the keyword that was searched for.');
$yoast_addon->add_options($yoast_addon->add_field('_yoast_wpseo_opengraph-title', 'Facebook Title', 'text', null, "If you don't want to use the post title for sharing the post on Facebook but instead want another title there, import it here."), 'Facebook Options', array($yoast_addon->add_field('_yoast_wpseo_opengraph-description', 'Description', 'text', null, "If you don't want to use the meta description for sharing the post on Facebook but want another description there, write it here."), $yoast_addon->add_field('_yoast_wpseo_opengraph-image', 'Image', 'image', null, "If you want to override the image used on Facebook for this post, import one here. The recommended image size for Facebook is 1200 x 628px.")));
$yoast_addon->add_options($yoast_addon->add_field('_yoast_wpseo_twitter-title', 'Twitter Title', 'text', null, "If you don't want to use the post title for sharing the post on Twitter but instead want another title there, import it here."), 'Twitter Options', array($yoast_addon->add_field('_yoast_wpseo_twitter-description', 'Description', 'text', null, "If you don't want to use the meta description for sharing the post on Twitter but want another description there, import it here."), $yoast_addon->add_field('_yoast_wpseo_twitter-image', 'Image', 'image', null, "If you want to override the image used on Twitter for this post, import one here. The recommended image size for Twitter is 1024 x 512px.")));
$yoast_addon->add_options(null, 'Advanced SEO Options', array($yoast_addon->add_field('_yoast_wpseo_meta-robots-noindex', 'Meta Robots Index', 'radio', array('' => 'default', '2' => 'index', '1' => 'noindex'), "This setting can be overwritten by Yoast WordPress SEO's sitewide privacy settings"), $yoast_addon->add_field('_yoast_wpseo_meta-robots-nofollow', 'Meta Robots Nofollow', 'radio', array('' => 'Follow', '1' => 'Nofollow')), $yoast_addon->add_field('_yoast_wpseo_meta-robots-adv', 'Meta Robots Advanced', 'radio', array('' => 'default', 'none' => 'None', 'noodp' => 'NO ODP', 'noydir' => 'NO YDIR', 'noimageindex' => 'No Image Index', 'noarchive' => 'No Archive', 'nosnippet' => 'No Snippet'), 'Advanced meta robots settings for this page.'), $yoast_addon->add_field('_yoast_wpseo_sitemap-include', 'Include in Sitemap', 'radio', array('' => 'Auto detect', 'always' => 'Always include', 'never' => 'Never include'), 'Should this page be in the XML Sitemap at all times, regardless of Robots Meta settings?'), $yoast_addon->add_field('_yoast_wpseo_sitemap-prio', 'Sitemap Priority', 'radio', array('' => 'Automatic Prioritization', '1' => '1 - Highest priority', '0.9' => '0.9', '0.8' => '0.8 - Default for first tier pages', '0.7' => '0.7', '0.6' => '0.6 - Default for second tier pages and posts', '0.5' => '0.5 - Medium priority', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1 - Lowest priority'), 'The priority given to this page in the XML sitemap. '), $yoast_addon->add_field('_yoast_wpseo_canonical', 'Canonical URL', 'text', null, 'The canonical URL that this page should point to, leave empty to default to permalink. Cross domain canonical supported too.'), $yoast_addon->add_field('_yoast_wpseo_redirect', '301 Redirect', 'text', null, 'The URL that this page should redirect to.')));
$yoast_addon->set_import_function('yoast_seo_addon_import');
if (function_exists('is_plugin_active')) {
    if (!is_plugin_active("wordpress-seo/wp-seo.php") && !is_plugin_active("wordpress-seo-premium/wp-seo-premium.php")) {
        $yoast_addon->admin_notice('The Yoast WordPress SEO Add-On requires WP All Import <a href="http://www.wpallimport.com/order-now/?utm_source=free-plugin&utm_medium=dot-org&utm_campaign=yoast" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>, and the <a href="https://yoast.com/wordpress/plugins/seo/">Yoast WordPress SEO</a> plugin.', array('plugins' => array('wordpress-seo/wp-seo.php')));
    }
    if (is_plugin_active("wordpress-seo/wp-seo.php") || is_plugin_active("wordpress-seo-premium/wp-seo-premium.php")) {
        $yoast_addon->run();
    }
}
function yoast_seo_addon_import($post_id, $data, $import_options)
{
    global $yoast_addon;
    // all fields except for slider and image fields
    $fields = array('_yoast_wpseo_focuskw', '_yoast_wpseo_title', '_yoast_wpseo_metadesc', '_yoast_wpseo_meta-robots-noindex', '_yoast_wpseo_meta-robots-nofollow', '_yoast_wpseo_meta-robots-adv', '_yoast_wpseo_sitemap-include', '_yoast_wpseo_sitemap-prio', '_yoast_wpseo_canonical', '_yoast_wpseo_redirect', '_yoast_wpseo_opengraph-title', '_yoast_wpseo_opengraph-description', '_yoast_wpseo_twitter-title', '_yoast_wpseo_twitter-description');
    // image fields
    $image_fields = array('_yoast_wpseo_opengraph-image', '_yoast_wpseo_twitter-image');
    $fields = array_merge($fields, $image_fields);
    // update everything in fields arrays
    foreach ($fields as $field) {
                    $fields_array[] = $vipp_addon_free->add_field('vippfree' . $my_pod->post_name . $pods_field->post_name, $pods_field->post_title, 'text', null, $pods_field->post_content);
                    $my_fields[$my_pod->post_name][$pods_field->post_name] = '';
                    //original field name as array key to avoid field name conflicts.
                }
            }
            $vipp_addon_free->add_options(null, $my_pod->post_title . ' Fields', $fields_array);
        }
    }
}
$vipp_addon_free->add_field('vipp_my_pod_name', 'Drag and drop to fields of your content type to import. <a href="http://vipp.com.au"> Upgrade for relationship fields matching, media upload, WooCommerce customer import and more premium features</a>. ', 'text', null, "Drag and drop data from the right hand side to the data type you are importing. Fields of other content types under this section will be ignored. ");
//start of pro features
//end of pro features
//print_r($my_fields);
$vipp_addon_free->set_import_function('pods_addon_import_free');
$vipp_addon_free->admin_notice('This add-on plugin requires WP All Import <a href="http://www.wpallimport.com/" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>, and the <a href="https://wordpress.org/plugins/pods/">
Pods - Custom Content Types and Fields
</a> plugin. ', array("plugins" => array("pods/init.php")));
$vipp_addon_free->run(array("plugins" => array("pods/init.php"), "post_types" => $my_pod_array));
function pods_addon_import_free($post_id, $data, $import_options)
{
    global $vipp_addon_free, $wpdb, $my_fields;
    //$my_pod_name = $data['vipp_my_pod_name'];
    $my_pod_name = $import_options->options['custom_type'];
    //echo '<br>' . $my_pod_name;
    $vipp_addon_free->log('- Processing custom fields of pods custom type name: `' . $my_pod_name . '`');
    $save = array();
    //echo '<pre>';
    //print_r($data);
    //print_r($my_fields[$my_pod_name]);
    //echo '</pre>';
    $vipp_addon_free->log('- Some fields may be skipped as per your import setting. Please change import setting when you need to import to the skipped fields.');
    update_slug($post, $slug, $language);
}
function update_slug($post_object, $slug, $language)
{
    // The post slug was changed (because of duplicate)
    if ($post_object->post_name != $slug) {
        wp_update_post(array('ID' => $post_object->ID, 'post_name' => $slug));
    }
}
$multilingual_import_addon = new RapidAddon('Multilingual Import Add-On', 'multilingual_import_addon');
$multilingual_import_addon->add_field('multilingual_import_language', 'Entry Language', 'text');
$multilingual_import_addon->add_field('multilingual_import_common_id', 'Entry Common ID', 'text');
$multilingual_import_addon->set_import_function('multilingual_addon_import');
// display a dismissable notice warning the user to install WP All Import to use the add-on.
// Customize the notice text by passing a string to admin_notice(), i.e. admin_notice("XYZ Theme recommends you install WP All Import (free | pro)")
$multilingual_import_addon->admin_notice();
// the add-on will run for all themes/post types if no arguments are passed to run()
$multilingual_import_addon->run();
function multilingual_addon_import($post_id, $data, $import_options, $articleData)
{
    global $multilingual_import_addon;
    $language = $data['multilingual_import_language'];
    $common_id = $data['multilingual_import_common_id'];
    if ($multilingual_import_addon->can_update_meta('_multilingual_entry_language', $import_options)) {
        echo 'Updating META';
        update_post_meta($post_id, '_multilingual_entry_language', $language);
    }
    if ($multilingual_import_addon->can_update_meta('_multilingual_entry_common_id', $import_options)) {
        update_post_meta($post_id, '_multilingual_entry_common_id', $common_id);
    }
    set_language($post_id, $language, $common_id, $articleData['post_name']);
$jobify_addon->add_field('_job_location', 'Location', 'text', null, 'Leave this blank if location is not important');
$jobify_addon->add_field('_company_name', 'Company Name', 'text');
$jobify_addon->add_field('_company_tagline', 'Company Tagline', 'text');
$jobify_addon->add_field('_company_description', 'Company Description', 'text');
$jobify_addon->add_field('_application', 'Application Email or URL', 'text', null, 'This field is required for the "application" area to appear beneath the listing.');
$jobify_addon->add_field('_company_website', 'Company Website', 'text');
$jobify_addon->add_field('_company_logo', 'Company Logo', 'image');
$jobify_addon->add_field('company_featured_image', 'Featured Image', 'image');
// field is _company_video, will 'image' add_field support videos?
$jobify_addon->add_field('video_type', 'Company Video', 'radio', array('external' => array('Externally Hosted', $jobify_addon->add_field('_company_video_url', 'Video URL', 'text')), 'local' => array('Locally Hosted', $jobify_addon->add_field('_company_video_id', 'Upload Video', 'file'))));
$jobify_addon->add_field('_job_expires', 'Listing Expiry Date', 'text', null, 'Import date in any strtotime compatible format.');
$jobify_addon->add_field('_filled', 'Filled', 'radio', array('0' => 'No', '1' => 'Yes'), 'Filled listings will no longer accept applications.');
$jobify_addon->add_field('_featured', 'Featured Listing', 'radio', array('0' => 'No', '1' => 'Yes'), 'Featured listings will be sticky during searches, and can be styled differently.');
$jobify_addon->add_options(null, 'Social Media Options', array($jobify_addon->add_field('_company_facebook', 'Company Facebook', 'text'), $jobify_addon->add_field('_company_twitter', 'Company Twitter', 'text'), $jobify_addon->add_field('_company_linkedin', 'Company LinkedIn', 'text'), $jobify_addon->add_field('_company_google', 'Company Google+', 'text')));
$jobify_addon->set_import_function('jobify_addon_import');
$jobify_addon->admin_notice('The Jobify Add-On requires WP All Import <a href="http://www.wpallimport.com/order-now/?utm_source=free-plugin&utm_medium=dot-org&utm_campaign=jobify" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>, and the <a href="https://astoundify.com/go/wp-all-import-buy-jobify/">Jobify</a> theme.', array('themes' => array('Jobify')));
$jobify_addon->run(array('themes' => array('Jobify'), 'post_types' => array('job_listing')));
function jobify_addon_import($post_id, $data, $import_options)
{
    global $jobify_addon;
    // all fields except for slider and image fields
    $fields = array('_job_location', '_company_name', '_company_tagline', '_company_description', '_application', '_company_website', '_filled', '_featured', '_company_facebook', '_company_twitter', '_company_linkedin', '_company_google');
    // update everything in fields arrays
    foreach ($fields as $field) {
        if ($jobify_addon->can_update_meta($field, $import_options)) {
            update_post_meta($post_id, $field, $data[$field]);
        }
    }
    // set featured image
    $field = 'company_featured_image';
    if ($jobify_addon->can_update_image($import_options)) {