示例#1
0
function fes_forms_ajax_post_add_field()
{
    $name = $_POST['name'];
    $type = $_POST['type'];
    $field_id = $_POST['order'];
    switch ($name) {
        case 'post_title':
            FES_Formbuilder_Templates::post_title($field_id, __('Title', 'edd_fes'));
            break;
        case 'post_content':
            FES_Formbuilder_Templates::post_content($field_id, __('Body', 'edd_fes'));
            break;
        case 'post_excerpt':
            FES_Formbuilder_Templates::post_excerpt($field_id, __('Excerpt', 'edd_fes'));
            break;
        case 'featured_image':
            FES_Formbuilder_Templates::featured_image($field_id, __('Featured Image', 'edd_fes'));
            break;
        case 'download_category':
            FES_Formbuilder_Templates::taxonomy($field_id, 'Category', __('download_category', 'edd_fes'));
            break;
        case 'download_tag':
            FES_Formbuilder_Templates::taxonomy($field_id, 'Tags', __('download_tag', 'edd_fes'));
            break;
        case 'multiple_pricing':
            FES_Formbuilder_Templates::multiple_pricing($field_id, __('Prices and Files', 'edd_fes'));
            break;
        case 'custom_text':
            FES_Formbuilder_Templates::text_field($field_id, __('Custom field: Text', 'edd_fes'));
            break;
        case 'custom_textarea':
            FES_Formbuilder_Templates::textarea_field($field_id, __('Custom field: Textarea', 'edd_fes'));
            break;
        case 'custom_select':
            FES_Formbuilder_Templates::dropdown_field($field_id, __('Custom field: Select', 'edd_fes'));
            break;
        case 'custom_multiselect':
            FES_Formbuilder_Templates::multiple_select($field_id, __('Custom field: Multiselect', 'edd_fes'));
            break;
        case 'custom_radio':
            FES_Formbuilder_Templates::radio_field($field_id, __('Custom field: Radio', 'edd_fes'));
            break;
        case 'custom_checkbox':
            FES_Formbuilder_Templates::checkbox_field($field_id, __('Custom field: Checkbox', 'edd_fes'));
            break;
        case 'custom_file':
            FES_Formbuilder_Templates::file_upload($field_id, __('Custom field: File Upload', 'edd_fes'));
            break;
        case 'custom_url':
            FES_Formbuilder_Templates::website_url($field_id, __('Custom field: URL', 'edd_fes'));
            break;
        case 'custom_email':
            FES_Formbuilder_Templates::email_address($field_id, __('Custom field: E-Mail', 'edd_fes'));
            break;
        case 'custom_repeater':
            FES_Formbuilder_Templates::repeat_field($field_id, __('Custom field: Repeat Field', 'edd_fes'));
            break;
        case 'custom_html':
            FES_Formbuilder_Templates::custom_html($field_id, __('HTML', 'edd_fes'));
            break;
        case 'section_break':
            FES_Formbuilder_Templates::section_break($field_id, __('Section Break', 'edd_fes'));
            break;
        case 'action_hook':
            FES_Formbuilder_Templates::action_hook($field_id, __('Action Hook', 'edd_fes'));
            break;
        case 'user_avatar':
            FES_Formbuilder_Templates::avatar($field_id, __('Avatar', 'edd_fes'));
            break;
        case 'recaptcha':
            FES_Formbuilder_Templates::recaptcha($field_id, __('reCaptcha', 'edd_fes'));
            break;
        case 'custom_date':
            FES_Formbuilder_Templates::date_field($field_id, __('Custom Field: Date', 'edd_fes'));
            break;
        case 'custom_hidden':
            FES_Formbuilder_Templates::custom_hidden_field($field_id, __('Hidden Field', 'edd_fes'));
            break;
        case 'custom_country':
            FES_Formbuilder_Templates::country($field_id, __('Country', 'edd_fes'));
            break;
        case 'toc':
            FES_Formbuilder_Templates::toc($field_id, 'TOC');
            break;
        case 'user_login':
            FES_Formbuilder_Templates::user_login($field_id, __('Username', 'edd_fes'));
            break;
        case 'first_name':
            FES_Formbuilder_Templates::first_name($field_id, __('First Name', 'edd_fes'));
            break;
        case 'last_name':
            FES_Formbuilder_Templates::last_name($field_id, __('Last Name', 'edd_fes'));
            break;
        case 'nickname':
            FES_Formbuilder_Templates::nickname($field_id, __('Nickname', 'edd_fes'));
            break;
        case 'display_name':
            FES_Formbuilder_Templates::display_name($field_id, __('Display Name', 'edd_fes'));
            break;
        case 'user_email':
            FES_Formbuilder_Templates::user_email($field_id, __('E-mail', 'edd_fes'));
            break;
        case 'user_url':
            FES_Formbuilder_Templates::user_url($field_id, __('Website', 'edd_fes'));
            break;
        case 'user_bio':
            FES_Formbuilder_Templates::description($field_id, __('Biographical Info', 'edd_fes'));
            break;
        case 'password':
            FES_Formbuilder_Templates::password($field_id, __('Password', 'edd_fes'));
            break;
        case 'eddc_user_paypal':
            FES_Formbuilder_Templates::eddc_user_paypal($field_id, __('PayPal Email', 'edd_fes'));
            break;
        default:
            do_action('fes_admin_field_' . $name, $field_id);
            break;
    }
    exit;
}