本文整理汇总了PHP中GF_Fields::get方法的典型用法代码示例。如果您正苦于以下问题:PHP GF_Fields::get方法的具体用法?PHP GF_Fields::get怎么用?PHP GF_Fields::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GF_Fields
的用法示例。
在下文中一共展示了GF_Fields::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forms_page
public static function forms_page($form_id)
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
$update_result = '';
if (rgpost('operation') == 'trash') {
check_admin_referer('gforms_trash_form', 'gforms_trash_form');
GFFormsModel::trash_form($form_id);
?>
<script type="text/javascript">
jQuery(document).ready(
function () {
document.location.href = '?page=gf_edit_forms';
}
);
</script>
<?php
exit;
} else {
if (!rgempty('gform_meta')) {
check_admin_referer("gforms_update_form_{$form_id}", 'gforms_update_form');
$update_result = self::save_form_info($form_id, rgpost('gform_meta', false));
}
}
require_once GFCommon::get_base_path() . '/currency.php';
wp_print_styles(array('thickbox'));
/* @var GF_Field_Address $gf_address_field */
$gf_address_field = GF_Fields::get('address');
?>
<link rel="stylesheet" href="<?php
echo GFCommon::get_base_url();
?>
/css/admin.css?ver=<?php
echo GFCommon::$version;
?>
" type="text/css" />
<script type="text/javascript">
<?php
GFCommon::gf_global();
?>
<?php
GFCommon::gf_vars();
?>
</script>
<script type="text/javascript">
function has_entry(fieldNumber) {
var submitted_fields = [<?php
echo RGFormsModel::get_submitted_fields($form_id);
?>
];
for (var i = 0; i < submitted_fields.length; i++) {
if (submitted_fields[i] == fieldNumber)
return true;
}
return false;
}
function InsertPostImageVariable(element_id, callback) {
var variable = jQuery('#' + element_id + '_image_size_select').attr("variable");
var size = jQuery('#' + element_id + '_image_size_select').val();
if (size) {
variable = "{" + variable + ":" + size + "}";
InsertVariable(element_id, callback, variable);
jQuery('#' + element_id + '_image_size_select').hide();
jQuery('#' + element_id + '_image_size_select')[0].selectedIndex = 0;
}
}
function InsertPostContentVariable(element_id, callback) {
var variable = jQuery('#' + element_id + '_variable_select').val();
var regex = /{([^{]*?: *(\d+\.?\d*).*?)}/;
matches = regex.exec(variable);
if (!matches) {
InsertVariable(element_id, callback);
return;
}
variable = matches[1];
field_id = matches[2];
for (var i = 0; i < form["fields"].length; i++) {
if (form["fields"][i]["id"] == field_id) {
if (form["fields"][i]["type"] == "post_image") {
jQuery('#' + element_id + '_image_size_select').attr("variable", variable);
jQuery('#' + element_id + '_image_size_select').show();
return;
}
}
}
InsertVariable(element_id, callback);
}
//.........这里部分代码省略.........
示例2: get_full_name
/**
* Returns the combined value of the specified Name field.
*
* @param array $entry
* @param string $field_id
*
* @return string
*/
public function get_full_name($entry, $field_id)
{
return GF_Fields::get('name')->get_value_export($entry, $field_id);
}
示例3: Choice
?>
), new Choice(<?php
echo json_encode(esc_html__('Third Choice', 'gravityforms'));
?>
));
}
break;
case "address" :
if (!field.label)
field.label = <?php
echo json_encode(esc_html__('Address', 'gravityforms'));
?>
;
field.addressType = <?php
echo json_encode(GF_Fields::get('address')->get_default_address_type(rgget('id')));
?>
;
field.inputs = [new Input(field.id + 0.1, <?php
echo json_encode(gf_apply_filters(array('gform_address_street', rgget('id')), esc_html__('Street Address', 'gravityforms'), rgget('id')));
?>
), new Input(field.id + 0.2, <?php
echo json_encode(gf_apply_filters(array('gform_address_street2', rgget('id')), esc_html__('Address Line 2', 'gravityforms'), rgget('id')));
?>
), new Input(field.id + 0.3, <?php
echo json_encode(gf_apply_filters(array('gform_address_city', rgget('id')), esc_html__('City', 'gravityforms'), rgget('id')));
?>
),
new Input(field.id + 0.4, <?php
echo json_encode(gf_apply_filters(array('gform_address_state', rgget('id')), __('State / Province', 'gravityforms'), rgget('id')));
?>
示例4: get_full_address
/**
* Returns the combined value of the specified Address field.
*
* @param array $entry
* @param string $field_id
*
* @return string
*/
protected function get_full_address($entry, $field_id)
{
$street_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.1')));
$street2_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.2')));
$city_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.3')));
$state_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.4')));
$zip_value = trim(rgar($entry, $field_id . '.5'));
$country_value = GF_Fields::get('address')->get_country_code(trim(rgar($entry, $field_id . '.6')));
$address = $street_value;
$address .= !empty($address) && !empty($street2_value) ? " {$street2_value}" : $street2_value;
$address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? ", {$city_value}," : $city_value;
$address .= !empty($address) && !empty($city_value) && !empty($state_value) ? " {$state_value}" : $state_value;
$address .= !empty($address) && !empty($zip_value) ? " {$zip_value}," : $zip_value;
$address .= !empty($address) && !empty($country_value) ? " {$country_value}" : $country_value;
return $address;
}
示例5: customer_query_string
public function customer_query_string($feed, $entry)
{
$fields = '';
foreach ($this->get_customer_fields() as $field) {
$field_id = $feed['meta'][$field['meta_name']];
$value = rgar($entry, $field_id);
if ($field['name'] == 'country') {
$value = class_exists('GF_Field_Address') ? GF_Fields::get('address')->get_country_code($value) : GFCommon::get_country_code($value);
} elseif ($field['name'] == 'state') {
$value = class_exists('GF_Field_Address') ? GF_Fields::get('address')->get_us_state_code($value) : GFCommon::get_us_state_code($value);
}
if (!empty($value)) {
$fields .= "&{$field['name']}=" . urlencode($value);
}
}
return $fields;
}
示例6: get_canadian_provinces
public static function get_canadian_provinces()
{
return GF_Fields::get('address')->get_canadian_provinces();
}
示例7: get_canadian_provinces
public static function get_canadian_provinces()
{
if (!defined('DOING_AJAX') || !DOING_AJAX) {
_deprecated_function('GFCommon::get_canadian_provinces', '1.9', 'GF_Field_Address::get_canadian_provinces');
}
return GF_Fields::get('address')->get_canadian_provinces();
}
示例8: get_address
private function get_address($entry, $field_id)
{
$street_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.1')));
$street2_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.2')));
$city_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.3')));
$state_value = str_replace(' ', ' ', trim(rgar($entry, $field_id . '.4')));
$zip_value = trim(rgar($entry, $field_id . '.5'));
$country_value = trim(rgar($entry, $field_id . '.6'));
if (!empty($country_value)) {
$country_value = class_exists('GF_Field_Address') ? GF_Fields::get('address')->get_country_code($country_value) : GFCommon::get_country_code($country_value);
}
$address = array(!empty($street_value) ? $street_value : '-', $street2_value, !empty($city_value) ? $city_value : '-', !empty($state_value) ? $state_value : '-', !empty($zip_value) ? $zip_value : '-', $country_value);
return implode(' ', $address);
}
示例9: add_filter
add_filter('gform_field_value_enroll_billing_zip', create_function("", '$value = populate_usermeta("billing_postcode"); return $value;'));
add_filter('gform_field_value_enroll_billing_country', create_function("", '$value = populate_usermeta("billing_country"); return $value;'));
//Prepopulate Shipping Fields if able
add_filter('gform_field_value_enroll_shipping_firstname', create_function("", '$value = populate_usermeta("shipping_first_name"); return $value;'));
add_filter('gform_field_value_enroll_shipping_lastname', create_function("", '$value = populate_usermeta("shipping_last_name"); return $value;'));
add_filter('gform_field_value_enroll_shipping_company', create_function("", '$value = populate_usermeta("shipping_company"); return $value;'));
add_filter('gform_field_value_enroll_shipping_address', create_function("", '$value = populate_usermeta("shipping_address_1"); return $value;'));
add_filter('gform_field_value_enroll_shipping_address2', create_function("", '$value = populate_usermeta("shipping_address_2"); return $value;'));
add_filter('gform_field_value_enroll_shipping_city', create_function("", '$value = populate_usermeta("shipping_city"); return $value;'));
add_filter('gform_field_value_enroll_shipping_state', create_function("", '$value = populate_usermeta("shipping_state"); return $value;'));
add_filter('gform_field_value_enroll_shipping_zip', create_function("", '$value = populate_usermeta("shipping_postcode"); return $value;'));
add_filter('gform_field_value_enroll_shipping_country', create_function("", '$value = populate_usermeta("shipping_country"); return $value;'));
add_filter('gform_countries', function ($countries) {
$new_countries = array();
foreach ($countries as $country) {
$code = GF_Fields::get('address')->get_country_code($country);
$new_countries[$code] = $country;
}
return $new_countries;
});
add_filter("gform_pre_render_5", 'populate_checkbox');
add_filter("gform_admin_pre_render_5", 'populate_checkbox');
//pre_render our scripts to update checkboxes
function populate_checkbox($form)
{
global $current_user;
$value = populate_usermeta_doc("billing_country");
//console_log('current user= ' . print_r($current_user->data->ID));
//Allergies
$no_allergies = get_post_meta($current_user->data->ID, '_no-allergies');
$penicillin = get_post_meta($current_user->data->ID, '_penicillin');
示例10: paypalpro_validation
public static function paypalpro_validation($validation_result)
{
$config = self::is_ready_for_capture($validation_result);
if (!$config) {
return $validation_result;
}
require_once self::get_base_path() . "/data.php";
// Determine if feed specific api settings are enabled
$local_api_settings = array();
if ($config["meta"]["api_settings_enabled"] == 1) {
$local_api_settings = self::get_local_api_settings($config);
}
// Billing
$card_field = self::get_creditcard_field($validation_result["form"]);
$card_number = rgpost("input_{$card_field["id"]}_1");
$card_type = GFCommon::get_card_type($card_number);
$expiration_date = rgpost("input_{$card_field["id"]}_2");
$country = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["country"]));
$country = class_exists('GF_Field_Address') ? GF_Fields::get('address')->get_country_code($country) : GFCommon::get_country_code($country);
$billing = array();
$billing['CREDITCARDTYPE'] = $card_type["slug"];
$billing['ACCT'] = $card_number;
$billing['EXPDATE'] = $expiration_date[0] . $expiration_date[1];
$billing['CVV2'] = rgpost("input_{$card_field["id"]}_3");
$billing['STREET'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["address1"]));
$billing['STREET2'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["address2"]));
$billing['CITY'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["city"]));
$billing['STATE'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["state"]));
$billing['ZIP'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["zip"]));
$billing['COUNTRYCODE'] = $country == "UK" ? "GB" : $country;
$billing['CURRENCYCODE'] = GFCommon::get_currency();
// Customer Contact
$billing['FIRSTNAME'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["first_name"]));
$billing['LASTNAME'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["last_name"]));
$billing['EMAIL'] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["email"]));
$lead = RGFormsModel::create_lead($validation_result["form"]);
$product_billing_data = self::get_product_billing_data($validation_result["form"], $lead, $config);
$amount = $product_billing_data["amount"];
$products = $product_billing_data["products"];
$billing = array_merge($billing, $product_billing_data["billing"]);
if ($config["meta"]["type"] == "product") {
if ($amount == 0) {
//blank out credit card field if this is the last page
if (self::is_last_page($validation_result["form"])) {
$_POST["input_{$card_field["id"]}_1"] = "";
}
//creating dummy transaction response if there are any visible product fields in the form
if (self::has_visible_products($validation_result["form"])) {
self::$transaction_response = array("transaction_id" => "N/A", "amount" => 0, "transaction_type" => 1, 'config_id' => $config['id']);
}
return $validation_result;
}
//setting up a one time payment
$ip = RGFormsModel::get_ip();
$billing['PAYMENTACTION'] = "Sale";
$billing['IPADDRESS'] = $ip == "::1" ? "127.0.0.1" : $ip;
$billing['RETURNFMFDETAILS'] = "1";
$billing['BUTTONSOURCE'] = 'gravityforms';
$billing['AMT'] = $amount;
$billing['NOTIFYURL'] = get_bloginfo("url") . "/?page=gf_paypalpro_ipn";
self::log_debug("Sending one time payment.");
$response = self::post_to_paypal("DoDirectPayment", $billing, $local_api_settings, $validation_result["form"], $lead);
if (!empty($response) && !empty($response["TRANSACTIONID"])) {
self::$transaction_response = array("transaction_id" => $response["TRANSACTIONID"], "subscription_amount" => 0, "initial_payment_amount" => $response["AMT"], "transaction_type" => 1, 'config_id' => $config['id']);
self::log_debug("Payment successful.");
return $validation_result;
} else {
// Payment was not succesful, need to display error message
self::log_error("Payment was NOT successful.");
return self::set_validation_result($validation_result, $_POST, $response, "capture");
}
} else {
//setting up a recurring payment
$billing['PROFILESTARTDATE'] = gmdate(DATE_ATOM);
$billing['SUBSCRIBERNAME'] = $billing['FIRSTNAME'] . " " . $billing['LASTNAME'];
$billing['MAXFAILEDPAYMENTS'] = "0";
$interval_unit = self::get_interval_unit($config["meta"]["billing_cycle_type"]);
$interval_length = $config["meta"]["billing_cycle_number"];
$billing['BILLINGPERIOD'] = $interval_unit;
$billing['BILLINGFREQUENCY'] = $interval_length;
$billing['TOTALBILLINGCYCLES'] = $config["meta"]["recurring_times"];
$billing['AMT'] = $amount;
//setup fee
$setup_fee_amount = 0;
if ($config["meta"]["setup_fee_enabled"]) {
$setup_fee_product = rgar($products["products"], $config["meta"]["setup_fee_amount_field"]);
if (!empty($setup_fee_product)) {
$setup_fee_amount = self::get_product_price($setup_fee_product);
$billing['INITAMT'] = $setup_fee_amount;
}
}
//trial
$trial_amount = 0;
if ($config["meta"]["trial_period_enabled"]) {
if ($config["meta"]["trial_type"] == "paid") {
$trial_product = rgar($products["products"], $config["meta"]["trial_amount_field"]);
$trial_amount = empty($trial_product) ? 0 : self::get_product_price($trial_product);
$billing["TRIALAMT"] = $trial_amount;
}
$billing["TRIALBILLINGPERIOD"] = self::get_interval_unit($config["meta"]["trial_period_type"]);
//.........这里部分代码省略.........