public static function show() { FrmAppHelper::permission_check('frm_view_reports'); remove_action('frm_form_action_reports', 'FrmStatisticsController::list_reports'); add_filter('frm_form_stop_action_reports', '__return_true'); global $wpdb; $form = false; if (isset($_REQUEST['form'])) { $form = FrmForm::getOne($_REQUEST['form']); } if (!$form) { require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-statistics/select.php'; return; } $exclude_types = FrmField::no_save_fields(); $exclude_types = array_merge($exclude_types, array('rte', 'textarea', 'file', 'grid', 'signature', 'form', 'table')); $fields = FrmField::getAll(array('fi.form_id' => (int) $form->id, 'fi.type not' => $exclude_types), 'field_order'); $js = ''; $data = array(); $colors = '#21759B,#EF8C08,#C6C6C6'; $data['time'] = self::get_daily_entries($form, array('is3d' => true, 'colors' => $colors, 'bg_color' => 'transparent')); $data['month'] = self::get_daily_entries($form, array('is3d' => true, 'colors' => $colors, 'bg_color' => 'transparent', 'width' => '100%'), 'MONTH'); foreach ($fields as $field) { $this_data = self::graph_shortcode(array('id' => $field->id, 'field' => $field, 'is3d' => true, 'min' => 0, 'colors' => $colors, 'width' => 650, 'bg_color' => 'transparent')); if (strpos($this_data, 'frm_no_data_graph') === false) { $data[$field->id] = $this_data; } unset($field, $this_data); } $entries = FrmDb::get_col($wpdb->prefix . 'frm_items', array('form_id' => $form->id), 'created_at'); // trigger the scripts to load global $frm_vars; $frm_vars['forms_loaded'][] = true; include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-statistics/show.php'; }
public static function load_css() { global $frmpro_settings; if (!is_admin()) { $use_saved = true; } include FrmAppHelper::plugin_path() . '/pro/css/custom_theme.css.php'; die; }
public static function license_settings() { $plugins = apply_filters('frm_installed_addons', array()); if (empty($plugins)) { _e('There are no plugins on your site that require a license', 'formidable'); return; } include FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php'; }
/** * Create static css file */ public function save_settings($styles) { $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; update_option('frm_last_style_update', date('njGi')); if (!is_file($filename)) { return; } $defaults = $this->get_defaults(); $uploads = wp_upload_dir(); $target_path = $uploads['basedir'] . '/formidable'; $needed_dirs = array($target_path, $target_path . '/css'); $dirs_exist = true; $saving = true; $css = '/* ' . __('WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable') . ' */' . "\n"; ob_start(); $frm_style = $this; include $filename; $css .= preg_replace('/\\/\\*(.|\\s)*?\\*\\//', '', str_replace(array("\r\n", "\r", "\n", "\t", ' '), '', ob_get_contents())); ob_end_clean(); $access_type = get_filesystem_method(); if ($access_type === 'direct') { $creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, array()); } else { $creds = $this->get_ftp_creds($access_type); } if (!empty($creds)) { // initialize the API if (!WP_Filesystem($creds)) { // any problems and we exit $dirs_exist = false; } if ($dirs_exist) { global $wp_filesystem; $chmod_dir = defined('FS_CHMOD_DIR') ? FS_CHMOD_DIR : fileperms(ABSPATH) & 0777 | 0755; $chmod_file = defined('FS_CHMOD_FILE') ? FS_CHMOD_FILE : fileperms(ABSPATH . 'index.php') & 0777 | 0644; // Create the directories if need be: foreach ($needed_dirs as $_dir) { // Only check to see if the Dir exists upon creation failure. Less I/O this way. if (!$wp_filesystem->mkdir($_dir, $chmod_dir) && !$wp_filesystem->is_dir($_dir)) { $dirs_exist = false; } } $index_path = $target_path . '/index.php'; $wp_filesystem->put_contents($index_path, "<?php\n// Silence is golden.\n?>", $chmod_file); // only write the file if the folders exist if ($dirs_exist) { $css_file = $target_path . '/css/formidablepro.css'; $wp_filesystem->put_contents($css_file, $css, $chmod_file); } } } update_option('frmpro_css', $css); delete_transient('frmpro_css'); set_transient('frmpro_css', $css); }
public static function display_form($errors = array(), $message = '') { global $frm_vars; $frm_settings = FrmAppHelper::get_settings(); $frm_roles = FrmAppHelper::frm_capabilities(); $uploads = wp_upload_dir(); $target_path = $uploads['basedir'] . '/formidable/css'; $sections = apply_filters('frm_add_settings_section', array()); $captcha_lang = FrmAppHelper::locales('captcha'); require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php'; }
public static function validate($params, $fields, $form, $title, $description) { global $frm_vars; $frm_settings = FrmAppHelper::get_settings(); if (($_POST && isset($_POST['frm_page_order_' . $form->id]) || FrmProFormsHelper::going_to_prev($form->id)) && !FrmProFormsHelper::saving_draft()) { $errors = ''; $fields = FrmFieldsHelper::get_form_fields($form->id); $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array(); require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php'; add_filter('frm_continue_to_create', '__return_false'); } else { if ($form->editable && isset($form->options['single_entry']) && $form->options['single_entry'] && $form->options['single_entry_type'] == 'user') { $user_ID = get_current_user_id(); if ($user_ID) { $entry = FrmEntry::getAll(array('it.user_id' => $user_ID, 'it.form_id' => $form->id), '', 1, true); if ($entry) { $entry = reset($entry); } } else { $entry = false; } if ($entry && !empty($entry) && (!isset($frm_vars['created_entries'][$form->id]) || !isset($frm_vars['created_entries'][$form->id]['entry_id']) || $entry->id != $frm_vars['created_entries'][$form->id]['entry_id'])) { FrmProEntriesController::show_responses($entry, $fields, $form, $title, $description); } else { $record = $frm_vars['created_entries'][$form->id]['entry_id']; $saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; if (FrmProFormsHelper::saving_draft()) { $saved_message = isset($form->options['draft_msg']) ? $form->options['draft_msg'] : __('Your draft has been saved.', 'formidable'); } $saved_message = apply_filters('frm_content', $saved_message, $form, $record ? $record : false); $message = wpautop(do_shortcode($record ? $saved_message : $frm_settings->failed_msg)); $message = '<div class="frm_message" id="message">' . $message . '</div>'; FrmProEntriesController::show_responses($record, $fields, $form, $title, $description, $message); } add_filter('frm_continue_to_create', '__return_false'); } else { if (FrmProFormsHelper::saving_draft()) { $record = isset($frm_vars['created_entries']) && isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0; if (!$record) { return; } $saved_message = ''; FrmProFormsHelper::save_draft_msg($saved_message, $form, $record); $message = FrmFormsHelper::get_success_message(array('message' => $saved_message, 'form' => $form, 'entry_id' => $record, 'class' => 'frm_message')); FrmProEntriesController::show_responses($record, $fields, $form, $title, $description, $message); add_filter('frm_continue_to_create', '__return_false'); } } } }
public function no_items() { $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; if (!empty($s)) { _e('No Entries Found', 'formidable'); return; } $form_id = $form = $this->params['form']; if ($form_id) { $form = FrmForm::getOne($form_id); } $colspan = $this->get_column_count(); include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php'; }
public function edd_plugin_updater() { $license = trim($this->license); if (!empty($license)) { if (!class_exists('EDD_SL_Plugin_Updater')) { include FrmAppHelper::plugin_path() . '/classes/models/EDD_SL_Plugin_Updater.php'; } // setup the updater $edd = new EDD_SL_Plugin_Updater($this->pro_mothership, $this->plugin_file, array('version' => $this->version, 'license' => $license, 'item_name' => $this->edd_plugin_name, 'author' => $this->author)); $this->edd = $edd; // let WordPress handle the changelog remove_filter('plugins_api', array($edd, 'plugins_api_filter'), 10, 3); } }
public static function display_form($errors = array(), $message = '') { global $frm_vars; $frm_settings = FrmAppHelper::get_settings(); $frm_roles = FrmAppHelper::frm_capabilities(); $uploads = wp_upload_dir(); $target_path = $uploads['basedir'] . '/formidable/css'; $sections = array(); if (apply_filters('frm_include_addon_page', false)) { $sections['licenses'] = array('class' => 'FrmAddonsController', 'function' => 'license_settings', 'name' => __('Plugin Licenses', 'formidable')); } $sections = apply_filters('frm_add_settings_section', $sections); $captcha_lang = FrmAppHelper::locales('captcha'); require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php'; }
public static function head() { FrmSettingsController::route('stop_load'); wp_enqueue_script('jquery-frm-themepicker'); ?> <link type="text/css" rel="stylesheet" href="http<?php echo is_ssl() ? 's' : ''; ?> ://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/themes/base/ui.all.css" /> <link href="<?php echo admin_url('admin-ajax.php'); ?> ?action=frmpro_css" type="text/css" rel="Stylesheet" class="frm-custom-theme"/> <?php require FrmAppHelper::plugin_path() . '/classes/views/shared/head.php'; }
public static function list_entries() { global $frm_entry; $frm_form = new FrmForm(); $form_select = $frm_form->getAll("is_template=0 AND (status is NULL OR status = '' OR status = 'published')", ' ORDER BY name'); $form_id = FrmAppHelper::get_param('form', false); if ($form_id) { $form = $frm_form->getOne($form_id); } else { $form = isset($form_select[0]) ? $form_select[0] : 0; } if ($form) { $entry_count = $frm_entry->getRecordCount($form->id); } include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php'; }
public static function load_admin_hooks() { add_action('admin_menu', 'FrmAppController::menu', 1); add_action('admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style'); add_action('admin_notices', 'FrmAppController::pro_get_started_headline'); add_action('admin_init', 'FrmAppController::admin_init', 11); add_filter('admin_body_class', 'FrmAppController::wp_admin_body_class'); add_filter('plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link'); register_activation_hook(FrmAppHelper::plugin_path() . '/formidable.php', 'FrmAppController::activation_install'); // Entries Controller add_action('admin_menu', 'FrmEntriesController::menu', 12); add_filter('contextual_help', 'FrmEntriesController::contextual_help', 10, 3); add_filter('set-screen-option', 'FrmEntriesController::save_per_page', 10, 3); add_filter('update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5); add_action('updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4); // Fields Controller add_filter('frm_display_field_options', 'FrmFieldsController::display_field_options'); add_action('frm_field_options_form', 'FrmFieldsController::add_conditional_update_msg', 50); // Form Actions Controller if (FrmAppHelper::is_admin_page('formidable')) { add_action('frm_before_update_form_settings', 'FrmFormActionsController::update_settings'); } add_action('frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3); // Forms Controller add_action('admin_menu', 'FrmFormsController::menu', 10); add_action('admin_head-toplevel_page_formidable', 'FrmFormsController::head'); add_filter('set-screen-option', 'FrmFormsController::save_per_page', 10, 3); add_action('admin_footer', 'FrmFormsController::insert_form_popup'); add_filter('media_buttons_context', 'FrmFormsController::insert_form_button'); // Forms Model add_action('frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2); // Settings Controller add_action('admin_menu', 'FrmSettingsController::menu', 45); add_action('frm_before_settings', 'FrmSettingsController::license_box'); // Stats Controller add_action('admin_menu', 'FrmStatisticsController::menu', 24); add_action('frm_form_action_reports', 'FrmStatisticsController::list_reports'); // Styles Controller add_action('admin_menu', 'FrmStylesController::menu', 14); add_action('admin_init', 'FrmStylesController::admin_init'); // XML Controller add_action('admin_menu', 'FrmXMLController::menu', 41); }
public static function pro_get_started_headline() { // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message if ('upgrade-plugin' == FrmAppHelper::simple_get('action', 'sanitize_title') || !current_user_can('update_plugins')) { return; } if (get_site_option('frmpro-authorized') && !file_exists(FrmAppHelper::plugin_path() . '/pro/formidable-pro.php')) { FrmAppHelper::load_admin_wide_js(); // user is authorized, but running free version $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; ?> <div class="error" class="frm_previous_install"> <?php echo wp_kses_post(apply_filters('frm_pro_update_msg', sprintf(__('This site has been previously authorized to run Formidable Forms.<br/>%1$sInstall Formidable Pro%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable'), '<a href="' . esc_url($inst_install_url) . '" target="_blank">', '</a>', '<a href="#" class="frm_deauthorize_link">', '</a>'), esc_url($inst_install_url))); ?> </div> <?php } }
function no_items() { switch ($this->plural) { case 'entries': $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; if (!empty($s)) { _e('No Entries Found', 'formidable'); } else { $frm_form = new FrmForm(); $form_id = $this->params['form']; $form = $frm_form->getOne($form_id); $colspan = $this->get_column_count(); if ($form) { include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php'; } } break; default: parent::no_items(); } }
public static function show() { global $frmdb, $frm_field, $frm_entry_meta, $frm_entry, $wpdb; if (!isset($_GET['form'])) { require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-statistics/show.php'; return; } $frm_form = new FrmForm(); $form = $frm_form->getOne($_GET['form']); $form_options = maybe_unserialize($form->options); $fields = $frm_field->getAll("fi.type not in ('divider','captcha','break','rte','textarea','file','grid','html','signature','table') and fi.form_id=" . (int) $form->id, 'field_order ASC'); $js = ''; $data = array(); $colors = '#21759B,#EF8C08,#C6C6C6'; $data['time'] = self::get_daily_entries($form, array('is3d' => true, 'colors' => $colors)); $data['month'] = self::get_daily_entries($form, array('is3d' => true, 'colors' => $colors), 'MONTH'); foreach ($fields as $field) { $data[$field->id] = self::graph_shortcode(array('id' => $field->id, 'field' => $field, 'is3d' => true, 'min' => 0, 'colors' => $colors, 'width' => 650)); unset($field); } include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-statistics/show.php'; }
?> " /> <?php echo FrmProFieldsHelper::get_file_icon($field['value']); } } include_once FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/loading.php'; } else { if ($field['type'] == 'data') { ?> <div id="frm_data_field_<?php echo $field['id']; ?> _container"> <?php require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/data-options.php'; ?> </div> <?php } else { if ($field['type'] == 'form') { echo 'FRONT FORM'; } } } } } } } } }
public function form($form_action, $args = array()) { extract($args); include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php'; }
public static function fill_action() { check_ajax_referer('frm_ajax', 'nonce'); $action_key = absint($_POST['action_id']); $action_type = sanitize_text_field($_POST['action_type']); $action_control = self::get_form_actions($action_type); if (empty($action_control)) { wp_die(); } $form_action = $action_control->get_single_action($action_key); $values = array(); $form = self::fields_to_values($form_action->menu_order, $values); include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php'; wp_die(); }
public static function import_options() { check_ajax_referer('frm_ajax', 'nonce'); if (!is_admin() || !current_user_can('frm_edit_forms')) { return; } $field_id = absint($_POST['field_id']); $field = FrmField::getOne($field_id); if (!in_array($field->type, array('radio', 'checkbox', 'select'))) { return; } $field = FrmFieldsHelper::setup_edit_vars($field); $opts = stripslashes_deep($_POST['opts']); $opts = explode("\n", rtrim($opts, "\n")); if ($field['separate_value']) { foreach ($opts as $opt_key => $opt) { if (strpos($opt, '|') !== false) { $vals = explode('|', $opt); if ($vals[0] != $vals[1]) { $opts[$opt_key] = array('label' => trim($vals[0]), 'value' => trim($vals[1])); } unset($vals); } unset($opt_key, $opt); } } //Keep other options after bulk update if (isset($field['field_options']['other']) && $field['field_options']['other'] == true) { $other_array = array(); foreach ($field['options'] as $opt_key => $opt) { if ($opt_key && strpos($opt_key, 'other') !== false) { $other_array[$opt_key] = $opt; } unset($opt_key, $opt); } if (!empty($other_array)) { $opts = array_merge($opts, $other_array); } } FrmField::update($field_id, array('options' => maybe_serialize($opts))); $field['options'] = $opts; $field_name = $field['name']; // Get html_id which will be used in single-option.php $html_id = FrmFieldsHelper::get_html_id($field); if ($field['type'] == 'radio' || $field['type'] == 'checkbox') { require FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php'; } else { FrmFieldsHelper::show_single_option($field); } wp_die(); }
?> " <?php do_action('frm_field_input_html', $field); ?> /> <?php if ($field['default_value']) { ?> <img src="<?php echo $field['default_value']; ?> " height="50px"><?php } } else { if ($field['type'] == 'scale') { require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/10radio.php'; } else { if ($field['type'] == 'rte') { /* <div id="<?php //echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"> <?php //the_editor($field['default_value'], $field_name, 'title', false); ?> </div> */ ?> <div class="frm_rte"> <p class="howto"><?php _e('These buttons are for illustrative purposes only. They will be functional in your form.', 'formidable'); ?> </p> <textarea name="<?php echo $field_name;
public static function load_saved_css() { $css = get_transient('frmpro_css'); include FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; wp_die(); }
if ($field['type'] == 'radio' || $field['type'] == 'checkbox') { $field['default_value'] = maybe_unserialize($field['default_value']); if (isset($field['post_field']) && $field['post_field'] == 'post_category') { do_action('frm_after_checkbox', array('field' => $field, 'field_name' => $field_name, 'type' => $field['type'])); } else { do_action('frm_add_multiple_opts_labels', $field); ?> <ul id="frm_field_<?php echo esc_attr($field['id']); ?> _opts" class="frm_sortable_field_opts frm_clear<?php echo count($field['options']) > 10 ? ' frm_field_opts_list' : ''; ?> "> <?php include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php'; ?> </ul> <?php } } else { if ($field['type'] == 'select') { if (isset($field['post_field']) && $field['post_field'] == 'post_category') { echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field)); } else { ?> <select name="<?php echo esc_attr($field_name) . (FrmField::is_option_true($field, 'multiple') ? '[]' : ''); ?> " <?php echo FrmField::is_option_true($field, 'size') ? 'class="auto_width"' : '';
</select> <span id="frm_show_selected_values_<?php echo esc_attr($key . '_' . $meta_name); ?> "> <?php if ($condition['hide_field'] && is_numeric($condition['hide_field'])) { $new_field = FrmField::getOne($condition['hide_field']); } $val = isset($condition['hide_opt']) ? $condition['hide_opt'] : ''; if (!isset($field)) { $field = array('hide_opt' => array($meta_name => $val)); } $field_name = $names['hide_opt']; require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/field-values.php'; ?> </span> <a href="javascript:void(0)" class="frm_remove_tag frm_icon_font" data-removeid="<?php echo esc_attr($id); ?> " <?php echo !empty($showlast) ? 'data-showlast="' . esc_attr($showlast) . '"' : ''; ?> ></a> <a href="javascript:void(0)" class="frm_add_tag frm_icon_font frm_add_<?php echo esc_attr($type); ?> _logic" data-emailkey="<?php echo esc_attr($key); ?>
public static function generate_xml($type, $args = array()) { global $wpdb; $type = (array) $type; if (in_array('items', $type) && !in_array('forms', $type)) { // make sure the form is included if there are entries $type[] = 'forms'; } if (in_array('forms', $type)) { // include actions with forms $type[] = 'actions'; } $tables = array('items' => $wpdb->prefix . 'frm_items', 'forms' => $wpdb->prefix . 'frm_forms', 'posts' => $wpdb->posts, 'styles' => $wpdb->posts, 'actions' => $wpdb->posts); $defaults = array('ids' => false); $args = wp_parse_args($args, $defaults); $sitename = sanitize_key(get_bloginfo('name')); if (!empty($sitename)) { $sitename .= '.'; } $filename = $sitename . 'formidable.' . date('Y-m-d') . '.xml'; header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=' . $filename); header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); //make sure ids are numeric if (is_array($args['ids']) && !empty($args['ids'])) { $args['ids'] = array_filter($args['ids'], 'is_numeric'); } $records = array(); foreach ($type as $tb_type) { $where = array(); $join = ''; $table = $tables[$tb_type]; $select = $table . '.id'; $query_vars = array(); switch ($tb_type) { case 'forms': //add forms if ($args['ids']) { $where[] = array('or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids']); } else { $where[$table . '.status !'] = 'draft'; } break; case 'actions': $select = $table . '.ID'; $where['post_type'] = FrmFormActionsController::$action_post_type; if (!empty($args['ids'])) { $where['menu_order'] = $args['ids']; } break; case 'items': //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; if ($args['ids']) { $where[$table . '.form_id'] = $args['ids']; } break; case 'styles': // Loop through all exported forms and get their selected style IDs $form_ids = $args['ids']; $style_ids = array(); foreach ($form_ids as $form_id) { $form_data = FrmForm::getOne($form_id); // For forms that have not been updated while running 2.0, check if custom_style is set if (isset($form_data->options['custom_style'])) { $style_ids[] = $form_data->options['custom_style']; } unset($form_id, $form_data); } $select = $table . '.ID'; $where['post_type'] = 'frm_styles'; // Only export selected styles if (!empty($style_ids)) { $where['ID'] = $style_ids; } break; default: $select = $table . '.ID'; $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; $where['pm.meta_key'] = 'frm_form_id'; if (empty($args['ids'])) { $where['pm.meta_value >'] = 1; } else { $where['pm.meta_value'] = $args['ids']; } break; } $records[$tb_type] = FrmDb::get_col($table . $join, $where, $select); unset($tb_type); } echo '<?xml version="1.0" encoding="' . esc_attr(get_bloginfo('charset')) . "\" ?>\n"; include FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php'; }
if ($values['custom_style']) { $frm_vars['load_css'] = true; } if ((!isset($frm_vars['css_loaded']) || !$frm_vars['css_loaded']) && $frm_vars['load_css']) { echo FrmAppController::footer_js('header'); $frm_vars['css_loaded'] = true; } ?> <div class="frm_forms<?php echo $values['custom_style'] ? ' with_frm_style' : ''; ?> " id="frm_form_<?php echo $form->id; ?> _container"><?php require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php'; ?> </div> <?php } } else { do_action('frm_success_action', $conf_method, $form, $form->options, $created); } do_action('frm_after_entry_processed', array('entry_id' => $created, 'form' => $form)); } else { do_action('frm_display_form_action', $params, $fields, $form, $title, $description); if (apply_filters('frm_continue_to_new', true, $form->id, $params['action'])) { $values = FrmEntriesHelper::setup_new_vars($fields, $form); require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php'; } }
function validate($values, $exclude = false) { global $wpdb, $frm_field, $frm_entry_meta, $frm_settings; $errors = array(); if (!isset($values['form_id']) || !isset($values['item_meta'])) { $errors['form'] = __('There was a problem with your submission. Please try again.', 'formidable'); return $errors; } if (is_admin() && is_user_logged_in() && (!isset($values['frm_submit_entry_' . $values['form_id']]) || !wp_verify_nonce($values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce'))) { $errors['form'] = __('You do not have permission to do that', 'formidable'); } if (!isset($values['item_key']) or $values['item_key'] == '') { $_POST['item_key'] = $values['item_key'] = FrmAppHelper::get_unique_key('', $wpdb->prefix . 'frm_items', 'item_key'); } $where = apply_filters('frm_posted_field_ids', 'fi.form_id=' . (int) $values['form_id']); if ($exclude) { $where .= " and fi.type not in ('" . implode("','", array_filter($exclude, 'esc_sql')) . "')"; } $posted_fields = $frm_field->getAll($where, 'field_order'); foreach ($posted_fields as $posted_field) { $posted_field->field_options = maybe_unserialize($posted_field->field_options); $value = ''; if (isset($values['item_meta'][$posted_field->id])) { $value = $values['item_meta'][$posted_field->id]; } if (isset($posted_field->field_options['default_blank']) and $posted_field->field_options['default_blank'] and $value == $posted_field->default_value) { $value = ''; } if (is_array($value) and count($value) === 1) { $value = reset($value); } if ($posted_field->type == 'rte' and !is_array($value) and trim($value) == '<br>') { $value = ''; } if ($posted_field->required == '1' and !is_array($value) and trim($value) == '') { $errors['field' . $posted_field->id] = (!isset($posted_field->field_options['blank']) or $posted_field->field_options['blank'] == '' or $posted_field->field_options['blank'] == 'Untitled cannot be blank') ? $frm_settings->blank_msg : $posted_field->field_options['blank']; } else { if ($posted_field->type == 'text' and !isset($_POST['name'])) { $_POST['name'] = $value; } } $_POST['item_meta'][$posted_field->id] = $value; if ($posted_field->type == 'captcha' and isset($_POST['recaptcha_challenge_field'])) { global $frm_settings; if (!function_exists('recaptcha_check_answer')) { require FrmAppHelper::plugin_path() . '/classes/recaptchalib.php'; } $response = recaptcha_check_answer($frm_settings->privkey, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']); if (!$response->is_valid) { // What happens when the CAPTCHA was entered incorrectly $errors['captcha-' . $response->error] = $errors['field' . $posted_field->id] = (!isset($posted_field->field_options['invalid']) or $posted_field->field_options['invalid'] == '') ? $frm_settings->re_msg : $posted_field->field_options['invalid']; } } $errors = apply_filters('frm_validate_field_entry', $errors, $posted_field, $value); } // check for spam if (empty($exclude) && isset($values['item_meta']) && !empty($values['item_meta']) && empty($errors)) { global $wpcom_api_key; if ((function_exists('akismet_http_post') || is_callable('Akismet::http_post')) && (get_option('wordpress_api_key') || $wpcom_api_key) && $this->akismet($values)) { $frm_form = new FrmForm(); $form = $frm_form->getOne($values['form_id']); if (isset($form->options['akismet']) && !empty($form->options['akismet']) && ($form->options['akismet'] != 'logged' || !is_user_logged_in())) { $errors['spam'] = __('Your entry appears to be spam!', 'formidable'); } } // check for blacklist keys if ($this->blacklist_check($values)) { $errors['spam'] = __('Your entry appears to be spam!', 'formidable'); } } $errors = apply_filters('frm_validate_entry', $errors, $values); return $errors; }
<div id="form_views_page" class="wrap"> <div class="frmicon icon32"><br/></div> <h2> <?php _e('Views', 'formidable'); ?> <a href="#" class="add-new-h2" style="visibility:hidden;"><?php _e('Add New', 'formidable'); ?> </a> </h2> <?php if ($form) { FrmAppController::get_form_nav($form); } require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; FrmAppController::update_message('display collected data in lists, calendars, and other formats'); ?> <img src="http://fp.strategy11.com/images/custom-display-settings.png" alt="Display" style="max-width:100%"/> </div>
<div id="postbox-container-1" class="postbox-container"> <?php $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action'; $action = FrmAppHelper::get_param($action, '', 'get', 'sanitize_title'); $button = $action == 'new' || $action == 'duplicate' ? __('Create', 'formidable') : __('Update', 'formidable'); include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php'; ?> <div id="frm_position_ele"></div> <div class="postbox frm_field_list"> <div class="inside"> <div id="taxonomy-linkcategory" class="categorydiv"> <ul id="category-tabs" class="category-tabs frm-category-tabs"> <li class="tabs" ><a href="#frm-insert-fields" id="frm_insert_fields_tab"><?php _e('Fields', 'formidable'); ?> </a></li> <li class="hide-if-no-js"><a href="#frm-layout-classes" id="frm_layout_classes_tab" class="frm_help" title="<?php esc_attr_e('Open the Field Options and click on the CSS Layout Classes option to enable this tab', 'formidable'); ?> "><?php _e('Layout', 'formidable'); ?> </a></li> <?php do_action('frm_extra_form_instruction_tabs'); ?> </ul>
<?php } ?> <?php do_action('frm_add_form_option_section', $values); ?> <div class="clear"></div> </div> </div> </div> </div> <p> <input type="submit" value="<?php esc_attr_e('Update', 'formidable'); ?> " class="button-primary" /> </p> </form> </div> <?php require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/sidebar-settings.php'; ?> </div> </div> </div>
</a> </li> <?php if (isset($ldfe)) { ?> <li class="frm_col_two"> <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($dfe . ' show="' . $ldfe . '"'); ?> "><?php _e('Field From Entry', 'formidable'); ?> </a> </li> <?php } ?> </ul> <?php } ?> </div> <?php if ($settings_tab) { include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php'; } ?> </div>