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.
        // 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)")
        //$epl_wpimport->admin_notice("Easy Property Listings requires <a href='http://wordpress.org/plugins/wp-all-import'>WP All Import Pro</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()));
    }
}
/**
 * check if post is core epl post
 * @since 2.3
 */
function is_epl_core_post($type = null)
{
    $type = is_null($type) ? get_post_type() : $type;
    return in_array($type, epl_get_core_post_types());
}