示例#1
0
 /**
  * Prepares a Form Preview
  */
 public function prepare_form_preview()
 {
     $form_id = (int) $_POST['mc4wp_form_id'];
     $previewer = new MC4WP_Form_Previewer($form_id, true);
     // get data
     $form_data = stripslashes_deep($_POST['mc4wp_form']);
     $form_data['ID'] = $previewer->get_preview_id();
     $form_data['status'] = 'draft';
     // save as new post & update preview id
     $preview_id = $this->save_form($form_data);
     $previewer->set_preview_id($preview_id);
     // redirect to preview
     wp_redirect($previewer->get_preview_url());
     exit;
 }
 /**
  * Prepares a Form Preview
  */
 public function prepare_form_preview()
 {
     $form_id = (int) $_POST['mc4wp_form_id'];
     $preview_id = (int) get_option('mc4wp_form_preview_id', 0);
     // get data
     $form_data = stripslashes_deep($_POST['mc4wp_form']);
     $form_data['ID'] = $preview_id;
     $form_data['status'] = 'preview';
     $real_preview_id = $this->save_form($form_data);
     if ($real_preview_id != $preview_id) {
         update_option('mc4wp_form_preview_id', $real_preview_id, false);
     }
     // redirect to preview
     $previewer = new MC4WP_Form_Previewer($form_id, $real_preview_id);
     wp_redirect($previewer->get_preview_url());
     exit;
 }