本文整理汇总了PHP中FrmAppHelper::get_post_param方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::get_post_param方法的具体用法?PHP FrmAppHelper::get_post_param怎么用?PHP FrmAppHelper::get_post_param使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::get_post_param方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_edit_vars
public static function setup_edit_vars($values, $record)
{
$values['item_key'] = FrmAppHelper::get_post_param('item_key', $record->item_key, 'sanitize_title');
$values['form_id'] = $record->form_id;
$values['is_draft'] = $record->is_draft;
return apply_filters('frm_setup_edit_entry_vars', $values, $record);
}
示例2: setup_edit_vars
public static function setup_edit_vars($post, $check_post = true)
{
if (!$post) {
return false;
}
$values = (object) $post;
$defaults = self::get_default_opts();
foreach (array('form_id', 'entry_id', 'post_id', 'dyncontent', 'param', 'type', 'show_count', 'insert_loc') as $var) {
$values->{'frm_' . $var} = get_post_meta($post->ID, 'frm_' . $var, true);
if ($check_post) {
$values->{'frm_' . $var} = FrmAppHelper::get_param($var, $values->{'frm_' . $var});
}
}
$options = get_post_meta($post->ID, 'frm_options', true);
foreach ($defaults as $var => $default) {
if (!isset($values->{'frm_' . $var})) {
$values->{'frm_' . $var} = isset($options[$var]) ? $options[$var] : $default;
if ($check_post) {
$values->{'frm_' . $var} = FrmAppHelper::get_post_param('options[' . $var . ']', $values->{'frm_' . $var});
}
} else {
if ($var == 'param' && empty($values->{'frm_' . $var})) {
$values->{'frm_' . $var} = $default;
}
}
}
$values->frm_form_id = (int) $values->frm_form_id;
$values->frm_order_by = empty($values->frm_order_by) ? array() : (array) $values->frm_order_by;
$values->frm_order = empty($values->frm_order) ? array() : (array) $values->frm_order;
return $values;
}
示例3: process_form
public static function process_form($stop_load = false)
{
global $frm_vars;
$frm_settings = FrmAppHelper::get_settings();
$process_form = FrmAppHelper::get_post_param('process_form', '', 'sanitize_text_field');
if (!wp_verify_nonce($process_form, 'process_form_nonce')) {
wp_die($frm_settings->admin_permission);
}
$errors = array();
$message = '';
if (!isset($frm_vars['settings_routed']) || !$frm_vars['settings_routed']) {
//$errors = $frm_settings->validate($_POST,array());
$frm_settings->update(stripslashes_deep($_POST));
if (empty($errors)) {
$frm_settings->store();
$message = __('Settings Saved', 'formidable');
}
} else {
$message = __('Settings Saved', 'formidable');
}
if ($stop_load == 'stop_load') {
$frm_vars['settings_routed'] = true;
return;
}
self::display_form($errors, $message);
}
示例4: setup_edit_vars
function setup_edit_vars($record)
{
if (!$record) {
return false;
}
$values = array();
$values['id'] = $record->id;
foreach (array('name', 'description', 'display_key', 'form_id', 'entry_id', 'post_id', 'content', 'dyncontent', 'param', 'type', 'show_count', 'insert_loc') as $var) {
$values[$var] = stripslashes(FrmAppHelper::get_param($var, $record->{$var}));
}
$options = maybe_unserialize($record->options);
foreach (FrmProDisplaysHelper::get_default_opts() as $var => $default) {
if (!isset($values[$var])) {
$values[$var] = stripslashes_deep(FrmAppHelper::get_post_param('options[' . $var . ']', isset($options[$var]) ? $options[$var] : $default));
}
}
return $values;
}
示例5: export_xml
public static function export_xml()
{
$error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'export-xml', 'export-xml-nonce');
if (!empty($error)) {
wp_die($error);
}
$ids = FrmAppHelper::get_post_param('frm_export_forms', array());
$type = FrmAppHelper::get_post_param('type', array());
$format = FrmAppHelper::get_post_param('format', 'xml', 'sanitize_title');
if (!headers_sent() && !$type) {
wp_redirect(esc_url_raw(admin_url('admin.php?page=formidable-import')));
die;
}
if ($format == 'xml') {
self::generate_xml($type, compact('ids'));
} else {
do_action('frm_export_format_' . $format, compact('ids'));
}
wp_die();
}
示例6: get_csv_format
public static function get_csv_format()
{
$frmpro_settings = new FrmProSettings();
self::$to_encoding = FrmAppHelper::get_post_param('csv_format', $frmpro_settings->csv_format, 'sanitize_text_field');
}
示例7: process_entry
public static function process_entry($errors = '', $ajax = false)
{
$form_id = FrmAppHelper::get_post_param('form_id', '', 'absint');
if (FrmAppHelper::is_admin() || empty($_POST) || empty($form_id) || !isset($_POST['item_key'])) {
return;
}
global $frm_vars;
$form = FrmForm::getOne($form_id);
if (!$form) {
return;
}
$params = FrmForm::get_params($form);
if (!isset($frm_vars['form_params'])) {
$frm_vars['form_params'] = array();
}
$frm_vars['form_params'][$form->id] = $params;
if (isset($frm_vars['created_entries'][$form_id])) {
return;
}
if ($errors == '') {
$errors = FrmEntryValidate::validate($_POST);
}
/**
* Use this filter to add trigger actions and add errors after
* all other errors have been processed
* @since 2.0.6
*/
$errors = apply_filters('frm_entries_before_create', $errors, $form);
$frm_vars['created_entries'][$form_id] = array('errors' => $errors);
if (empty($errors)) {
$_POST['frm_skip_cookie'] = 1;
if ($params['action'] == 'create') {
if (apply_filters('frm_continue_to_create', true, $form_id) && !isset($frm_vars['created_entries'][$form_id]['entry_id'])) {
$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create($_POST);
}
}
do_action('frm_process_entry', $params, $errors, $form, array('ajax' => $ajax));
unset($_POST['frm_skip_cookie']);
}
}
示例8: _e
_container">
<div class="frm_error_style"><strong><?php
_e('Oops!', 'formidable');
?>
</strong> <?php
printf(__('You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable'), '<a href="' . esc_url(admin_url('?page=formidable&frm_action=edit&id=' . $form->id)) . '">', '</a>');
?>
</div>
</div>
<?php
return;
}
global $frm_vars;
FrmFormsController::maybe_load_css($form, $values['custom_style'], $frm_vars['load_css']);
// Get conditionally hidden fields
$frm_hide_fields = FrmAppHelper::get_post_param('frm_hide_fields_' . $form->id, '', 'sanitize_text_field');
// Get helpers
$frm_helpers = apply_filters('frm_get_parent_child_field_helpers', '', $values['fields'], $form->id);
?>
<div class="frm_form_fields <?php
echo esc_attr(apply_filters('frm_form_fields_class', '', $values));
?>
">
<fieldset>
<?php
echo FrmFormsHelper::replace_shortcodes($values['before_html'], $form, $title, $description);
?>
<input type="hidden" name="frm_action" value="<?php
echo esc_attr($form_action);
?>
" />
示例9: get_entry_by_param
private static function get_entry_by_param(&$entry)
{
if (!$entry || !is_object($entry)) {
if (!$entry || !is_numeric($entry)) {
$entry = FrmAppHelper::get_post_param('id', false, 'sanitize_title');
}
FrmEntry::maybe_get_entry($entry);
}
}
示例10:
/**
* check if this entry is currently being saved as a draft
*/
public static function &saving_draft()
{
$saving_draft = FrmAppHelper::get_post_param('frm_saving_draft', '', 'sanitize_title');
$saving = $saving_draft == '1' && is_user_logged_in();
return $saving;
}
示例11: setup_new_vars
function setup_new_vars($fields, $form = '', $reset = false)
{
global $frm_form, $frm_settings, $frm_sidebar_width;
$values = array();
foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
$values[$var] = stripslashes(FrmAppHelper::get_post_param($var, $default));
}
$values['fields'] = array();
if ($fields) {
foreach ($fields as $field) {
$field->field_options = maybe_unserialize($field->field_options);
$default = $field->default_value;
if ($reset) {
$new_value = $default;
} else {
$new_value = ($_POST and isset($_POST['item_meta'][$field->id]) and $_POST['item_meta'][$field->id] != '') ? $_POST['item_meta'][$field->id] : $default;
}
$is_default = $new_value == $default ? true : false;
$new_value = stripslashes_deep(maybe_unserialize($new_value));
if (!is_array($new_value)) {
$new_value = apply_filters('frm_get_default_value', $new_value, $field);
}
$new_value = str_replace('"', '"', $new_value);
if ($is_default) {
$field->default_value = $new_value;
} else {
$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field);
}
$field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => maybe_unserialize($field->default_value), 'name' => stripslashes($field->name), 'description' => stripslashes($field->description), 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => stripslashes_deep(maybe_unserialize($field->options)), 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
/*if(in_array($field_array['type'], array('checkbox', 'radio', 'select')) and !empty($field_array['options'])){
foreach((array)$field_array['options'] as $opt_key => $opt){
if(!is_array($opt))
$field_array['options'][$opt_key] = array('label' => $opt);
unset($opt);
unset($opt_key);
}
} */
$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
$opt_defaults['required_indicator'] = '';
foreach ($opt_defaults as $opt => $default_opt) {
$field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
unset($opt);
unset($default_opt);
}
unset($opt_defaults);
if ($field_array['size'] == '') {
$field_array['size'] = $frm_sidebar_width;
}
if ($field_array['custom_html'] == '') {
$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
}
$values['fields'][] = apply_filters('frm_setup_new_fields_vars', stripslashes_deep($field_array), $field);
if (!$form or !isset($form->id)) {
$form = $frm_form->getOne($field->form_id);
}
}
$form->options = maybe_unserialize($form->options);
if (is_array($form->options)) {
foreach ($form->options as $opt => $value) {
$values[$opt] = FrmAppHelper::get_post_param($opt, $value);
}
}
if (!isset($values['custom_style'])) {
$values['custom_style'] = $frm_settings->load_style != 'none';
}
if (!isset($values['email_to'])) {
$values['email_to'] = '';
}
if (!isset($values['submit_value'])) {
$values['submit_value'] = $frm_settings->submit_value;
}
if (!isset($values['success_msg'])) {
$values['success_msg'] = $frm_settings->success_msg;
}
if (!isset($values['akismet'])) {
$values['akismet'] = '';
}
if (!isset($values['before_html'])) {
$values['before_html'] = FrmFormsHelper::get_default_html('before');
}
if (!isset($values['after_html'])) {
$values['after_html'] = FrmFormsHelper::get_default_html('after');
}
}
return $values;
}
示例12: get_csv_format
public static function get_csv_format()
{
$csv_format = FrmAppHelper::get_post_param('csv_format', 'UTF-8', 'sanitize_text_field');
$csv_format = apply_filters('frm_csv_format', $csv_format);
self::$to_encoding = $csv_format;
}
示例13: ajax_create
public static function ajax_create()
{
if (!FrmAppHelper::doing_ajax() || !isset($_POST['form_id'])) {
// normally, this function would be triggered with the wp_ajax hook, but we need it fired sooner
return;
}
$allowed_actions = array('frm_entries_create', 'frm_entries_update');
if (!in_array(FrmAppHelper::get_post_param('action', '', 'sanitize_title'), $allowed_actions)) {
// allow ajax creating and updating
return;
}
$form = FrmForm::getOne((int) $_POST['form_id']);
if (!$form) {
echo false;
wp_die();
}
$no_ajax_fields = array('file');
$errors = FrmEntryValidate::validate($_POST, $no_ajax_fields);
if (empty($errors)) {
if (FrmProForm::is_ajax_on($form)) {
global $frm_vars;
$frm_vars['ajax'] = true;
$frm_vars['css_loaded'] = true;
// don't load scripts if we are going backwards in the form
$going_backwards = FrmProFormsHelper::going_to_prev($form->id);
// save the entry if there is not another page or when saving a draft
if (!isset($_POST['frm_page_order_' . $form->id]) && !$going_backwards || FrmProFormsHelper::saving_draft()) {
$processed = true;
FrmEntriesController::process_entry($errors, true);
}
echo FrmFormsController::show_form($form->id);
// trigger the footer scripts if there is a form to show
if ($errors || !isset($processed) || !empty($frm_vars['forms_loaded'])) {
self::print_ajax_scripts($going_backwards ? 'none' : '');
}
} else {
echo false;
}
} else {
$obj = array();
foreach ($errors as $field => $error) {
$field_id = str_replace('field', '', $field);
$obj[$field_id] = $error;
}
echo json_encode($obj);
}
wp_die();
}
示例14: test_get_post_param
/**
* @covers FrmAppHelper::get_post_param
* @covers FrmAppHelper::get_simple_request
*/
function test_get_post_param()
{
$set_value = '<script></script>test';
$expected_value = 'test';
$_POST['test3'] = $set_value;
$result = FrmAppHelper::get_post_param('test3', '', 'sanitize_text_field');
$this->assertEquals($result, $expected_value);
}
示例15: setup_new_vars
public static function setup_new_vars($fields, $form = '', $reset = false)
{
global $frm_settings, $frm_vars;
$values = array();
foreach (array('name' => '', 'description' => '', 'item_key' => '') as $var => $default) {
$values[$var] = FrmAppHelper::get_post_param($var, $default);
}
$values['fields'] = array();
if (empty($fields)) {
return apply_filters('frm_setup_new_entry', $values);
}
foreach ((array) $fields as $field) {
$field->field_options = maybe_unserialize($field->field_options);
$default = $field->default_value;
$posted_val = false;
if ($reset) {
$new_value = $default;
} else {
if ($_POST && isset($_POST['item_meta'][$field->id]) && $_POST['item_meta'][$field->id] != '') {
$new_value = stripslashes_deep($_POST['item_meta'][$field->id]);
$posted_val = true;
} else {
if (isset($field->field_options['clear_on_focus']) && $field->field_options['clear_on_focus']) {
$new_value = '';
} else {
$new_value = $default;
}
}
}
$is_default = $new_value == $default ? true : false;
//If checkbox, multi-select dropdown, or checkbox data from entries field, set return array to true
if ($field && ($field->type == 'data' && $field->field_options['data_type'] == 'checkbox' || $field->type == 'checkbox' || $field->type == 'select' && isset($field->field_options['multiple']) && $field->field_options['multiple'] == 1)) {
$return_array = true;
} else {
$return_array = false;
}
$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
if (!is_array($new_value)) {
if ($is_default) {
$new_value = $field->default_value;
} else {
if (!$posted_val) {
$new_value = apply_filters('frm_filter_default_value', $new_value, $field);
}
}
$new_value = str_replace('"', '"', $new_value);
}
unset($is_default);
unset($posted_val);
$field_array = array('id' => $field->id, 'value' => $new_value, 'default_value' => $field->default_value, 'name' => $field->name, 'description' => $field->description, 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), 'options' => $field->options, 'required' => $field->required, 'field_key' => $field->field_key, 'field_order' => $field->field_order, 'form_id' => $field->form_id);
$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
$opt_defaults['required_indicator'] = '';
foreach ($opt_defaults as $opt => $default_opt) {
$field_array[$opt] = isset($field->field_options[$opt]) && $field->field_options[$opt] != '' ? $field->field_options[$opt] : $default_opt;
unset($opt);
unset($default_opt);
}
unset($opt_defaults);
if ($field_array['size'] == '') {
$field_array['size'] = isset($frm_vars['sidebar_width']) ? $frm_vars['sidebar_width'] : '';
}
if ($field_array['custom_html'] == '') {
$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
}
$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
foreach ((array) $field->field_options as $k => $v) {
if (!isset($field_array[$k])) {
$field_array[$k] = $v;
}
unset($k);
unset($v);
}
$values['fields'][] = $field_array;
if (!$form or !isset($form->id)) {
$frm_form = new FrmForm();
$form = $frm_form->getOne($field->form_id);
}
}
$form->options = maybe_unserialize($form->options);
if (is_array($form->options)) {
foreach ($form->options as $opt => $value) {
$values[$opt] = FrmAppHelper::get_post_param($opt, $value);
}
}
if (!isset($values['custom_style'])) {
$values['custom_style'] = $frm_settings->load_style != 'none';
}
if (!isset($values['email_to'])) {
$values['email_to'] = '';
}
if (!isset($values['submit_value'])) {
$values['submit_value'] = $frm_settings->submit_value;
}
if (!isset($values['success_msg'])) {
$values['success_msg'] = $frm_settings->success_msg;
}
if (!isset($values['akismet'])) {
$values['akismet'] = '';
}
if (!isset($values['before_html'])) {
//.........这里部分代码省略.........