<?php global $frm_form, $frm_field, $frm_entry, $frm_entry_meta, $user_ID, $frm_settings, $frm_created_entry, $frm_form_params; $form_name = $form->name; $form->options = stripslashes_deep(maybe_unserialize($form->options)); $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; $saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; $params = FrmEntriesController::get_params($form); $message = $errors = ''; FrmEntriesHelper::enqueue_scripts($params); if ($params['action'] == 'create' and $params['posted_form_id'] == $form->id and isset($_POST)) { $errors = $frm_created_entry[$form->id]['errors']; if (!empty($errors)) { $fields = FrmFieldsHelper::get_form_fields($form->id, true); $values = FrmEntriesHelper::setup_new_vars($fields, $form); require FRM_VIEWS_PATH . '/frm-entries/new.php'; ?> <script type="text/javascript">window.onload = function(){var frm_pos=jQuery('#form_<?php echo $form->form_key; ?> ').offset(); var cOff = document.documentElement.scrollTop || document.body.scrollTop; if(cOff > frm_pos.top) window.scrollTo(frm_pos.left,frm_pos.top);}</script><?php } else { $fields = FrmFieldsHelper::get_form_fields($form->id); do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description); if (apply_filters('frm_continue_to_create', true, $form->id)) { $values = FrmEntriesHelper::setup_new_vars($fields, $form, true); $created = $frm_created_entry[$form->id]['entry_id']; $saved_message = apply_filters('frm_content', $saved_message, $form, $created); $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options); if (!$created or !is_numeric($created) or $conf_method == 'message') { $message = '<div class="frm_message" id="message">' . (($created and is_numeric($created)) ? wpautop(do_shortcode($saved_message)) : $frm_settings->failed_msg) . '</div>';
public static function get_form($form, $title, $description, $atts = array()) { global $frm_field, $frm_entry, $frm_entry_meta, $frm_settings, $frm_vars; $form_name = $form->name; $frm_form = new FrmForm(); $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value; $saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg; $user_ID = get_current_user_id(); $params = FrmEntriesController::get_params($form); $message = $errors = ''; FrmEntriesHelper::enqueue_scripts($params); if ($params['posted_form_id'] == $form->id && $_POST) { $errors = isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['errors'] : array(); } $fields = FrmFieldsHelper::get_form_fields($form->id, isset($errors) && !empty($errors)); $filename = FrmAppHelper::plugin_path() . '/classes/views/frm-entries/frm-entry.php'; if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); // check if minimizing is turned on if (isset($atts['minimize']) && !empty($atts['minimize'])) { $contents = str_replace(array("\r\n", "\r", "\n", "\t", " "), '', $contents); } return $contents; } return false; }