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


PHP FrmAppHelper::js_redirect方法代码示例

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


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

示例1: create

 public static function create($values = array())
 {
     FrmAppHelper::permission_check('frm_edit_forms');
     global $frm_vars;
     if (empty($values)) {
         $values = $_POST;
     }
     //Set radio button and checkbox meta equal to "other" value
     if (FrmAppHelper::pro_is_installed()) {
         $values = FrmProEntry::mod_other_vals($values, 'back');
     }
     $id = isset($values['id']) ? absint($values['id']) : FrmAppHelper::get_param('id', '', 'get', 'absint');
     if (!current_user_can('frm_edit_forms') || $_POST && (!isset($values['frm_save_form']) || !wp_verify_nonce($values['frm_save_form'], 'frm_save_form_nonce'))) {
         $frm_settings = FrmAppHelper::get_settings();
         $errors = array('form' => $frm_settings->admin_permission);
     } else {
         $errors = FrmForm::validate($values);
     }
     if (count($errors) > 0) {
         $hide_preview = true;
         $frm_field_selection = FrmField::field_selection();
         $form = FrmForm::getOne($id);
         $fields = FrmField::get_all_for_form($id);
         $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
         $all_templates = FrmForm::getAll(array('is_template' => 1), 'name');
         require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php';
     } else {
         FrmForm::update($id, $values, true);
         die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id=' . $id)));
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:31,代码来源:FrmFormsController.php

示例2: display_list

 public static function display_list($message = '', $errors = array())
 {
     global $wpdb, $frm_vars;
     $form = FrmForm::get_current_form();
     $params = FrmForm::get_admin_params($form);
     if ($form) {
         $params['form'] = $form->id;
         $frm_vars['current_form'] = $form;
         if ('trash' == $form->status) {
             $delete_timestamp = time() - DAY_IN_SECONDS * EMPTY_TRASH_DAYS;
             $time_to_delete = FrmAppHelper::human_time_diff($delete_timestamp, isset($form->options['trash_time']) ? $form->options['trash_time'] : time());
             $errors['trash'] = sprintf(__('This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable'), $time_to_delete);
             unset($time_to_delete, $delete_timestamp);
         }
     }
     $table_class = apply_filters('frm_entries_list_class', 'FrmEntriesListHelper');
     $wp_list_table = new $table_class(array('params' => $params));
     $pagenum = $wp_list_table->get_pagenum();
     $wp_list_table->prepare_items();
     $total_pages = $wp_list_table->get_pagination_arg('total_pages');
     if ($pagenum > $total_pages && $total_pages > 0) {
         $url = add_query_arg('paged', $total_pages);
         if (headers_sent()) {
             echo FrmAppHelper::js_redirect($url);
         } else {
             wp_redirect(esc_url_raw($url));
         }
         die;
     }
     if (empty($message) && isset($_GET['import-message'])) {
         $message = __('Your import is complete', 'formidable');
     }
     require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php';
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:34,代码来源:FrmEntriesController.php

示例3: create

 public static function create($values = false)
 {
     global $frm_entry, $frm_field, $frm_vars;
     if (!$values) {
         $values = $_POST;
     }
     if (!current_user_can('frm_edit_forms') || $_POST && (!isset($values['frm_save_form']) || !wp_verify_nonce($values['frm_save_form'], 'frm_save_form_nonce'))) {
         global $frm_settings;
         $errors['form'] = $frm_settings->admin_permission;
     }
     $id = isset($values['id']) ? (int) $values['id'] : (int) FrmAppHelper::get_param('id');
     $frm_form = new FrmForm();
     $errors = $frm_form->validate($values);
     if (count($errors) > 0) {
         $hide_preview = true;
         $frm_field_selection = FrmFieldsHelper::field_selection();
         $form = $frm_form->getOne($id);
         $fields = $frm_field->getAll(array('fi.form_id' => $id), 'field_order');
         $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
         require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php';
     } else {
         $form = $frm_form->update($id, $values, true);
         die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id=' . $id)));
         //$message = __('Form was Successfully Created', 'formidable');
         //return self::settings($record, $message);
     }
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:27,代码来源:FrmFormsController.php

示例4: display_list

 public static function display_list($params = array(), $message = '', $errors = array())
 {
     global $wpdb, $frmdb, $frm_entry, $frm_entry_meta, $frm_field, $frm_vars;
     if (empty($params)) {
         $params = self::get_params();
     }
     $errors = array();
     $frm_form = new FrmForm();
     $form_select = $frm_form->getAll("is_template=0 AND (status is NULL OR status = '' OR status = 'published')", ' ORDER BY name');
     if ($params['form']) {
         $form = $frm_form->getOne($params['form']);
     } else {
         $form = isset($form_select[0]) ? $form_select[0] : 0;
     }
     if ($form) {
         $params['form'] = $form->id;
         $frm_vars['current_form'] = $form;
         $where_clause = " it.form_id={$form->id}";
     } else {
         $where_clause = '';
     }
     require FrmAppHelper::plugin_path() . '/pro/classes/helpers/FrmProListHelper.php';
     $wp_list_table = new FrmProListHelper(array('singular' => 'entry', 'plural' => 'entries', 'table_name' => $frmdb->entries, 'page_name' => 'entries', 'params' => $params));
     $pagenum = $wp_list_table->get_pagenum();
     $wp_list_table->prepare_items();
     $total_pages = $wp_list_table->get_pagination_arg('total_pages');
     if ($pagenum > $total_pages && $total_pages > 0) {
         $url = add_query_arg('paged', $total_pages);
         if (headers_sent()) {
             echo FrmAppHelper::js_redirect($url);
         } else {
             wp_redirect($url);
         }
         die;
     }
     if (empty($message) && isset($_GET['import-message'])) {
         $message = __('Your import is complete', 'formidable');
     }
     require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/list.php';
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:40,代码来源:FrmProEntriesController.php

示例5: get_display_data

 public static function get_display_data($display, $content = '', $entry_id = false, $extra_atts = array())
 {
     global $frmpro_display, $frm_entry, $frmpro_settings, $frm_entry_meta, $frm_vars, $post;
     $frm_vars['forms_loaded'][] = true;
     if (!isset($display->frm_form_id)) {
         $display = FrmProDisplaysHelper::setup_edit_vars($display, false);
     }
     if (!isset($display->frm_form_id) or empty($display->frm_form_id)) {
         return $content;
     }
     // check if entry needs to be deleted before loading entries
     if (FrmAppHelper::get_param('frm_action') == 'destroy' && isset($_GET['entry'])) {
         $deleted = FrmProEntriesController::ajax_destroy($display->frm_form_id, false, false);
         if (!empty($deleted)) {
             $message = '<div class="with_frm_style"><div class="frm_message">' . $deleted . '</div></div>';
         }
         unset($_GET['entry']);
     }
     //for backwards compatability
     $display->id = $display->frm_old_id;
     $display->display_key = $display->post_name;
     $defaults = array('filter' => false, 'user_id' => '', 'limit' => '', 'page_size' => '', 'order_by' => '', 'order' => '', 'drafts' => false, 'auto_id' => '');
     extract(wp_parse_args($extra_atts, $defaults));
     //if (FrmProAppHelper::rewriting_on() && $frmpro_settings->permalinks )
     //    self::parse_pretty_entry_url();
     if ($display->frm_show_count == 'one' and is_numeric($display->frm_entry_id) and $display->frm_entry_id > 0 and !$entry_id) {
         $entry_id = $display->frm_entry_id;
     }
     $entry = false;
     $show = 'all';
     global $wpdb, $frmpro_entry;
     $where = $wpdb->prepare('it.form_id=%d', $display->frm_form_id);
     if (in_array($display->frm_show_count, array('dynamic', 'calendar', 'one'))) {
         $one_param = isset($_GET['entry']) ? $_GET['entry'] : $auto_id;
         $get_param = isset($_GET[$display->frm_param]) ? $_GET[$display->frm_param] : ($display->frm_show_count == 'one' ? $one_param : $auto_id);
         unset($one_param);
         if ($get_param) {
             if (($display->frm_type == 'id' or $display->frm_show_count == 'one') and is_numeric($get_param)) {
                 $where .= $wpdb->prepare(' AND it.id=%d', $get_param);
             } else {
                 $where .= $wpdb->prepare(' AND it.item_key=%s', $get_param);
             }
             $entry = $frm_entry->getAll($where, '', 1, 0);
             if ($entry) {
                 $entry = reset($entry);
             }
             if ($entry and $entry->post_id) {
                 //redirect to single post page if this entry is a post
                 if (in_the_loop() and $display->frm_show_count != 'one' and !is_single($entry->post_id) and $post->ID != $entry->post_id) {
                     $this_post = get_post($entry->post_id);
                     if (in_array($this_post->post_status, array('publish', 'private'))) {
                         die(FrmAppHelper::js_redirect(get_permalink($entry->post_id)));
                     }
                 }
             }
         }
         unset($get_param);
     }
     if ($entry and in_array($display->frm_show_count, array('dynamic', 'calendar'))) {
         $new_content = $display->frm_dyncontent;
         $show = 'one';
     } else {
         $new_content = $display->post_content;
     }
     $show = $display->frm_show_count == 'one' ? 'one' : $show;
     $shortcodes = FrmProDisplaysHelper::get_shortcodes($new_content, $display->frm_form_id);
     //don't let page size and limit override single entry displays
     if ($display->frm_show_count == 'one') {
         $display->frm_page_size = $display->frm_limit = '';
     }
     //don't keep current content if post type is frm_display
     if ($post and $post->post_type == 'frm_display') {
         $display->frm_insert_loc = '';
     }
     $pagination = '';
     $is_draft = !empty($drafts) ? 1 : 0;
     $form_query = $wpdb->prepare("SELECT id, post_id FROM {$wpdb->prefix}frm_items WHERE form_id=%d and post_id>%d", $display->frm_form_id, 1);
     if ($drafts != 'both') {
         $form_query .= $wpdb->prepare(' AND is_draft=%d', $is_draft);
     }
     if ($entry and $entry->form_id == $display->frm_form_id) {
         $form_query .= $wpdb->prepare(' AND id=%d', $entry->id);
         $form_posts = $wpdb->get_results($form_query);
         $entry_ids = array($entry->id);
     } else {
         $form_posts = $wpdb->get_results($form_query);
         //Only get $entry_ids if filters are set or if frm_search parameter is set
         if (isset($display->frm_where) && !empty($display->frm_where) && (!$entry || !$post || empty($auto_id)) || isset($_GET['frm_search'])) {
             $entry_query = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $display->frm_form_id);
             if ($drafts != 'both') {
                 $entry_query .= $wpdb->prepare(" AND is_draft=%d", $is_draft);
             }
             $entry_ids = $wpdb->get_col($entry_query);
             unset($entry_query);
         }
     }
     unset($form_query);
     $empty_msg = (isset($display->frm_empty_msg) and !empty($display->frm_empty_msg)) ? '<div class="frm_no_entries">' . FrmProFieldsHelper::get_default_value($display->frm_empty_msg, false, true, true) . '</div>' : '';
     if (isset($message)) {
         // if an entry was deleted above, show a message
//.........这里部分代码省略.........
开发者ID:amit0773,项目名称:manaslake,代码行数:101,代码来源:FrmProDisplaysController.php

示例6: get_display_data

 public static function get_display_data($display, $content = '', $entry_id = false, $extra_atts = array())
 {
     if (post_password_required($display)) {
         return get_the_password_form($display);
     }
     add_action('frm_load_view_hooks', 'FrmProDisplaysController::trigger_load_view_hooks');
     FrmAppHelper::trigger_hook_load('view', $display);
     global $frm_vars, $post;
     $frm_vars['forms_loaded'][] = true;
     if (!isset($display->frm_empty_msg)) {
         $display = FrmProDisplaysHelper::setup_edit_vars($display, false);
     }
     if (!isset($display->frm_form_id) || empty($display->frm_form_id)) {
         return $content;
     }
     //for backwards compatability
     $display->id = $display->frm_old_id;
     $display->display_key = $display->post_name;
     $defaults = array('filter' => false, 'user_id' => '', 'limit' => '', 'page_size' => '', 'order_by' => '', 'order' => '', 'drafts' => false, 'auto_id' => '');
     $extra_atts = wp_parse_args($extra_atts, $defaults);
     extract($extra_atts);
     //if (FrmProAppHelper::rewriting_on() && $frmpro_settings->permalinks )
     //    self::parse_pretty_entry_url();
     if ($display->frm_show_count == 'one' && is_numeric($display->frm_entry_id) && $display->frm_entry_id > 0 && !$entry_id) {
         $entry_id = $display->frm_entry_id;
     }
     $entry = false;
     $show = 'all';
     // Don't filter with $entry_ids by default because the query gets too long.
     // Only filter with $entry_ids when showing one entry
     $use_ids = false;
     global $wpdb;
     $where = array('it.form_id' => $display->frm_form_id);
     if (in_array($display->frm_show_count, array('dynamic', 'calendar', 'one'))) {
         $one_param = FrmAppHelper::simple_get('entry', 'sanitize_title', $extra_atts['auto_id']);
         $get_param = FrmAppHelper::simple_get($display->frm_param, 'sanitize_title', $display->frm_show_count == 'one' ? $one_param : $extra_atts['auto_id']);
         unset($one_param);
         if ($get_param) {
             if (($display->frm_type == 'id' || $display->frm_show_count == 'one') && is_numeric($get_param)) {
                 $where['it.id'] = $get_param;
             } else {
                 $where['it.item_key'] = $get_param;
             }
             $entry = FrmEntry::getAll($where, '', 1, 0);
             if ($entry) {
                 $entry = reset($entry);
             }
             if ($entry && $entry->post_id) {
                 //redirect to single post page if this entry is a post
                 if (in_the_loop() && $display->frm_show_count != 'one' && !is_single($entry->post_id) && $post->ID != $entry->post_id) {
                     $this_post = get_post($entry->post_id);
                     if (in_array($this_post->post_status, array('publish', 'private'))) {
                         die(FrmAppHelper::js_redirect(get_permalink($entry->post_id)));
                     }
                 }
             }
         }
         unset($get_param);
     }
     if ($entry && in_array($display->frm_show_count, array('dynamic', 'calendar'))) {
         $new_content = $display->frm_dyncontent;
         $show = 'one';
     } else {
         $new_content = $display->post_content;
     }
     $show = $display->frm_show_count == 'one' ? 'one' : $show;
     $shortcodes = FrmProDisplaysHelper::get_shortcodes($new_content, $display->frm_form_id);
     //don't let page size and limit override single entry displays
     if ($display->frm_show_count == 'one') {
         $display->frm_page_size = $display->frm_limit = '';
     }
     //don't keep current content if post type is frm_display
     if ($post && $post->post_type == self::$post_type) {
         $display->frm_insert_loc = '';
     }
     $pagination = '';
     $form_query = array('form_id' => $display->frm_form_id, 'post_id >' => 1);
     if ($extra_atts['drafts'] != 'both') {
         $is_draft = empty($extra_atts['drafts']) ? 0 : 1;
         $form_query['is_draft'] = $is_draft;
     } else {
         $is_draft = 'both';
     }
     if ($entry && $entry->form_id == $display->frm_form_id) {
         $form_query['id'] = $entry->id;
     }
     $form_posts = FrmDb::get_results('frm_items', $form_query, 'id, post_id');
     unset($form_query);
     $getting_entries = !$entry || !$post || empty($extra_atts['auto_id']);
     $check_filter_opts = !empty($display->frm_where) && $getting_entries;
     if ($entry && $entry->form_id == $display->frm_form_id) {
         $entry_ids = array($entry->id);
         // Filter by this entry ID to make query faster
         $use_ids = true;
     } else {
         if ($check_filter_opts || isset($_GET['frm_search'])) {
             //Only get $entry_ids if filters are set or if frm_search parameter is set
             $entry_query = array('form_id' => $display->frm_form_id);
             if ($extra_atts['drafts'] != 'both') {
                 $entry_query['is_draft'] = $is_draft;
//.........这里部分代码省略.........
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:101,代码来源:FrmProDisplaysController.php


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