本文整理汇总了PHP中FrmFieldsHelper::get_form_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFieldsHelper::get_form_fields方法的具体用法?PHP FrmFieldsHelper::get_form_fields怎么用?PHP FrmFieldsHelper::get_form_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFieldsHelper
的用法示例。
在下文中一共展示了FrmFieldsHelper::get_form_fields方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
}
}
}
示例2: do_action
if (!$frm_css_loaded and $frm_load_css) {
echo FrmAppController::footer_js('header');
$frm_css_loaded = true;
}
?>
<div class="frm_forms<?php
echo $values['custom_style'] ? ' with_frm_style' : '';
?>
" id="frm_form_<?php
echo $form->id;
?>
_container"><?php
echo $message;
?>
</div>
<?php
}
} else {
do_action('frm_success_action', $conf_method, $form, $form->options, $created);
}
do_action('frm_after_entry_processed', array('entry_id' => $created, 'form' => $form));
}
}
} else {
$fields = FrmFieldsHelper::get_form_fields($form->id);
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);
require FRM_VIEWS_PATH . '/frm-entries/new.php';
}
}
示例3: get_edit_vars
function get_edit_vars($id, $errors = '', $message = '')
{
if (!current_user_can('frm_edit_entries')) {
return $this->show($id);
}
global $frm_form, $frm_entry, $frm_field, $frm_next_page, $frmpro_settings, $frm_editing_entry;
$title = $description = true;
$record = $frm_entry->getOne($id, true);
$frm_editing_entry = $id;
$form = $frm_form->getOne($record->form_id);
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = FrmAppHelper::setup_edit_vars($record, 'entries', $fields);
$submit = isset($frm_next_page[$form->id]) ? $frm_next_page[$form->id] : (isset($values['edit_value']) ? $values['edit_value'] : $frmpro_settings->update_value);
require FRMPRO_VIEWS_PATH . '/frmpro-entries/edit.php';
}
示例4: validate
function validate($params, $fields, $form, $title, $description)
{
global $frm_entry, $frm_settings, $frm_vars;
if (($_POST and isset($_POST['frm_page_order_' . $form->id]) or FrmProFormsHelper::going_to_prev($form->id)) and !FrmProFormsHelper::saving_draft($form->id)) {
$errors = '';
$fields = FrmFieldsHelper::get_form_fields($form->id);
$form_name = $form->name;
$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 and isset($form->options['single_entry']) and $form->options['single_entry'] and $form->options['single_entry_type'] == 'user') {
$user_ID = get_current_user_id();
if ($user_ID) {
$entry = $frm_entry->getAll(array('it.user_id' => $user_ID, 'it.form_id' => $form->id), '', 1, true);
if ($entry) {
$entry = reset($entry);
}
} else {
$entry = false;
}
if ($entry and !empty($entry) and (!isset($frm_vars['created_entries'][$form->id]) or !isset($frm_vars['created_entries'][$form->id]['entry_id']) or $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($form->id)) {
global $frmpro_settings;
$saved_message = isset($form->options['draft_msg']) ? $form->options['draft_msg'] : $frmpro_settings->draft_msg;
}
$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, '', $form->options);
}
add_filter('frm_continue_to_create', '__return_false');
} else {
if (FrmProFormsHelper::saving_draft($form->id)) {
global $frmpro_settings;
$record = (isset($frm_vars['created_entries']) and isset($frm_vars['created_entries'][$form->id])) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
if ($record) {
$saved_message = isset($form->options['draft_msg']) ? $form->options['draft_msg'] : $frmpro_settings->draft_msg;
$saved_message = apply_filters('frm_content', $saved_message, $form, $record);
$message = '<div class="frm_message" id="message">' . wpautop(do_shortcode($saved_message)) . '</div>';
FrmProEntriesController::show_responses($record, $fields, $form, $title, $description, $message, '', $form->options);
add_filter('frm_continue_to_create', '__return_false');
}
}
}
}
}
示例5: get_form
public static function get_form($form, $title, $description, $atts = array())
{
global $frm_field, $frm_entry, $frm_entry_meta, $frm_settings, $frm_vars;
$form_name = $form->name;
$frm_form = new FrmForm();
$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
$saved_message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
$user_ID = get_current_user_id();
$params = FrmEntriesController::get_params($form);
$message = $errors = '';
FrmEntriesHelper::enqueue_scripts($params);
if ($params['posted_form_id'] == $form->id && $_POST) {
$errors = isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
}
$fields = FrmFieldsHelper::get_form_fields($form->id, isset($errors) && !empty($errors));
$filename = FrmAppHelper::plugin_path() . '/classes/views/frm-entries/frm-entry.php';
if (is_file($filename)) {
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
// check if minimizing is turned on
if (isset($atts['minimize']) && !empty($atts['minimize'])) {
$contents = str_replace(array("\r\n", "\r", "\n", "\t", " "), '', $contents);
}
return $contents;
}
return false;
}
示例6: 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));
}
示例7: get_edit_vars
private static function get_edit_vars($id, $errors = array(), $message = '')
{
global $frm_vars;
$description = true;
$title = false;
$record = FrmEntry::getOne($id, true);
if (!$record) {
wp_die(__('You are trying to access an entry that does not exist.', 'formidable'));
return;
}
$frm_vars['editing_entry'] = $id;
$form = FrmForm::getOne($record->form_id);
$form = apply_filters('frm_pre_display_form', $form);
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = FrmAppHelper::setup_edit_vars($record, 'entries', $fields);
$frmpro_settings = new FrmProSettings();
$edit_create = $record->is_draft ? isset($values['submit_value']) ? $values['submit_value'] : $frmpro_settings->submit_value : (isset($values['edit_value']) ? $values['edit_value'] : $frmpro_settings->update_value);
$submit = isset($frm_vars['next_page'][$form->id]) ? $frm_vars['next_page'][$form->id] : $edit_create;
unset($edit_create);
if (is_object($submit)) {
$submit = $submit->name;
}
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/edit.php';
}
示例8: get_edit_vars
private static function get_edit_vars($id, $errors = '', $message = '')
{
global $frm_entry, $frm_field, $frmpro_settings, $frm_vars;
$description = true;
$title = false;
$record = $frm_entry->getOne($id, true);
$frm_vars['editing_entry'] = $id;
$frm_form = new FrmForm();
$form = $frm_form->getOne($record->form_id);
$form = apply_filters('frm_pre_display_form', $form);
$fields = FrmFieldsHelper::get_form_fields($form->id, !empty($errors));
$values = FrmAppHelper::setup_edit_vars($record, 'entries', $fields);
$edit_create = $record->is_draft ? isset($values['submit_value']) ? $values['submit_value'] : $frmpro_settings->submit_value : (isset($values['edit_value']) ? $values['edit_value'] : $frmpro_settings->update_value);
$submit = isset($frm_vars['next_page'][$form->id]) ? $frm_vars['next_page'][$form->id] : $edit_create;
unset($edit_create);
if (is_object($submit)) {
$submit = $submit->name;
}
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/edit.php';
}
示例9: validate
function validate($params, $fields, $form, $title, $description)
{
global $user_ID, $frm_entry_meta, $frm_entry, $frm_settings, $frmpro_settings, $frmpro_entries_controller, $frmdb;
$form_options = stripslashes_deep(maybe_unserialize($form->options));
$can_submit = true;
if (isset($form_options['single_entry']) and $form_options['single_entry']) {
if ($form_options['single_entry_type'] == 'cookie' and isset($_COOKIE['frm_form' . $form->id . '_' . COOKIEHASH])) {
$can_submit = false;
} else {
if ($form_options['single_entry_type'] == 'ip') {
$prev_entry = $frm_entry->getAll(array('it.ip' => $_SERVER['REMOTE_ADDR']), '', 1);
if ($prev_entry) {
$can_submit = false;
}
} else {
if ($form_options['single_entry_type'] == 'user' and !$form->editable) {
$meta = $frmdb->get_var($frmdb->entries, array('user_id' => $user_ID, 'form_id' => $form->id));
if ($meta) {
$can_submit = false;
}
} else {
if (is_numeric($form_options['single_entry_type'])) {
$field_id = $form_options['single_entry_type'];
$meta = $frm_entry_meta->getAll("meta_value='" . $_POST['item_meta'][$field_id] . "' and fi.id='{$field_id}' and fi.form_id='{$form->id}'", '', ' LIMIT 1');
if ($meta) {
$can_submit = false;
}
}
}
}
}
if (!$can_submit) {
echo stripslashes($frmpro_settings->already_submitted);
//TODO: DO SOMETHING IF USER CANNOT RESUBMIT FORM
add_filter('frm_continue_to_create', create_function('', 'return false;'));
return;
}
}
if (isset($_POST) and isset($_POST['frm_page_order_' . $form->id])) {
global $frm_next_page;
$errors = '';
$fields = FrmFieldsHelper::get_form_fields($form->id);
$form_name = $form->name;
$submit = isset($form_options['submit_value']) ? $form_options['submit_value'] : $frm_settings->submit_value;
$values = FrmEntriesHelper::setup_new_vars($fields, $form);
require FRM_VIEWS_PATH . '/frm-entries/new.php';
add_filter('frm_continue_to_create', create_function('', 'return false;'));
} else {
if ($form->editable and isset($form_options['single_entry']) and $form_options['single_entry']) {
$saved_message = isset($form_options['success_msg']) ? $form_options['success_msg'] : $frm_settings->success_msg;
$entry = $frm_entry->getAll(array('it.user_id' => $user_ID, 'it.form_id' => $form->id), '', 1, true);
if ($entry and !empty($entry)) {
$message = stripslashes($frmpro_settings->already_submitted);
$frmpro_entries_controller->show_responses(reset($entry), $fields, $form, $title, $description, $message);
} else {
$record = $frm_entry->create($_POST);
$message = $record ? $saved_message : $frm_settings->failed_msg;
$frmpro_entries_controller->show_responses($record, $fields, $form, $title, $description, $message, '', $form_options);
}
add_filter('frm_continue_to_create', create_function('', 'return false;'));
}
}
}