本文整理汇总了PHP中FrmAppHelper::trigger_hook_load方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::trigger_hook_load方法的具体用法?PHP FrmAppHelper::trigger_hook_load怎么用?PHP FrmAppHelper::trigger_hook_load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::trigger_hook_load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
public static function route($action)
{
add_filter('frm_entry_stop_action_route', '__return_true');
add_action('frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks');
FrmAppHelper::trigger_hook_load('form');
switch ($action) {
case 'create':
return self::create();
case 'edit':
return self::edit();
case 'update':
return self::update();
case 'duplicate':
return self::duplicate();
case 'new':
return self::new_entry();
default:
$action = FrmAppHelper::get_param('action', '', 'get', 'sanitize_text_field');
if ($action == -1) {
$action = FrmAppHelper::get_param('action2', '', 'get', 'sanitize_title');
}
if (strpos($action, 'bulk_') === 0) {
FrmAppHelper::remove_get_action();
return self::bulk_actions($action);
}
return FrmEntriesController::display_list();
}
}
示例2: show_form
public static function show_form($id = '', $key = '', $title = false, $description = false, $atts = array())
{
if (empty($id)) {
$id = $key;
}
// no form id or key set
if (empty($id)) {
return __('Please select a valid form', 'formidable');
}
$form = FrmForm::getOne($id);
if (!$form || $form->parent_form_id) {
return __('Please select a valid form', 'formidable');
}
add_action('frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks');
FrmAppHelper::trigger_hook_load('form', $form);
$form = apply_filters('frm_pre_display_form', $form);
$frm_settings = FrmAppHelper::get_settings();
if (self::is_viewable_draft_form($form)) {
// don't show a draft form on a page
$form = __('Please select a valid form', 'formidable');
} else {
if (self::user_should_login($form)) {
$form = do_shortcode($frm_settings->login_msg);
} else {
if (self::user_has_permission_to_view($form)) {
$form = do_shortcode($frm_settings->login_msg);
} else {
$form = self::get_form($form, $title, $description, $atts);
/**
* Use this shortcode to check for external shortcodes that may span
* across multiple fields in the customizable HTML
* @since 2.0.8
*/
$form = apply_filters('frm_filter_final_form', $form);
}
}
}
return $form;
}
示例3: 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;
//.........这里部分代码省略.........