本文整理汇总了PHP中gform_get_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP gform_get_meta函数的具体用法?PHP gform_get_meta怎么用?PHP gform_get_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gform_get_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_post_content
function set_post_content($entry, $form)
{
//$headers[] = "Content-type: text/html";
$pending_meta_value = gform_get_meta($entry["id"], "is_pending");
if ($pending_meta_value == "1") {
// wp_mail('tim@automationlab.com.au', 'Form has been saved', print_r($entry, true), $headers);
$entry["orderStatus"] = "incomplete";
$output = GFAPI::update_entry($entry, $entry["id"]);
} else {
$entry["orderStatus"] = "complete";
$entry["unique_id"] = guid();
//wp_mail('tim@automationlab.com.au', 'Getting the Gravity Form Field IDs', print_r($entry, true), $headers);
//wp_mail('tim@automationlab.com.au', 'Getting the Gravity Form Data', print_r($form, true), $headers);
$output = GFAPI::update_entry($entry, $entry["id"]);
global $wpdb;
//look up row in lead table, update asic status and update with eCompanies order number.
$update = $wpdb->query($wpdb->prepare("UPDATE wp_rg_lead SET unique_id='" . $entry["unique_id"] . "' WHERE id=" . $entry['id'] . " AND form_id=" . $entry['form_id']));
// wp_mail('tim@automationlab.com.au', 'Getting the Gravity Form Field IDs', print_r($update, true), $headers);
}
}
示例2: entry_info
/**
* Render entry info of the specified form and lead
*
* @param string $form_id
* @param array $lead
*/
public static function entry_info($form_id, $lead)
{
$payment_id = gform_get_meta($lead['id'], 'pronamic_payment_id');
if ($payment_id) {
printf('<a href="%s">%s</a>', esc_attr(get_edit_post_link($payment_id)), esc_html(get_the_title($payment_id)));
}
}
示例3: get_pronamic_gf_pay_feed_by_entry_id
function get_pronamic_gf_pay_feed_by_entry_id($entry_id)
{
$feed_id = gform_get_meta($entry_id, 'ideal_feed_id');
if (!empty($feed_id)) {
return new Pronamic_WP_Pay_Extensions_GravityForms_PayFeed($feed_id);
}
return null;
}
示例4: entry_info_link_to_salesforce
function entry_info_link_to_salesforce($form_id, $lead)
{
$salesforce_id = gform_get_meta($lead['id'], 'salesforce_id');
if (!empty($salesforce_id)) {
echo sprintf(__('Salesforce ID: <a href="https://na9.salesforce.com/' . $salesforce_id . '">%s</a><br /><br />', 'gravity-forms-salesforce'), $salesforce_id);
}
}
示例5: admin_update_payment
public static function admin_update_payment($form, $lead_id)
{
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
//update payment information in admin, need to use this function so the lead data is updated before displayed in the sidebar info section
//check meta to see if this entry is paypal
$payment_gateway = gform_get_meta($lead_id, "payment_gateway");
$form_action = strtolower(rgpost("save"));
if ($payment_gateway != "paypal" || $form_action != "update") {
return;
}
//get lead
$lead = RGFormsModel::get_lead($lead_id);
//get payment fields to update
$payment_status = rgpost("payment_status");
//when updating, payment status may not be editable, if no value in post, set to lead payment status
if (empty($payment_status)) {
$payment_status = $lead["payment_status"];
}
$payment_amount = rgpost("payment_amount");
$payment_transaction = rgpost("paypal_transaction_id");
$payment_date = rgpost("payment_date");
if (empty($payment_date)) {
$payment_date = gmdate("y-m-d H:i:s");
} else {
//format date entered by user
$payment_date = date("Y-m-d H:i:s", strtotime($payment_date));
}
global $current_user;
$user_id = 0;
$user_name = "System";
if ($current_user && ($user_data = get_userdata($current_user->ID))) {
$user_id = $current_user->ID;
$user_name = $user_data->display_name;
}
$lead["payment_status"] = $payment_status;
$lead["payment_amount"] = $payment_amount;
$lead["payment_date"] = $payment_date;
$lead["transaction_id"] = $payment_transaction;
// if payment status does not equal approved or the lead has already been fulfilled, do not continue with fulfillment
if ($payment_status == 'Approved' && !$lead["is_fulfilled"]) {
//call fulfill order, mark lead as fulfilled
self::fulfill_order($lead, $payment_transaction, $payment_amount);
$lead["is_fulfilled"] = true;
}
//update lead, add a note
RGFormsModel::update_lead($lead);
RGFormsModel::add_note($lead["id"], $user_id, $user_name, sprintf(__("Payment information was manually updated. Status: %s. Amount: %s. Transaction Id: %s. Date: %s", "gravityforms"), $lead["payment_status"], GFCommon::to_money($lead["payment_amount"], $lead["currency"]), $payment_transaction, $lead["payment_date"]));
}
示例6: get_active_config
public static function get_active_config($form, $lead = false)
{
require_once self::get_base_path() . "/data.php";
$config = false;
// if lead is provided, attempt to retrieve config from lead meta
if (isset($lead['id'])) {
$config_id = gform_get_meta($lead['id'], 'user_registration_feed_id');
$config = GFUserData::get_feed($config_id);
}
// if no lead is provided or if meta retrieval fails, get all feeds and find the first feed that matches
if (!$config) {
$configs = GFUserData::get_feeds_by_form($form["id"]);
if (!$configs) {
return false;
}
foreach ($configs as $cnfg) {
if (self::registration_condition_met($form, $cnfg, $lead)) {
$config = $cnfg;
break;
}
}
}
// if lead is provided and a config is found, update lead meta with config ID
if (isset($lead['id']) && $config && !$config_id) {
gform_update_meta($lead['id'], 'user_registration_feed_id', $config['id']);
}
if ($config) {
return $config;
}
return false;
}
示例7: is_payment_gateway
protected function is_payment_gateway($entry_id)
{
if ($this->is_payment_gateway) {
return true;
}
$gateway = gform_get_meta($entry_id, 'payment_gateway');
return $gateway == $this->_slug;
}
示例8: paypal_track_form_post_ipn
/**
* Handle the IPN response for pushing the event
*
* @since 1.4.0
* @param array $post_object global post array from the IPN
* @param array $entry Gravity Forms entry object
*/
public function paypal_track_form_post_ipn($post_object, $entry)
{
// Check if the payment was completed before continuing
if (strtolower($entry['payment_status']) != 'paid') {
return;
}
$form = GFFormsModel::get_form_meta($entry['form_id']);
$ga_event_data = maybe_unserialize(gform_get_meta($entry['id'], 'ga_event_data'));
// Override this coming from paypal IPN
$_COOKIE['_ga'] = $ga_event_data['ga_cookie'];
// Push the event to google
$this->push_event($entry, $form, $ga_event_data);
}
开发者ID:resoundcreative-dev,项目名称:wordpress-gravity-forms-event-tracking,代码行数:20,代码来源:class-gravity-forms-event-tracking-feed.php
示例9: get_product_fields
public static function get_product_fields($form, $lead, $use_choice_text = false, $use_admin_label = false)
{
$products = array();
$product_info = null;
// retrieve static copy of product info (only for "real" entries)
if (!rgempty("id", $lead)) {
$product_info = gform_get_meta(rgar($lead, 'id'), "gform_product_info_{$use_choice_text}_{$use_admin_label}");
}
// if no static copy, generate from form/lead info
if (!$product_info) {
foreach ($form["fields"] as $field) {
$id = $field["id"];
$lead_value = RGFormsModel::get_lead_field_value($lead, $field);
$quantity_field = self::get_product_fields_by_type($form, array("quantity"), $id);
$quantity = sizeof($quantity_field) > 0 && !RGFormsModel::is_field_hidden($form, $quantity_field[0], array(), $lead) ? RGFormsModel::get_lead_field_value($lead, $quantity_field[0]) : 1;
switch ($field["type"]) {
case "product":
//ignore products that have been hidden by conditional logic
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array(), $lead);
if ($is_hidden) {
continue;
}
//if single product, get values from the multiple inputs
if (is_array($lead_value)) {
$product_quantity = sizeof($quantity_field) == 0 && !rgar($field, "disableQuantity") ? rgget($id . ".3", $lead_value) : $quantity;
if (empty($product_quantity)) {
continue;
}
if (!rgget($id, $products)) {
$products[$id] = array();
}
$products[$id]["name"] = $use_admin_label && !rgempty("adminLabel", $field) ? $field["adminLabel"] : $lead_value[$id . ".1"];
$products[$id]["price"] = $lead_value[$id . ".2"];
$products[$id]["quantity"] = $product_quantity;
} else {
if (!empty($lead_value)) {
if (empty($quantity)) {
continue;
}
if (!rgar($products, $id)) {
$products[$id] = array();
}
if ($field["inputType"] == "price") {
$name = $field["label"];
$price = $lead_value;
} else {
list($name, $price) = explode("|", $lead_value);
}
$products[$id]["name"] = !$use_choice_text ? $name : RGFormsModel::get_choice_text($field, $name);
$products[$id]["price"] = $price;
$products[$id]["quantity"] = $quantity;
$products[$id]["options"] = array();
}
}
if (isset($products[$id])) {
$options = self::get_product_fields_by_type($form, array("option"), $id);
foreach ($options as $option) {
$option_value = RGFormsModel::get_lead_field_value($lead, $option);
$option_label = empty($option["adminLabel"]) ? $option["label"] : $option["adminLabel"];
if (is_array($option_value)) {
foreach ($option_value as $value) {
$option_info = self::get_option_info($value, $option, $use_choice_text);
if (!empty($option_info)) {
$products[$id]["options"][] = array("field_label" => rgar($option, "label"), "option_name" => rgar($option_info, "name"), "option_label" => $option_label . ": " . rgar($option_info, "name"), "price" => rgar($option_info, "price"));
}
}
} else {
if (!empty($option_value)) {
$option_info = self::get_option_info($option_value, $option, $use_choice_text);
$products[$id]["options"][] = array("field_label" => rgar($option, "label"), "option_name" => rgar($option_info, "name"), "option_label" => $option_label . ": " . rgar($option_info, "name"), "price" => rgar($option_info, "price"));
}
}
}
}
break;
}
}
$shipping_field = self::get_fields_by_type($form, array("shipping"));
$shipping_price = $shipping_name = "";
if (!empty($shipping_field) && !RGFormsModel::is_field_hidden($form, $shipping_field[0], array(), $lead)) {
$shipping_price = RGFormsModel::get_lead_field_value($lead, $shipping_field[0]);
$shipping_name = $shipping_field[0]["label"];
if ($shipping_field[0]["inputType"] != "singleshipping") {
list($shipping_method, $shipping_price) = explode("|", $shipping_price);
$shipping_name = $shipping_field[0]["label"] . " ({$shipping_method})";
}
}
$shipping_price = self::to_number($shipping_price);
$product_info = array("products" => $products, "shipping" => array("name" => $shipping_name, "price" => $shipping_price));
$product_info = apply_filters("gform_product_info_{$form["id"]}", apply_filters("gform_product_info", $product_info, $form, $lead), $form, $lead);
// save static copy of product info (only for "real" entries)
if (!rgempty("id", $lead) && !empty($product_info["products"])) {
gform_update_meta($lead['id'], "gform_product_info_{$use_choice_text}_{$use_admin_label}", $product_info);
}
}
return $product_info;
}
示例10: add_entry_approved_hidden_input
public static function add_entry_approved_hidden_input($form_id, $field_id, $value, $entry, $query_string)
{
if (!GVCommon::has_cap('gravityview_moderate_entries', $entry['id'])) {
return;
}
if (empty($entry['id'])) {
return;
}
if (gform_get_meta($entry['id'], 'is_approved')) {
echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry['id'] . '" value="true" />';
}
}
示例11: pdf_download_link
function pdf_download_link($text, $form, $entry, $url_encode, $esc_html, $nl2br, $format)
{
$custom_merge_tag = '{pdf_download_link}';
if (strpos($text, $custom_merge_tag) === false) {
return $text;
}
$download_link = gform_get_meta($entry['id'], 'gf_pdf_url');
$download_link = "<a href='{$download_link}'> Download PDF Here</a>";
$text = str_replace($custom_merge_tag, $download_link, $text);
return $text;
}
示例12: gformAfterUpdateEntry
/**
* update payment status if it has changed
* @param array $form
* @param int $lead_id
*/
public function gformAfterUpdateEntry($form, $lead_id)
{
// make sure we have permission
check_admin_referer('gforms_save_entry', 'gforms_save_entry');
// check that save action is for update
if (strtolower(rgpost('save')) != 'update') {
return;
}
// make sure payment is one of ours (probably)
$payment_gateway = gform_get_meta($lead_id, 'payment_gateway');
if (empty($payment_gateway) && GFEwayPlugin::isEwayForm($form['id'], $form['fields']) || $payment_gateway != 'gfeway') {
return;
}
// make sure we have a new payment status
$payment_status = rgpost('payment_status');
if (empty($payment_status)) {
return;
}
// update payment status
$lead = GFFormsModel::get_lead($lead_id);
$lead['payment_status'] = $payment_status;
GFFormsModel::update_lead($lead);
}
示例13: export_entries_add_values
/**
* Populate meta field values when exporting entries
* @param string $value Value of the field being exported
* @param int $form_id ID of the current form.
* @param int $field_id ID of the current field.
* @param object $lead The current entry.
* @return string
*/
public static function export_entries_add_values($value, $form_id, $field_id, $lead)
{
switch ($field_id) {
case 'salesforce_id':
$value = gform_get_meta($lead['id'], 'salesforce_id');
break;
case 'salesforce_api_result':
$value = gform_get_meta($lead['id'], 'salesforce_api_result');
break;
}
return $value;
}
示例14: paypal_fulfillment
public static function paypal_fulfillment($entry, $config, $transaction_id, $amount)
{
//has this entry been already subscribed?
$is_subscribed = gform_get_meta($entry["id"], "mailchimp_is_subscribed");
if (!$is_subscribed) {
$form = RGFormsModel::get_form_meta($entry['form_id']);
self::export($entry, $form, true);
}
}
示例15: cancel_subscription
private static function cancel_subscription($lead)
{
$lead["payment_status"] = "Canceled";
RGFormsModel::update_lead($lead);
//loading data class
$feed_id = gform_get_meta($lead["id"], "authorize.net_feed_id");
require_once self::get_base_path() . "/data.php";
$config = GFAuthorizeNetData::get_feed($feed_id);
if (!$config) {
return;
}
//1- delete post or mark it as a draft based on configuration
if (rgars($config, "meta/update_post_action") == "draft" && !rgempty("post_id", $lead)) {
$post = get_post($lead["post_id"]);
$post->post_status = 'draft';
wp_update_post($post);
} else {
if (rgars($config, "meta/update_post_action") == "delete" && !rgempty("post_id", $lead)) {
wp_delete_post($lead["post_id"]);
}
}
//2- call subscription canceled hook
do_action("gform_subscription_canceled", $lead, $config, $lead["transaction_id"], "authorize.net");
}