当前位置: 首页>>代码示例>>PHP>>正文


PHP FrmFormsHelper::get_success_message方法代码示例

本文整理汇总了PHP中FrmFormsHelper::get_success_message方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFormsHelper::get_success_message方法的具体用法?PHP FrmFormsHelper::get_success_message怎么用?PHP FrmFormsHelper::get_success_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrmFormsHelper的用法示例。


在下文中一共展示了FrmFormsHelper::get_success_message方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 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');
             }
         }
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:51,代码来源:FrmProEntry.php

示例2: get_form_contents

 public static function get_form_contents($form, $title, $description, $atts)
 {
     global $frm_vars;
     $frm_settings = FrmAppHelper::get_settings();
     $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
     $user_ID = get_current_user_id();
     $params = FrmForm::get_params($form);
     $message = $errors = '';
     if ($params['posted_form_id'] == $form->id && $_POST) {
         $errors = isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
     }
     $include_form_tag = apply_filters('frm_include_form_tag', true, $form);
     $fields = FrmFieldsHelper::get_form_fields($form->id, isset($errors) && !empty($errors));
     if ($params['action'] != 'create' || $params['posted_form_id'] != $form->id || !$_POST) {
         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);
             include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
         }
         return;
     }
     if (!empty($errors)) {
         $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
         include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
         return;
     }
     do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
     if (!apply_filters('frm_continue_to_create', true, $form->id)) {
         return;
     }
     $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
     $created = isset($frm_vars['created_entries']) && isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
     $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
     if ($created && is_numeric($created) && $conf_method != 'message') {
         do_action('frm_success_action', $conf_method, $form, $form->options, $created);
         do_action('frm_after_entry_processed', array('entry_id' => $created, 'form' => $form));
         return;
     }
     if ($created && is_numeric($created)) {
         $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
         $class = 'frm_message';
     } else {
         $message = $frm_settings->failed_msg;
         $class = 'frm_error_style';
     }
     $message = FrmFormsHelper::get_success_message(array('message' => $message, 'form' => $form, 'entry_id' => $created, 'class' => $class));
     $message = apply_filters('frm_main_feedback', $message, $form, $created);
     if (!isset($form->options['show_form']) || $form->options['show_form']) {
         require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php';
     } else {
         global $frm_vars;
         self::maybe_load_css($form, $values['custom_style'], $frm_vars['load_css']);
         $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class($values);
         include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php';
     }
     do_action('frm_after_entry_processed', array('entry_id' => $created, 'form' => $form));
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:57,代码来源:FrmFormsController.php

示例3: confirmation

 public static function confirmation($method, $form, $form_options, $entry_id, $args = array())
 {
     $opt = !isset($args['action']) || $args['action'] == 'create' ? 'success' : 'edit';
     if ($method == 'page' && is_numeric($form_options[$opt . '_page_id'])) {
         global $post;
         if (!$post || $form_options[$opt . '_page_id'] != $post->ID) {
             $page = get_post($form_options[$opt . '_page_id']);
             $old_post = $post;
             $post = $page;
             $content = apply_filters('frm_content', $page->post_content, $form, $entry_id);
             echo apply_filters('the_content', $content);
             $post = $old_post;
         }
     } else {
         if ($method == 'redirect') {
             global $frm_vars;
             add_filter('frm_use_wpautop', '__return_false');
             $success_url = apply_filters('frm_content', trim($form_options[$opt . '_url']), $form, $entry_id);
             $success_msg = isset($form_options[$opt . '_msg']) ? $form_options[$opt . '_msg'] : __('Please wait while you are redirected.', 'formidable');
             $redirect_msg = '<div class="' . esc_attr(FrmFormsHelper::get_form_style_class($form)) . '"><div class="frm-redirect-msg frm_message">' . $success_msg . '<br/>' . sprintf(__('%1$sClick here%2$s if you are not automatically redirected.', 'formidable'), '<a href="' . esc_url($success_url) . '">', '</a>') . '</div></div>';
             $redirect_msg = apply_filters('frm_redirect_msg', $redirect_msg, array('entry_id' => $entry_id, 'form_id' => $form->id, 'form' => $form));
             $args['id'] = $entry_id;
             add_filter('frm_redirect_url', 'FrmProEntriesController::redirect_url');
             //delete the entry on frm_redirect_url hook
             $success_url = apply_filters('frm_redirect_url', $success_url, $form, $args);
             $doing_ajax = FrmAppHelper::doing_ajax();
             if (isset($args['ajax']) && $args['ajax'] && $doing_ajax) {
                 echo json_encode(array('redirect' => $success_url));
                 die;
             } else {
                 if (!$doing_ajax && !headers_sent()) {
                     wp_redirect(esc_url_raw($success_url));
                     die;
                 }
             }
             add_filter('frm_use_wpautop', '__return_true');
             $response = $redirect_msg;
             $response .= "<script type='text/javascript'>jQuery(document).ready(function(){ setTimeout(window.location='" . esc_url_raw($success_url) . "', 8000); });</script>";
             if (headers_sent()) {
                 echo $response;
             } else {
                 wp_redirect(esc_url_raw($success_url));
                 die;
             }
         } else {
             $frm_settings = FrmAppHelper::get_settings();
             $frmpro_settings = FrmProAppHelper::get_settings();
             $msg = $opt == 'edit' ? $frmpro_settings->edit_msg : $frm_settings->success_msg;
             $message = isset($form->options[$opt . '_msg']) ? $form->options[$opt . '_msg'] : $msg;
             // Replace $message with save draft message if we are saving a draft
             FrmProFormsHelper::save_draft_msg($message, $form);
             $class = 'frm_message';
             $message = FrmFormsHelper::get_success_message(compact('message', 'form', 'entry_id', 'class'));
             return $message;
         }
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:57,代码来源:FrmProEntriesController.php


注:本文中的FrmFormsHelper::get_success_message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。