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


PHP FrmForm::maybe_get_form方法代码示例

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


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

示例1: user_can_edit

 public static function user_can_edit($entry, $form = false)
 {
     if (empty($form)) {
         FrmEntry::maybe_get_entry($entry);
         if (is_object($entry)) {
             $form = $entry->form_id;
         }
     }
     FrmForm::maybe_get_form($form);
     self::maybe_get_parent_form_and_entry($form, $entry);
     $allowed = self::user_can_edit_check($entry, $form);
     return apply_filters('frm_user_can_edit', $allowed, compact('entry', 'form'));
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:13,代码来源:FrmProEntriesHelper.php

示例2: get_form_nav

 public static function get_form_nav($form, $show_nav = false, $title = 'show')
 {
     $show_nav = FrmAppHelper::get_param('show_nav', $show_nav, 'get', 'absint');
     if (empty($show_nav) || !$form) {
         return;
     }
     FrmForm::maybe_get_form($form);
     if (!is_object($form)) {
         return;
     }
     $id = $form->id;
     $current_page = self::get_current_page();
     $nav_items = self::get_form_nav_items($form);
     include FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php';
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:15,代码来源:FrmAppController.php

示例3: get_form_nav

 public static function get_form_nav($form, $show_nav = '', $title = 'show')
 {
     global $pagenow, $frm_vars;
     $show_nav = FrmAppHelper::get_param('show_nav', $show_nav, 'get', 'absint');
     if (empty($show_nav)) {
         return;
     }
     $current_page = isset($_GET['page']) ? FrmAppHelper::simple_get('page', 'sanitize_title') : FrmAppHelper::simple_get('post_type', 'sanitize_title', 'None');
     if ($form) {
         FrmForm::maybe_get_form($form);
         if (is_object($form)) {
             $id = $form->id;
         }
     }
     if (!isset($id)) {
         $form = $id = false;
     }
     include FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php';
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:19,代码来源:FrmAppController.php

示例4: fill_form_opts

 /**
  * @param string $table
  */
 private static function fill_form_opts($record, $table, $post_values, array &$values)
 {
     if ($table == 'entries') {
         $form = $record->form_id;
         FrmForm::maybe_get_form($form);
     } else {
         $form = $record;
     }
     if (!$form) {
         return;
     }
     $values['form_name'] = isset($record->form_id) ? $form->name : '';
     $values['parent_form_id'] = isset($record->form_id) ? $form->parent_form_id : 0;
     if (!is_array($form->options)) {
         return;
     }
     foreach ($form->options as $opt => $value) {
         $values[$opt] = isset($post_values[$opt]) ? maybe_unserialize($post_values[$opt]) : $value;
     }
     self::fill_form_defaults($post_values, $values);
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:24,代码来源:FrmAppHelper.php

示例5: trigger_actions

 /**
  * @param string $event
  */
 public static function trigger_actions($event, $form, $entry, $type = 'all', $args = array())
 {
     $form_actions = FrmFormAction::get_action_for_form(is_object($form) ? $form->id : $form, $type);
     if (empty($form_actions)) {
         return;
     }
     FrmForm::maybe_get_form($form);
     $link_settings = self::get_form_actions($type);
     if ('all' != $type) {
         $link_settings = array($type => $link_settings);
     }
     $stored_actions = $action_priority = array();
     foreach ($form_actions as $action) {
         if (!in_array($event, $action->post_content['event'])) {
             continue;
         }
         if (!is_object($entry)) {
             $entry = FrmEntry::getOne($entry, true);
         }
         if (empty($entry) || $entry->is_draft) {
             continue;
         }
         $child_entry = $form && is_numeric($form->parent_form_id) && $form->parent_form_id || $entry && ($entry->form_id != $form->id || $entry->parent_item_id) || isset($args['is_child']) && $args['is_child'];
         if ($child_entry) {
             //don't trigger actions for sub forms
             continue;
         }
         // check conditional logic
         $stop = FrmFormAction::action_conditions_met($action, $entry);
         if ($stop) {
             continue;
         }
         // store actions so they can be triggered with the correct priority
         $stored_actions[$action->ID] = $action;
         $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
         unset($action);
     }
     if (!empty($stored_actions)) {
         asort($action_priority);
         // make sure hooks are loaded
         new FrmNotification();
         foreach ($action_priority as $action_id => $priority) {
             $action = $stored_actions[$action_id];
             do_action('frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event);
             do_action('frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form);
             // If post is created, get updated $entry object
             if ($action->post_excerpt == 'wppost' && $event == 'create') {
                 $entry = FrmEntry::getOne($entry->id, true);
             }
         }
     }
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:55,代码来源:FrmFormActionsController.php

示例6: maybe_get_form

 public static function maybe_get_form(&$form)
 {
     _deprecated_function(__FUNCTION__, '2.0.9', 'FrmForm::maybe_get_form');
     FrmForm::maybe_get_form($form);
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:5,代码来源:FrmFormsHelper.php

示例7: trigger_actions

 /**
  * @param string $event
  */
 public static function trigger_actions($event, $form, $entry, $type = 'all', $args = array())
 {
     $form_actions = FrmFormAction::get_action_for_form(is_object($form) ? $form->id : $form, $type);
     if (empty($form_actions)) {
         return;
     }
     FrmForm::maybe_get_form($form);
     $link_settings = self::get_form_actions($type);
     if ('all' != $type) {
         $link_settings = array($type => $link_settings);
     }
     $stored_actions = $action_priority = array();
     $importing = in_array($event, array('create', 'update')) && defined('WP_IMPORTING') && WP_IMPORTING;
     foreach ($form_actions as $action) {
         $trigger_on_import = $importing && in_array('import', $action->post_content['event']);
         $skip_this_action = !in_array($event, $action->post_content['event']) && !$trigger_on_import;
         $skip_this_action = apply_filters('frm_skip_form_action', $skip_this_action, compact('action', 'entry', 'form', 'event'));
         if ($skip_this_action) {
             continue;
         }
         if (!is_object($entry)) {
             $entry = FrmEntry::getOne($entry, true);
         }
         if (empty($entry) || $entry->is_draft && $event != 'draft') {
             continue;
         }
         $child_entry = $form && is_numeric($form->parent_form_id) && $form->parent_form_id || $entry && ($entry->form_id != $form->id || $entry->parent_item_id) || isset($args['is_child']) && $args['is_child'];
         if ($child_entry) {
             // maybe trigger actions for sub forms
             $trigger_children = apply_filters('frm_use_embedded_form_actions', false, compact('form', 'entry'));
             if (!$trigger_children) {
                 continue;
             }
         }
         // check conditional logic
         $stop = FrmFormAction::action_conditions_met($action, $entry);
         if ($stop) {
             continue;
         }
         // store actions so they can be triggered with the correct priority
         $stored_actions[$action->ID] = $action;
         $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
         unset($action);
     }
     if (!empty($stored_actions)) {
         asort($action_priority);
         // make sure hooks are loaded
         new FrmNotification();
         foreach ($action_priority as $action_id => $priority) {
             $action = $stored_actions[$action_id];
             do_action('frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event);
             do_action('frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form);
             // If post is created, get updated $entry object
             if ($action->post_excerpt == 'wppost' && $event == 'create') {
                 $entry = FrmEntry::getOne($entry->id, true);
             }
         }
     }
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:62,代码来源:FrmFormActionsController.php

示例8: repeat_field_set

 public static function repeat_field_set($field_name, $args = array())
 {
     $defaults = array('i' => 0, 'entry_id' => false, 'form' => false, 'fields' => array(), 'errors' => array(), 'parent_field' => 0, 'repeat' => 0, 'row_count' => false, 'value' => '', 'field_name' => '');
     $args = wp_parse_args($args, $defaults);
     if (empty($args['parent_field'])) {
         return;
     }
     if (is_numeric($args['parent_field'])) {
         $args['parent_field'] = (array) FrmField::getOne($args['parent_field']);
         $args['parent_field']['format'] = isset($args['parent_field']['field_options']['format']) ? $args['parent_field']['field_options']['format'] : '';
     }
     FrmForm::maybe_get_form($args['form']);
     if (empty($args['fields'])) {
         $args['fields'] = FrmField::get_all_for_form($args['form']->id);
     }
     $values = array();
     if ($args['fields']) {
         // Get the ID of the form that houses the embedded form or repeating section
         $parent_form_id = $args['parent_field']['form_id'];
         if (empty($args['entry_id'])) {
             $values = FrmEntriesHelper::setup_new_vars($args['fields'], $args['form'], false, array('parent_form_id' => $parent_form_id));
         } else {
             $entry = FrmEntry::getOne($args['entry_id'], true);
             if ($entry && $entry->form_id == $args['form']->id) {
                 $values = FrmAppHelper::setup_edit_vars($entry, 'entries', $args['fields'], false, array(), array('parent_form_id' => $parent_form_id));
             } else {
                 return;
             }
         }
     }
     $format = isset($args['parent_field']['format']) ? $args['parent_field']['format'] : '';
     $end = false;
     $count = 0;
     foreach ($values['fields'] as $subfield) {
         if ('end_divider' == $subfield['type']) {
             $end = $subfield;
         } else {
             if (!in_array($subfield['type'], array('hidden', 'user_id'))) {
                 if (isset($subfield['conf_field']) && $subfield['conf_field']) {
                     $count = $count + 2;
                 } else {
                     $count++;
                 }
             }
         }
         unset($subfield);
     }
     if ($args['repeat']) {
         $count++;
     }
     $classes = array(2 => 'half', 3 => 'third', 4 => 'fourth', 5 => 'fifth', 6 => 'sixth', 7 => 'seventh', 8 => 'eighth');
     $field_class = !empty($format) && isset($classes[$count]) ? $classes[$count] : '';
     echo '<div id="frm_section_' . $args['parent_field']['id'] . '-' . $args['i'] . '" class="frm_repeat_' . (empty($format) ? 'sec' : $format) . ' frm_repeat_' . $args['parent_field']['id'] . ($args['row_count'] === 0 ? ' frm_first_repeat' : '') . '">' . "\n";
     self::add_hidden_repeat_entry_id($args);
     self::add_default_item_meta_field($args);
     $label_pos = 'top';
     $field_num = 1;
     foreach ($values['fields'] as $subfield) {
         $subfield_name = $field_name . '[' . $args['i'] . '][' . $subfield['id'] . ']';
         $subfield_plus_id = '-' . $args['i'];
         $subfield_id = $subfield['id'] . '-' . $args['parent_field']['id'] . $subfield_plus_id;
         if ($args['parent_field'] && !empty($args['parent_field']['value']) && isset($args['parent_field']['value']['form']) && isset($args['parent_field']['value'][$args['i']]) && isset($args['parent_field']['value'][$args['i']][$subfield['id']])) {
             // this is a posted value from moving between pages, so set the POSTed value
             $subfield['value'] = $args['parent_field']['value'][$args['i']][$subfield['id']];
         }
         if (!empty($field_class)) {
             if (1 == $field_num) {
                 $subfield['classes'] .= ' frm_first frm_' . $field_class;
             } else {
                 $subfield['classes'] .= ' frm_' . $field_class;
             }
         }
         $field_num++;
         if ('top' == $label_pos && in_array($subfield['label'], array('top', 'hidden', ''))) {
             // add placeholder label if repeating
             $label_pos = 'hidden';
         }
         $field_args = array('field_name' => $subfield_name, 'field_id' => $subfield_id, 'field_plus_id' => $subfield_plus_id, 'section_id' => $args['parent_field']['id']);
         if (apply_filters('frm_show_normal_field_type', true, $subfield['type'])) {
             echo FrmFieldsHelper::replace_shortcodes($subfield['custom_html'], $subfield, $args['errors'], $args['form'], $field_args);
         } else {
             do_action('frm_show_other_field_type', $subfield, $args['form'], $field_args);
         }
         unset($subfield_name, $subfield_id);
         do_action('frm_get_field_scripts', $subfield, $args['form'], $args['parent_field']['form_id']);
     }
     if (!$args['repeat']) {
         // Close frm_repeat div
         echo '</div>' . "\n";
         return;
     }
     $args['format'] = $format;
     $args['label_pos'] = $label_pos;
     $args['field_class'] = $field_class;
     echo self::repeat_buttons($args, $end);
     // Close frm_repeat div
     echo '</div>' . "\n";
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:98,代码来源:FrmProFormsHelper.php


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