当前位置: 首页>>代码示例>>PHP>>正文


PHP RGFormsModel::create_lead方法代码示例

本文整理汇总了PHP中RGFormsModel::create_lead方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::create_lead方法的具体用法?PHP RGFormsModel::create_lead怎么用?PHP RGFormsModel::create_lead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::create_lead方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_form_data

 private static function get_form_data($form, $config)
 {
     // get products
     $tmp_lead = RGFormsModel::create_lead($form);
     $products = GFCommon::get_product_fields($form, $tmp_lead);
     $form_data = array();
     // getting billing information
     $form_data["form_title"] = $form["title"];
     $form_data["email"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["email"]));
     $form_data["address1"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["address1"]));
     $form_data["address2"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["address2"]));
     $form_data["city"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["city"]));
     $form_data["state"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["state"]));
     $form_data["zip"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["zip"]));
     $form_data["country"] = rgpost('input_' . str_replace(".", "_", $config["meta"]["customer_fields"]["country"]));
     $card_field = self::get_creditcard_field($form);
     $form_data["card_number"] = rgpost("input_{$card_field["id"]}_1");
     $form_data["expiration_date"] = rgpost("input_{$card_field["id"]}_2");
     $form_data["security_code"] = rgpost("input_{$card_field["id"]}_3");
     $form_data["card_name"] = rgpost("input_{$card_field["id"]}_5");
     $names = explode(" ", $form_data["card_name"]);
     $form_data["first_name"] = rgar($names, 0);
     $form_data["last_name"] = "";
     if (count($names) > 0) {
         unset($names[0]);
         $form_data["last_name"] = implode(" ", $names);
     }
     if (!empty($config["meta"]["setup_fee_enabled"])) {
         $order_info = self::get_order_info($products, rgar($config["meta"], "recurring_amount_field"), rgar($config["meta"], "setup_fee_amount_field"));
     } else {
         $order_info = self::get_order_info($products, rgar($config["meta"], "recurring_amount_field"), "");
     }
     $form_data["line_items"] = $order_info["line_items"];
     $form_data["amount"] = $order_info["amount"];
     $form_data["fee_amount"] = $order_info["fee_amount"];
     // need an easy way to filter the the order info as it is not modifiable once it is added to the transaction object
     $form_data = apply_filters("gform_authorizenet_form_data_{$form['id']}", apply_filters('gform_authorizenet_form_data', $form_data, $form, $config), $form, $config);
     return $form_data;
 }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:39,代码来源:authorizenet.php

示例2: update_entry

 private function update_entry($form, $lead)
 {
     /*
      * Create a new $lead based on the $_POST values and merge 
      * them into the existing $lead array.
      */
     $post_lead = RGFormsModel::create_lead($form);
     /*
      * Final check that the current user can edit the entry 
      */
     if ($lead['created_by'] != $post_lead['created_by']) {
         /*
          * TODO: log error here 
          */
         return false;
     }
     /*
      * Refine the post lead and remove unwanted, restricted and hidden
      */
     $remove_keys = array('id', 'post_id', 'date_created', 'form_id', 'ip', 'source_url', 'user_agent', 'currency', 'created_by');
     foreach ($remove_keys as $k) {
         unset($post_lead[$k]);
     }
     $this->unset_lead_data($post_lead, $this->atts['restricted_fields']);
     $this->unset_lead_data($post_lead, $this->atts['hidden_fields']);
     foreach ($form['fields'] as $field) {
         switch (RGFormsModel::get_input_type($field)) {
             case "captcha":
             case "html":
             case "password":
             case "product":
             case "coupon":
             case "quantity":
             case "shipping":
             case "donation":
             case "total":
             case "singleproduct":
             case "hiddenproduct":
             case "singleshipping":
             case "creditcard":
             case "page":
             case "post_image":
             case "fileupload":
                 if (isset($post_lead[$field['id']])) {
                     unset($post_lead[$field['id']]);
                 }
                 break;
             default:
                 /*
                  * Check if the field is hidden on the form and then set the value to empty in the new array
                  */
                 if (RGFormsModel::is_field_hidden($form, $field, $post_lead)) {
                     /*
                      * Just reset all values to blank (even if they don't actually exist) 
                      * and we will handle the real merging below. This cuts back on checking field types 
                      * and adding particular overrides for particular fields. 
                      */
                     $post_lead[$field['id']] = '';
                     $post_lead[$field['id'] . '.1'] = '';
                     $post_lead[$field['id'] . '.2'] = '';
                     $post_lead[$field['id'] . '.3'] = '';
                     $post_lead[$field['id'] . '.4'] = '';
                     $post_lead[$field['id'] . '.5'] = '';
                     $post_lead[$field['id'] . '.6'] = '';
                 }
                 break;
         }
     }
     /* 
      * Now lets merge down the post lead with the original 
      * array_merge() doesn't function correctly because of the mixed indexes 
      * and array_replace is PHP5.3 and up, so instead we'll manually write the replace function
      */
     foreach ($lead as $key => $val) {
         /*
          * Check if 
          */
         if (isset($post_lead[$key])) {
             $lead[$key] = $post_lead[$key];
         }
     }
     /*
      * Now lets update the entry using the Gravity Forms API
      */
     $update = GFAPI::update_entry($lead);
     if (is_wp_error($update)) {
         /*
          * TODO: log error 
          */
         return false;
     }
     /* we reached hear so the lead was successfully updated */
     return true;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:94,代码来源:entry-edit-logic.php

示例3: 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"]);
//.........这里部分代码省略.........
开发者ID:bryanmonzon,项目名称:jenjonesdirect,代码行数:101,代码来源:paypalpro.php

示例4: get_form_data

 /**
  * Get form data
  *
  * @since
  *
  * @uses RGFormsModel::create_lead()
  * @uses GFCommon::get_product_fields()
  * @uses rgpost()
  * @uses apply_filters()
  * @uses GFP_Stripe::get_order_info()
  *
  * @param $form
  * @param $feed
  *
  * @return mixed|void
  */
 public static function get_form_data($form, $feed)
 {
     // get products
     $tmp_lead = RGFormsModel::create_lead($form);
     $products = GFCommon::get_product_fields($form, $tmp_lead);
     $form_data = array();
     // getting billing information
     $form_data['form_title'] = $form['title'];
     $form_data['name'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['first_name'])) . ' ' . rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['last_name']));
     $form_data['email'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['email']));
     $form_data['address1'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['address1']));
     $form_data['address2'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['address2']));
     $form_data['city'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['city']));
     $form_data['state'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['state']));
     $form_data['zip'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['zip']));
     $form_data['country'] = rgpost('input_' . str_replace('.', '_', $feed['meta']['customer_fields']['country']));
     $form_data["credit_card"] = rgpost('stripeToken');
     $form_data = apply_filters('gfp_stripe_get_form_data', $form_data, $feed, $products);
     $order_info_args = '';
     $order_info = self::$_this->get_order_info($products, apply_filters('gfp_stripe_get_form_data_order_info', $order_info_args, $feed));
     $form_data["line_items"] = $order_info["line_items"];
     $form_data["amount"] = $order_info["amount"];
     return $form_data;
 }
开发者ID:braddalton,项目名称:Gravity-Forms-Stripe,代码行数:40,代码来源:class-gfp-stripe.php

示例5: create_lead

 /**
  * Retrieves $lead object from class if it has already been created; otherwise creates a new $lead object.
  */
 public static function create_lead($form)
 {
     $lead = !empty(self::$lead) ? self::$lead : RGFormsModel::create_lead($form);
     self::$lead = $lead;
     return $lead;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:9,代码来源:gf_preview.php


注:本文中的RGFormsModel::create_lead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。