本文整理汇总了PHP中rgpost函数的典型用法代码示例。如果您正苦于以下问题:PHP rgpost函数的具体用法?PHP rgpost怎么用?PHP rgpost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rgpost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maybe_deploy
public static function maybe_deploy()
{
global $gfpdfe_data;
/*
* Check if we have a 'direct' method, that the software isn't fully installed and we aren't trying to manually initialise
*/
if ($gfpdfe_data->automated === true && $gfpdfe_data->is_initialised === false && !rgpost('upgrade') && get_option('gfpdfe_automated_install') != 'installing') {
/*
* Initialise all multisites if a super admin is logged in
*/
if (is_multisite() && is_super_admin()) {
$results = GFPDF_InstallUpdater::run_multisite_deployment(array('GFPDF_InstallUpdater', 'do_deploy'));
if ($results === true) {
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_network_deploy_success'));
} elseif ($results === false) {
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_network_failure'));
}
return $results;
} else {
if (self::do_deploy()) {
/*
* Output successfull automated installation message
*/
add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_success'));
}
}
}
}
示例2: gf_notification_attachment_save
/**
* [gf_notification_attachment_save description]
* @param array $notification
* @param array $form
* @return array
*/
function gf_notification_attachment_save($notification, $form)
{
if (function_exists('rgpost')) {
$notification["attachment_id"] = rgpost("gform_notification_attachment_id");
}
return $notification;
}
示例3: get_value_submission
public function get_value_submission($field_values, $get_from_post_global_var = true)
{
$parameter_values = GFFormsModel::get_parameter_value($this->inputName, $field_values, $this);
if (!empty($parameter_values) && !is_array($parameter_values)) {
$parameter_values = explode(',', $parameter_values);
}
if (!is_array($this->inputs)) {
return '';
}
$choice_index = 0;
$value = array();
foreach ($this->inputs as $input) {
if (!empty($_POST['is_submit_' . $this->formId]) && $get_from_post_global_var) {
$input_value = rgpost('input_' . str_replace('.', '_', strval($input['id'])));
if (is_array($input_value)) {
$input_value = '';
}
$value[strval($input['id'])] = $input_value;
} else {
if (is_array($parameter_values)) {
foreach ($parameter_values as $item) {
$item = trim($item);
if (GFFormsModel::choice_value_match($this, $this->choices[$choice_index], $item)) {
$value[$input['id'] . ''] = $item;
break;
}
}
}
}
$choice_index++;
}
return $value;
}
示例4: reject_urls_in_textarea
function reject_urls_in_textarea($validation_result)
{
// Get the form object from the validation result
$form = $validation_result["form"];
//Loop through the form fields
foreach ($form['fields'] as &$field) {
if ($field["type"] == 'textarea') {
// Get the submitted value from the $_POST
$field_value = rgpost("input_{$field['id']}");
$pattern = '#[-a-zA-Z0-9@:%_\\+.~\\#?&//=]{2,256}\\.[a-z]{2,4}\\b(\\/[-a-zA-Z0-9@:%_\\+.~\\#?&//=]*)?#si';
if (preg_match_all($pattern, $field_value)) {
//Fail the validation for the entire form
$validation_result['is_valid'] = false;
//Mark the specific field that failed and add a custom validation message
$field['failed_validation'] = true;
$field['validation_message'] = 'Urls [Links] or [Emails] are not allowed in this field.';
//Assign our modified $form object back to the validation result
$validation_result['form'] = $form;
} else {
//Huston we are a go!
continue;
}
} else {
//!textarea
continue;
}
}
//Return validated result
return $validation_result;
}
开发者ID:InternalError503,项目名称:reject-urls-and-emails-in-textarea,代码行数:30,代码来源:reject-urls-and-emails-in-textarea.php
示例5: get_field_input
public function get_field_input($form, $value = '', $entry = null)
{
$is_entry_detail = $this->is_entry_detail();
$is_form_editor = $this->is_form_editor();
if (is_array($value)) {
$value = array_values($value);
}
$form_id = $form['id'];
$id = intval($this->id);
$field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
$form_id = ($is_entry_detail || $is_form_editor) && empty($form_id) ? rgget('id') : $form_id;
$size = $this->size;
$disabled_text = $is_form_editor ? "disabled='disabled'" : '';
$class_suffix = $is_entry_detail ? '_admin' : '';
$class = $this->emailConfirmEnabled ? '' : $size . $class_suffix;
//Size only applies when confirmation is disabled
$form_sub_label_placement = rgar($form, 'subLabelPlacement');
$field_sub_label_placement = $this->subLabelPlacement;
$is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above';
$sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label'" : '';
$html_input_type = RGFormsModel::is_html5_enabled() ? 'email' : 'text';
$enter_email_field_input = GFFormsModel::get_input($this, $this->id . '');
$confirm_field_input = GFFormsModel::get_input($this, $this->id . '.2');
$enter_email_label = rgar($enter_email_field_input, 'customLabel') != '' ? $enter_email_field_input['customLabel'] : __('Enter Email', 'gravityforms');
$enter_email_label = apply_filters("gform_email_{$form_id}", apply_filters('gform_email', $enter_email_label, $form_id), $form_id);
$confirm_email_label = rgar($confirm_field_input, 'customLabel') != '' ? $confirm_field_input['customLabel'] : __('Confirm Email', 'gravityforms');
$confirm_email_label = apply_filters("gform_email_confirm_{$form_id}", apply_filters('gform_email_confirm', $confirm_email_label, $form_id), $form_id);
$single_placeholder_attribute = $this->get_field_placeholder_attribute();
$enter_email_placeholder_attribute = $this->get_input_placeholder_attribute($enter_email_field_input);
$confirm_email_placeholder_attribute = $this->get_input_placeholder_attribute($confirm_field_input);
if ($is_form_editor) {
$single_style = $this->emailConfirmEnabled ? "style='display:none;'" : '';
$confirm_style = $this->emailConfirmEnabled ? '' : "style='display:none;'";
if ($is_sub_label_above) {
return "<div class='ginput_container ginput_single_email' {$single_style}>\n <input name='input_{$id}' type='{$html_input_type}' class='" . esc_attr($class) . "' disabled='disabled' {$single_placeholder_attribute} />\n <div class='gf_clear gf_clear_complex'></div>\n </div>\n <div class='ginput_complex ginput_container ginput_confirm_email' {$confirm_style} id='{$field_id}_container'>\n <span id='{$field_id}_container' class='ginput_left'>\n <label for='{$field_id}' {$sub_label_class_attribute}>{$enter_email_label}</label>\n <input class='{$class}' type='text' name='input_{$id}' id='{$field_id}' disabled='disabled' {$enter_email_placeholder_attribute}/>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n <input class='{$class}' type='text' name='input_{$id}_2' id='{$field_id}_2' disabled='disabled' {$confirm_email_placeholder_attribute}/>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>";
} else {
return "<div class='ginput_container ginput_single_email' {$single_style}>\n <input class='{$class}' name='input_{$id}' type='{$html_input_type}' class='" . esc_attr($class) . "' disabled='disabled' {$single_placeholder_attribute}/>\n <div class='gf_clear gf_clear_complex'></div>\n </div>\n <div class='ginput_complex ginput_container ginput_confirm_email' {$confirm_style} id='{$field_id}_container'>\n <span id='{$field_id}_container' class='ginput_left'>\n <input class='{$class}' type='text' name='input_{$id}' id='{$field_id}' disabled='disabled' {$enter_email_placeholder_attribute}/>\n <label for='{$field_id}' {$sub_label_class_attribute}>{$enter_email_label}</label>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <input class='{$class}' type='text' name='input_{$id}_2' id='{$field_id}_2' disabled='disabled' {$confirm_email_placeholder_attribute}/>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>";
}
} else {
$logic_event = $this->get_conditional_logic_event('keyup');
if ($this->emailConfirmEnabled && !$is_entry_detail) {
$first_tabindex = $this->get_tabindex();
$last_tabindex = $this->get_tabindex();
$email_value = is_array($value) ? esc_attr($value[0]) : $value;
$confirmation_value = is_array($value) ? esc_attr($value[1]) : rgpost('input_' . $this->id . '_2');
$confirmation_disabled = $is_entry_detail ? "disabled='disabled'" : $disabled_text;
if ($is_sub_label_above) {
return "<div class='ginput_complex ginput_container' id='{$field_id}_container'>\n <span id='{$field_id}_container' class='ginput_left'>\n <label for='{$field_id}'>" . $enter_email_label . "</label>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}' id='{$field_id}' value='" . $email_value . "' {$first_tabindex} {$logic_event} {$disabled_text} {$enter_email_placeholder_attribute}/>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}_2' id='{$field_id}_2' value='" . $confirmation_value . "' {$last_tabindex} {$confirmation_disabled} {$confirm_email_placeholder_attribute}/>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>";
} else {
return "<div class='ginput_complex ginput_container' id='{$field_id}_container'>\n <span id='{$field_id}_container' class='ginput_left'>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}' id='{$field_id}' value='" . $email_value . "' {$first_tabindex} {$logic_event} {$disabled_text} {$enter_email_placeholder_attribute}/>\n <label for='{$field_id}' {$sub_label_class_attribute}>{$enter_email_label}</label>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}_2' id='{$field_id}_2' value='" . $confirmation_value . "' {$last_tabindex} {$confirmation_disabled} {$confirm_email_placeholder_attribute}/>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>";
}
} else {
$tabindex = $this->get_tabindex();
$value = esc_attr($value);
$class = esc_attr($class);
return "<div class='ginput_container'>\n <input name='input_{$id}' id='{$field_id}' type='{$html_input_type}' value='{$value}' class='{$class}' {$tabindex} {$logic_event} {$disabled_text} {$single_placeholder_attribute}/>\n </div>";
}
}
}
示例6: validate_recaptcha
public function validate_recaptcha()
{
// when user clicks on the "I'm not a robot" box, the response token is populated into a hidden field by Google, get token from POST
$response_token = rgpost('g-recaptcha-response');
$is_valid = $this->verify_recaptcha_response($response_token);
if (!$is_valid) {
$this->failed_validation = true;
$this->validation_message = empty($this->errorMessage) ? __('The reCAPTCHA was invalid. Go back and try it again.', 'gravityforms') : $this->errorMessage;
}
}
示例7: jbl_save_gform_notification_settings
function jbl_save_gform_notification_settings($notification, $form)
{
if (isset($_POST['jbl_gfuaa_enable'])) {
$notification['jbl_gfuaa_enable'] = rgpost('jbl_gfuaa_enable');
}
if (isset($_POST['jbl_gfuaa_delete_files_after'])) {
$notification['jbl_gfuaa_delete_files_after'] = rgpost('jbl_gfuaa_delete_files_after');
}
return $notification;
}
开发者ID:Jebble,项目名称:Gravity-Forms-Uploads-as-Attachments,代码行数:10,代码来源:gforms-uploads-as-attachments.php
示例8: validate
function validate($value, $form)
{
if ($this->isRequired && $this->nameFormat != 'simple') {
$first = rgpost('input_' . $this->id . '_3');
$last = rgpost('input_' . $this->id . '_6');
if (empty($first) && !$this->get_input_property('3', 'isHidden') || empty($last) && !$this->get_input_property('6', 'isHidden')) {
$this->failed_validation = true;
$this->validation_message = empty($this->errorMessage) ? esc_html__('This field is required. Please enter the first and last name.', 'gravityforms') : $this->errorMessage;
}
}
}
示例9: validate_recaptcha
public function validate_recaptcha()
{
// when user clicks on the "I'm not a robot" box, the response token is populated into a hidden field by Google, get token from POST
$response_token = rgpost('g-recaptcha-response');
$is_valid = $this->verify_recaptcha_response($response_token);
if (!$is_valid) {
$this->failed_validation = true;
$this->validation_message = empty($this->errorMessage) ? __('The reCAPTCHA was invalid. Go back and try it again.', 'gravityforms') : $this->errorMessage;
$error_message = is_wp_error($response) ? $response->get_error_message() : '';
GFCommon::log_debug(__METHOD__ . ' - Validating the reCAPTCHA response has failed due to the following: ' . $error_message);
}
}
示例10: is_value_submission_empty
public function is_value_submission_empty($form_id)
{
$value = rgpost('input_' . $this->id);
if (is_array($value)) {
// Date field and date drop-downs
foreach ($value as $input) {
if (strlen(trim($input)) <= 0) {
return true;
}
}
return false;
} else {
// Date picker
return strlen(trim($value)) <= 0;
}
}
示例11: get_field_input
/**
* Returns the fields inner markup.
*
* @param array $form The form object currently being processed.
* @param string $value The field value from the $_POST or the resumed incomplete submission. Not currently used.
* @param null $entry
*
* @return string
*/
public function get_field_input($form, $value = '', $entry = null)
{
$form_id = $form['id'];
$is_entry_detail = $this->is_entry_detail();
$id = (int) $this->id;
if ($is_entry_detail) {
$input = "<input type='hidden' id='input_{$id}' name='input_{$id}' value='{$value}' />";
return $input . '<br/>' . esc_html__('Coupon fields are not editable', 'gravityformscoupons');
}
$disabled_text = $this->is_form_editor() ? 'disabled="disabled"' : '';
$logic_event = $this->get_conditional_logic_event('change');
$placeholder_attribute = $this->get_field_placeholder_attribute();
$coupons_detail = rgpost("gf_coupons_{$form_id}");
$coupon_codes = empty($coupons_detail) ? '' : rgpost("input_{$id}");
$input = "<div class='ginput_container' id='gf_coupons_container_{$form_id}'>" . "<input id='gf_coupon_code_{$form_id}' class='gf_coupon_code' onkeyup='DisableApplyButton({$form_id});' onchange='DisableApplyButton({$form_id});' onpaste='setTimeout(function(){DisableApplyButton({$form_id});}, 50);' type='text' {$disabled_text} {$placeholder_attribute} " . $this->get_tabindex() . '/>' . "<input type='button' disabled='disabled' onclick='ApplyCouponCode({$form_id});' value='" . esc_attr__('Apply', 'gravityformscoupons') . "' id='gf_coupon_button' class='button' {$disabled_text} " . $this->get_tabindex() . '/> ' . "<img style='display:none;' id='gf_coupon_spinner' src='" . gf_coupons()->get_base_url() . "/images/spinner.gif' alt='" . esc_attr__('please wait', 'gravityformscoupons') . "'/>" . "<div id='gf_coupon_info'></div>" . "<input type='hidden' id='gf_coupon_codes_{$form_id}' name='input_{$id}' value='" . esc_attr($coupon_codes) . "' {$logic_event} />" . "<input type='hidden' id='gf_total_no_discount_{$form_id}'/>" . "<input type='hidden' id='gf_coupons_{$form_id}' name='gf_coupons_{$form_id}' value='" . esc_attr($coupons_detail) . "' />" . "</div>";
return $input;
}
示例12: run_setting_routing
protected function run_setting_routing()
{
global $gfpdfe_data;
/*
* Check if we need to redeploy default PDF templates/styles to the theme folder
*/
if (rgpost("gfpdf_deploy") && (wp_verify_nonce(PDF_Common::post('gfpdf_deploy_nonce'), 'gfpdf_deploy_nonce_action') || wp_verify_nonce(PDF_Common::get('_wpnonce'), 'pdf-extended-filesystem'))) {
/*
* Check if the user wants to upgrade the system or only initialise the fonts
*/
if (PDF_Common::post('font-initialise')) {
/*
* We only want to reinitialise the font files and configuration
*/
if (GFPDF_InstallUpdater::initialise_fonts() === false) {
return true;
}
} else {
if (rgpost('upgrade')) {
/*
* Deploy new template styles
* If we get false returned Wordpress is trying to get
* access details to update files so don't display anything.
*/
if (self::deploy() === 'false') {
return true;
}
}
}
}
/*
* Check if we need to sync the theme folders because a user changes theme
* Sniff the _wpnonce values to determine this.
*/
if (isset($_GET['_wpnonce'])) {
/*
* Check if we want to copy the theme files
*/
if ((is_dir($gfpdfe_data->old_template_location) || is_dir($gfpdfe_data->old_3_6_template_site_location)) && wp_verify_nonce(PDF_Common::get('_wpnonce'), 'gfpdfe_migrate')) {
if (GFPDF_InstallUpdater::run_template_migration() === 'false') {
return true;
}
}
}
}
示例13: get_field_input
public function get_field_input($form, $value = '', $entry = null)
{
if (is_array($value)) {
$value = array_values($value);
}
$form_id = $form['id'];
$is_entry_detail = $this->is_entry_detail();
$is_form_editor = $this->is_form_editor();
$is_admin = $is_entry_detail || $is_form_editor;
$id = (int) $this->id;
$field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
$class_suffix = $is_entry_detail ? '_admin' : '';
$form_sub_label_placement = rgar($form, 'subLabelPlacement');
$field_sub_label_placement = $this->subLabelPlacement;
$is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above';
$sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label screen-reader-text'" : '';
$disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
$first_tabindex = $this->get_tabindex();
$last_tabindex = $this->get_tabindex();
$strength_style = !$this->passwordStrengthEnabled ? "style='display:none;'" : '';
$strength_indicator_label = esc_html__('Strength indicator', 'gravityforms');
$strength = $this->passwordStrengthEnabled || $is_admin ? "<div id='{$field_id}_strength_indicator' class='gfield_password_strength' {$strength_style}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$strength_indicator_label}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='hidden' class='gform_hidden' id='{$field_id}_strength' name='input_{$id}_strength' />" : '';
$action = !$is_admin ? "gformShowPasswordStrength(\"{$field_id}\");" : '';
$onchange = $this->passwordStrengthEnabled ? "onchange='{$action}'" : '';
$onkeyup = $this->passwordStrengthEnabled ? "onkeyup='{$action}'" : '';
$confirmation_value = rgpost('input_' . $id . '_2');
$password_value = is_array($value) ? $value[0] : $value;
$password_value = esc_attr($password_value);
$confirmation_value = esc_attr($confirmation_value);
$enter_password_field_input = GFFormsModel::get_input($this, $this->id . '');
$confirm_password_field_input = GFFormsModel::get_input($this, $this->id . '.2');
$enter_password_label = rgar($enter_password_field_input, 'customLabel') != '' ? $enter_password_field_input['customLabel'] : esc_html__('Enter Password', 'gravityforms');
$enter_password_label = gf_apply_filters(array('gform_password', $form_id), $enter_password_label, $form_id);
$confirm_password_label = rgar($confirm_password_field_input, 'customLabel') != '' ? $confirm_password_field_input['customLabel'] : esc_html__('Confirm Password', 'gravityforms');
$confirm_password_label = gf_apply_filters(array('gform_password_confirm', $form_id), $confirm_password_label, $form_id);
$required_attribute = $this->isRequired ? 'aria-required="true"' : '';
$invalid_attribute = $this->failed_validation ? 'aria-invalid="true"' : 'aria-invalid="false"';
$enter_password_placeholder_attribute = GFCommon::get_input_placeholder_attribute($enter_password_field_input);
$confirm_password_placeholder_attribute = GFCommon::get_input_placeholder_attribute($confirm_password_field_input);
if ($is_sub_label_above) {
return "<div class='ginput_complex{$class_suffix} ginput_container ginput_container_password' id='{$field_id}_container'>\n\t\t\t\t\t<span id='{$field_id}_1_container' class='ginput_left'>\n\t\t\t\t\t\t<label for='{$field_id}' {$sub_label_class_attribute}>{$enter_password_label}</label>\n\t\t\t\t\t\t<input type='password' name='input_{$id}' id='{$field_id}' {$onkeyup} {$onchange} value='{$password_value}' {$first_tabindex} {$enter_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span id='{$field_id}_2_container' class='ginput_right'>\n\t\t\t\t\t\t<label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_password_label}</label>\n\t\t\t\t\t\t<input type='password' name='input_{$id}_2' id='{$field_id}_2' {$onkeyup} {$onchange} value='{$confirmation_value}' {$last_tabindex} {$confirm_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t</span>\n\t\t\t\t\t<div class='gf_clear gf_clear_complex'></div>\n\t\t\t\t</div>{$strength}";
} else {
return "<div class='ginput_complex{$class_suffix} ginput_container ginput_container_password' id='{$field_id}_container'>\n\t\t\t\t\t<span id='{$field_id}_1_container' class='ginput_left'>\n\t\t\t\t\t\t<input type='password' name='input_{$id}' id='{$field_id}' {$onkeyup} {$onchange} value='{$password_value}' {$first_tabindex} {$enter_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t\t<label for='{$field_id}' {$sub_label_class_attribute}>{$enter_password_label}</label>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span id='{$field_id}_2_container' class='ginput_right'>\n\t\t\t\t\t\t<input type='password' name='input_{$id}_2' id='{$field_id}_2' {$onkeyup} {$onchange} value='{$confirmation_value}' {$last_tabindex} {$confirm_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t\t<label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_password_label}</label>\n\t\t\t\t\t</span>\n\t\t\t\t\t<div class='gf_clear gf_clear_complex'></div>\n\t\t\t\t</div>{$strength}";
}
}
示例14: maybe_export
public static function maybe_export()
{
if (isset($_POST['export_lead'])) {
check_admin_referer('rg_start_export', 'rg_start_export_nonce');
//see if any fields chosen
if (empty($_POST['export_field'])) {
GFCommon::add_error_message(__('Please select the fields to be exported', 'gravityforms'));
return;
}
$form_id = $_POST['export_form'];
$form = RGFormsModel::get_form_meta($form_id);
$filename = sanitize_title_with_dashes($form['title']) . '-' . gmdate('Y-m-d', GFCommon::get_local_timestamp(time())) . '.csv';
$charset = get_option('blog_charset');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: text/csv; charset=' . $charset, true);
$buffer_length = ob_get_length();
//length or false if no buffer
if ($buffer_length > 1) {
ob_clean();
}
GFExport::start_export($form);
die;
} else {
if (isset($_POST['export_forms'])) {
check_admin_referer('gf_export_forms', 'gf_export_forms_nonce');
$selected_forms = rgpost('gf_form_id');
if (empty($selected_forms)) {
GFCommon::add_error_message(__('Please select the forms to be exported', 'gravityforms'));
return;
}
$forms = RGFormsModel::get_form_meta_by_id($selected_forms);
$forms = self::prepare_forms_for_export($forms);
$forms['version'] = GFForms::$version;
$forms_json = json_encode($forms);
$filename = 'gravityforms-export-' . date('Y-m-d') . '.json';
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
echo $forms_json;
die;
}
}
}
示例15: ecs_gform_add_bsn_validation
/**
* Validate the given BSN number
*/
function ecs_gform_add_bsn_validation($validation_result)
{
foreach ($validation_result['form']['fields'] as &$field) {
$field_value = rgpost("input_{$field['id']}");
if ('bsn' == $field['inputMaskValue']) {
if (0 == strlen($field_value)) {
// If empty dont check, when the field is required GF will automaticly catch that before us.
continue;
} else {
if (!ecs_validate_bsn($field_value)) {
$validation_result['is_valid'] = false;
$field['failed_validation'] = true;
$field['validation_message'] = __('Please enter a valid value.', 'gravityforms');
}
}
}
}
return $validation_result;
}