function import_choices($field_id) { if (!current_user_can('frm_edit_forms')) { return; } global $frm_ajax_url; if (function_exists('register_admin_color_schemes')) { register_admin_color_schemes(); } $hook_suffix = $admin_body_class = ''; if (get_user_setting('mfold') == 'f') { $admin_body_class .= ' folded'; } if (function_exists('is_admin_bar_showing') and is_admin_bar_showing()) { $admin_body_class .= ' admin-bar'; } if (is_rtl()) { $admin_body_class .= ' rtl'; } $admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh'); $prepop = array(); $prepop[__('Countries', 'formidable')] = FrmAppHelper::get_countries(); $states = FrmAppHelper::get_us_states(); $prepop[__('U.S. States', 'formidable')] = array_values($states); $prepop[__('U.S. State Abbreviations', 'formidable')] = array_keys($states); $prepop[__('Age', 'formidable')] = array(__('Under 18', 'formidable'), __('18-24', 'formidable'), __('25-34', 'formidable'), __('35-44', 'formidable'), __('45-54', 'formidable'), __('55-64', 'formidable'), __('65 or Above', 'formidable'), __('Prefer Not to Answer', 'formidable')); $prepop[__('Satisfaction', 'formidable')] = array(__('Very Satisfied', 'formidable'), __('Satisfied', 'formidable'), __('Neutral', 'formidable'), __('Unsatisfied', 'formidable'), __('Very Unsatisfied', 'formidable'), __('N/A', 'formidable')); $prepop[__('Importance', 'formidable')] = array(__('Very Important', 'formidable'), __('Important', 'formidable'), __('Neutral', 'formidable'), __('Somewhat Important', 'formidable'), __('Not at all Important', 'formidable'), __('N/A', 'formidable')); $prepop[__('Agreement', 'formidable')] = array(__('Strongly Agree', 'formidable'), __('Agree', 'formidable'), __('Neutral', 'formidable'), __('Disagree', 'formidable'), __('Strongly Disagree', 'formidable'), __('N/A', 'formidable')); $field = FrmField::getOne($field_id); $field->options = stripslashes_deep(maybe_unserialize($field->options)); $field->field_options = maybe_unserialize($field->field_options); include FRM_VIEWS_PATH . '/frm-fields/import_choices.php'; die; }
public static function import_choices() { if (!current_user_can('frm_edit_forms')) { return; } $field_id = $_REQUEST['field_id']; global $current_screen, $hook_suffix; // Catch plugins that include admin-header.php before admin.php completes. if (empty($current_screen) && function_exists('set_current_screen')) { $hook_suffix = ''; set_current_screen(); } if (function_exists('register_admin_color_schemes')) { register_admin_color_schemes(); } $hook_suffix = $admin_body_class = ''; if (get_user_setting('mfold') == 'f') { $admin_body_class .= ' folded'; } if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) { $admin_body_class .= ' admin-bar'; } if (is_rtl()) { $admin_body_class .= ' rtl'; } $admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh'); $prepop = array(); $prepop[__('Countries', 'formidable')] = FrmAppHelper::get_countries(); $states = FrmAppHelper::get_us_states(); $state_abv = array_keys($states); sort($state_abv); $prepop[__('U.S. State Abbreviations', 'formidable')] = $state_abv; $states = array_values($states); sort($states); $prepop[__('U.S. States', 'formidable')] = $states; unset($state_abv); unset($states); $prepop[__('Age', 'formidable')] = array(__('Under 18', 'formidable'), __('18-24', 'formidable'), __('25-34', 'formidable'), __('35-44', 'formidable'), __('45-54', 'formidable'), __('55-64', 'formidable'), __('65 or Above', 'formidable'), __('Prefer Not to Answer', 'formidable')); $prepop[__('Satisfaction', 'formidable')] = array(__('Very Satisfied', 'formidable'), __('Satisfied', 'formidable'), __('Neutral', 'formidable'), __('Unsatisfied', 'formidable'), __('Very Unsatisfied', 'formidable'), __('N/A', 'formidable')); $prepop[__('Importance', 'formidable')] = array(__('Very Important', 'formidable'), __('Important', 'formidable'), __('Neutral', 'formidable'), __('Somewhat Important', 'formidable'), __('Not at all Important', 'formidable'), __('N/A', 'formidable')); $prepop[__('Agreement', 'formidable')] = array(__('Strongly Agree', 'formidable'), __('Agree', 'formidable'), __('Neutral', 'formidable'), __('Disagree', 'formidable'), __('Strongly Disagree', 'formidable'), __('N/A', 'formidable')); $prepop = apply_filters('frm_bulk_field_choices', $prepop); $frm_field = new FrmField(); $field = $frm_field->getOne($field_id); include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php'; die; }