public static function show_field($field, $form, $parent_form_id) { global $frm_vars; if (!empty($field['hide_field'])) { $first = reset($field['hide_field']); if (is_numeric($first)) { if (!isset($frm_vars['hidden_fields'])) { $frm_vars['hidden_fields'] = array(); } $frm_vars['hidden_fields'][] = $field; } } if ($field['use_calc'] && $field['calc']) { $ajax = isset($form->options['ajax_submit']) && $form->options['ajax_submit'] ? true : false; if ($ajax && FrmAppHelper::doing_ajax()) { return; } global $frm_vars; if (!isset($frm_vars['calc_fields'])) { $frm_vars['calc_fields'] = array(); } $frm_vars['calc_fields'][$field['field_key']] = array('calc' => $field['calc'], 'calc_dec' => $field['calc_dec'], 'form_id' => $form->id, 'field_id' => $field['id'], 'parent_form_id' => $parent_form_id); } }
/** * Check for database update and trigger js loading * * @since 2.0.1 */ public static function admin_init() { if (!FrmAppHelper::doing_ajax() && self::needs_update()) { self::network_upgrade_site(); } $action = FrmAppHelper::simple_get('action', 'sanitize_title'); if (!FrmAppHelper::doing_ajax() || $action == 'frm_import_choices') { // don't continue during ajax calls self::admin_js(); } }
/** * When a form is loaded with ajax, we need all the info for * the fields included in the footer with the first page */ private static function set_ajax_field_globals($f) { global $frm_vars; $ajax_now = !FrmAppHelper::doing_ajax(); switch ($f->type) { case 'date': if (!FrmField::is_read_only($f)) { if (!isset($frm_vars['datepicker_loaded']) || !is_array($frm_vars['datepicker_loaded'])) { $frm_vars['datepicker_loaded'] = array(); } $frm_vars['datepicker_loaded']['field_' . $f->field_key] = $ajax_now; } break; case 'time': if (isset($f->field_options['unique']) && $f->field_options['unique']) { if (!isset($frm_vars['timepicker_loaded'])) { $frm_vars['timepicker_loaded'] = array(); } $frm_vars['timepicker_loaded']['field_' . $f->field_key] = $ajax_now; } break; case 'phone': if (isset($f->field_options['format']) && !empty($f->field_options['format']) && strpos($f->field_options['format'], '^') !== 0) { global $frm_input_masks; $frm_input_masks[] = $ajax_now; } break; } }
public static function send_email() { if (current_user_can('frm_view_forms') || current_user_can('frm_edit_forms') || current_user_can('frm_edit_entries')) { if (FrmAppHelper::doing_ajax()) { check_ajax_referer('frm_ajax', 'nonce'); } $entry_id = FrmAppHelper::get_param('entry_id', '', 'get', 'absint'); $form_id = FrmAppHelper::get_param('form_id', '', 'get', 'absint'); printf(__('Resent to %s', 'formidable'), ''); add_filter('frm_echo_emails', '__return_true'); FrmFormActionsController::trigger_actions('create', $form_id, $entry_id, 'email'); } else { _e('Resent to No one! You do not have permission', 'formidable'); } wp_die(); }
$e_args['textarea_rows'] = $field['max']; } $e_args = apply_filters('frm_rte_options', $e_args, $field); if ($field['size']) { ?> <style type="text/css">#wp-field_<?php echo esc_attr($field['field_key']); ?> -wrap{width:<?php echo esc_attr($field['size']) . (is_numeric($field['size']) ? 'px' : ''); ?> ;}</style><?php } wp_editor(str_replace('"', '"', $field['value']), $html_id, $e_args); // If submitting with Ajax or on preview page and tinymce is not loaded yet, load it now if ((FrmAppHelper::doing_ajax() || FrmAppHelper::is_preview_page()) && (!isset($frm_vars['tinymce_loaded']) || !$frm_vars['tinymce_loaded'])) { add_action('wp_print_footer_scripts', '_WP_Editors::editor_js', 50); add_action('wp_print_footer_scripts', '_WP_Editors::enqueue_scripts', 1); $frm_vars['tinymce_loaded'] = true; } unset($e_args); } else { ?> <textarea name="<?php echo esc_attr($field_name); ?> " id="<?php echo esc_attr($html_id); ?> " style="height:<?php echo $field['max'] ? (int) $field['max'] * 17 : 125;