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


PHP GFCommon::get_order_total方法代码示例

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


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

示例1: admin_edit_payment_status_details

    public static function admin_edit_payment_status_details($form_id, $lead)
    {
        //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 != "edit") {
            return;
        }
        //get data from entry to pre-populate fields
        $payment_amount = rgar($lead, "payment_amount");
        if (empty($payment_amount)) {
            $form = RGFormsModel::get_form_meta($form_id);
            $payment_amount = GFCommon::get_order_total($form, $lead);
        }
        $transaction_id = rgar($lead, "transaction_id");
        $payment_date = rgar($lead, "payment_date");
        if (empty($payment_date)) {
            $payment_date = gmdate("y-m-d H:i:s");
        }
        //display edit fields
        ?>
		<div id="edit_payment_status_details" style="display:block">
			<table>
				<tr>
					<td colspan="2"><strong>Payment Information</strong></td>
				</tr>

				<tr>
					<td>Date:<?php 
        gform_tooltip("paypal_edit_payment_date");
        ?>
</td>
					<td><input type="text" id="payment_date" name="payment_date" value="<?php 
        echo $payment_date;
        ?>
"></td>
				</tr>
				<tr>
					<td>Amount:<?php 
        gform_tooltip("paypal_edit_payment_amount");
        ?>
</td>
					<td><input type="text" id="payment_amount" name="payment_amount" value="<?php 
        echo $payment_amount;
        ?>
"></td>
				</tr>
				<tr>
					<td nowrap>Transaction ID:<?php 
        gform_tooltip("paypal_edit_payment_transaction_id");
        ?>
</td>
					<td><input type="text" id="paypal_transaction_id" name="paypal_transaction_id" value="<?php 
        echo $transaction_id;
        ?>
"></td>
				</tr>
			</table>
		</div>
		<?php 
    }
开发者ID:bryanmonzon,项目名称:jenjonesdirect,代码行数:61,代码来源:paypal.php

示例2: prepare_value

 /**
  * Prepare the value before saving it to the lead.
  *
  * @param mixed $form
  * @param mixed $field
  * @param mixed $value
  * @param mixed $input_name
  * @param mixed $lead_id the current lead ID, used for fields that are processed after other fields have been saved (ie Total, Calculations)
  * @param mixed $lead passed by the RGFormsModel::create_lead() method, lead ID is not available for leads created by this function
  */
 public static function prepare_value($form, $field, $value, $input_name, $lead_id, $lead = array())
 {
     $form_id = $form["id"];
     $input_type = self::get_input_type($field);
     switch ($input_type) {
         case "total":
             $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
             $value = GFCommon::get_order_total($form, $lead);
             break;
         case "calculation":
             // ignore submitted value and recalculate price in backend
             list(, , $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == 2) {
                 require_once GFCommon::get_base_path() . '/currency.php';
                 $currency = new RGCurrency(GFCommon::get_currency());
                 $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
                 $value = $currency->to_money(GFCommon::calculate($field, $form, $lead));
             }
             break;
         case "phone":
             if ($field["phoneFormat"] == "standard" && preg_match('/^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/', $value, $matches)) {
                 $value = sprintf("(%s)%s-%s", $matches[1], $matches[2], $matches[3]);
             }
             break;
         case "time":
             if (!is_array($value) && !empty($value)) {
                 preg_match('/^(\\d*):(\\d*) ?(.*)$/', $value, $matches);
                 $value = array();
                 $value[0] = $matches[1];
                 $value[1] = $matches[2];
                 $value[2] = rgar($matches, 3);
             }
             $hour = empty($value[0]) ? "0" : strip_tags($value[0]);
             $minute = empty($value[1]) ? "0" : strip_tags($value[1]);
             $ampm = strip_tags(rgar($value, 2));
             if (!empty($ampm)) {
                 $ampm = " {$ampm}";
             }
             if (!(empty($hour) && empty($minute))) {
                 $value = sprintf("%02d:%02d%s", $hour, $minute, $ampm);
             } else {
                 $value = "";
             }
             break;
         case "date":
             $value = self::prepare_date($field["dateFormat"], $value);
             break;
         case "post_image":
             $url = self::get_fileupload_value($form_id, $input_name);
             $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : "";
             $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : "";
             $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : "";
             $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : "";
             break;
         case "fileupload":
             $value = self::get_fileupload_value($form_id, $input_name);
             break;
         case "number":
             $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
             $value = GFCommon::has_field_calculation($field) ? GFCommon::round_number(GFCommon::calculate($field, $form, $lead), rgar($field, "calculationRounding")) : GFCommon::clean_number($value, rgar($field, "numberFormat"));
             //return the value as a string when it is zero and a calc so that the "==" comparison done when checking if the field has changed isn't treated as false
             if (GFCommon::has_field_calculation($field) && $value == 0) {
                 $value = "0";
             }
             break;
         case "website":
             if ($value == "http://") {
                 $value = "";
             }
             break;
         case "list":
             if (GFCommon::is_empty_array($value)) {
                 $value = "";
             } else {
                 $value = self::create_list_array($field, $value);
                 $value = serialize($value);
             }
             break;
         case "radio":
             if (rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') {
                 $value = rgpost("input_{$field['id']}_other");
             }
             break;
         case "multiselect":
             $value = empty($value) ? "" : implode(",", $value);
             break;
         case "creditcard":
             //saving last 4 digits of credit card
             list($input_token, $field_id_token, $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == "1") {
//.........这里部分代码省略.........
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:101,代码来源:forms_model.php

示例3: gf_create_user

 public static function gf_create_user($entry, $form, $fulfilled = false)
 {
     self::log_debug("form #{$form['id']} - starting gf_create_user().");
     global $wpdb;
     // if the entry is marked as spam
     if (rgar($entry, 'status') == 'spam') {
         self::log_debug('gf_create_user(): aborting. Entry is marked as spam.');
         return;
     }
     $config = self::get_active_config($form, $entry);
     $is_update_feed = rgars($config, 'meta/feed_type') == 'update';
     // if there is no registration feed or the feed is not active, abandon ship
     if (!$config || !$config['is_active']) {
         self::log_debug('gf_create_user(): aborting. No feed or feed is inactive.');
         return;
     }
     $user_data = self::get_user_data($entry, $form, $config, $is_update_feed);
     if (!$user_data) {
         self::log_debug('gf_create_user(): aborting. user_login or user_email are empty.');
         return;
     }
     // if PayPal Add-on was used for this entry, integrate
     $paypal_config = self::get_paypal_config($form["id"], $entry);
     $delay_paypal_registration = 0;
     $password = '';
     if ($paypal_config) {
         $order_total = GFCommon::get_order_total($form, $entry);
         // delay the registration IF:
         // - the delay registration option is checked
         // - the order total does NOT equal zero (no delay since there will never be a payment)
         // - the payment has not already been fulfilled
         $delay_paypal_registration = $paypal_config['meta']['delay_registration'];
         if ($paypal_config && $delay_paypal_registration && $order_total != 0 && !$fulfilled) {
             self::log_debug('gf_create_user(): aborting. Registration delayed by PayPal feed configuration.');
             //Saving encrypted password in meta
             gform_update_meta($entry['id'], 'userregistration_password', self::encrypt($user_data['password']));
             return;
         } else {
             if ($paypal_config && $delay_paypal_registration && $order_total != 0 && $fulfilled) {
                 //reading encrypted password from meta and removing meta
                 $password = gform_get_meta($entry['id'], 'userregistration_password');
                 if ($password) {
                     $password = self::decrypt($password);
                     gform_delete_meta($entry['id'], 'userregistration_password');
                 }
             }
         }
     }
     // provide filter to allow add-ons to disable registration if needed
     $disable_registration = apply_filters('gform_disable_registration', false, $form, $entry, $fulfilled);
     if ($disable_registration) {
         self::log_debug('gf_create_user(): aborting. gform_disable_registration hook was used.');
         return;
     }
     $user_activation = rgars($config, 'meta/user_activation');
     // if about to create user, check if activation required... only use activation if payment is not fulfilled by payment
     //if manual activation and paypal set to delay registration and paypal fulfilled, need to put in signups table
     if (!$is_update_feed && $user_activation && !$fulfilled || !$is_update_feed && $user_activation && $fulfilled && $delay_paypal_registration) {
         require_once self::get_base_path() . '/includes/signups.php';
         GFUserSignups::prep_signups_functionality();
         $meta = array('lead_id' => $entry['id'], 'user_login' => $user_data['user_login'], 'email' => $user_data['user_email'], 'password' => self::encrypt($user_data['password']));
         $meta = apply_filters('gform_user_registration_signup_meta', $meta, $form, $entry, $config);
         $meta = apply_filters("gform_user_registration_signup_meta_{$form['id']}", $meta, $form, $entry, $config);
         $ms_options = rgars($config, 'meta/multisite_options');
         // save current user details in wp_signups for future activation
         if (is_multisite() && rgar($ms_options, 'create_site') && ($site_data = self::get_site_data($entry, $form, $config))) {
             wpmu_signup_blog($site_data['domain'], $site_data['path'], $site_data['title'], $user_data['user_login'], $user_data['user_email'], $meta);
         } else {
             // wpmu_signup_user() does the following sanitization of the user_login before saving it to the database,
             // we can run this same code here to allow successful retrievel of the activation_key without actually
             // changing the user name when it is activated. 'd smith' => 'dsmith', but when activated, username is 'd smith'.
             $user_data['user_login'] = preg_replace('/\\s+/', '', sanitize_user($user_data['user_login'], true));
             self::log_debug("Calling wpmu_signup_user (sends email with activation link) with login: " . $user_data['user_login'] . " email: " . $user_data['user_email'] . " meta: " . print_r($meta, true));
             wpmu_signup_user($user_data['user_login'], $user_data['user_email'], $meta);
             self::log_debug("Done with wpmu_signup_user");
         }
         $activation_key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s ORDER BY registered DESC LIMIT 1", $user_data['user_login']));
         // used for filtering on activation listing UI
         GFUserSignups::add_signup_meta($entry['id'], $activation_key);
         // abort current sign up, user must activate
         return;
     }
     if ($is_update_feed) {
         self::update_user($entry, $form, $config);
     } else {
         //only run create_user when manual/email activation NOT set
         if (!$user_activation) {
             self::log_debug("in gf_create_user - calling create_user");
             self::create_user($entry, $form, $config, $password);
         }
     }
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:92,代码来源:userregistration.php

示例4: admin_edit_payment_amount

 public function admin_edit_payment_amount($payment_amount, $form, $entry)
 {
     if ($this->payment_details_editing_disabled($entry)) {
         return $payment_amount;
     }
     if (empty($payment_amount)) {
         $payment_amount = GFCommon::get_order_total($form, $entry);
     }
     $input = '<input type="text" id="payment_amount" name="payment_amount" class="gform_currency" value="' . $payment_amount . '">';
     return $input;
 }
开发者ID:chawlie,项目名称:goldenrollers,代码行数:11,代码来源:class-gf-paypal.php

示例5: get_donation_query_string

 private static function get_donation_query_string($form, $entry)
 {
     $fields = "";
     //getting all donation fields
     $donations = GFCommon::get_fields_by_type($form, array("donation"));
     $total = 0;
     $purpose = "";
     foreach ($donations as $donation) {
         $value = RGFormsModel::get_lead_field_value($entry, $donation);
         list($name, $price) = explode("|", $value);
         if (empty($price)) {
             $price = $name;
             $name = $donation["label"];
         }
         $purpose .= $name . ", ";
         $price = GFCommon::to_number($price);
         $total += $price;
     }
     //using product fields for donation if there aren't any legacy donation fields in the form
     if ($total == 0) {
         //getting all product fields
         $products = GFCommon::get_product_fields($form, $entry, true);
         foreach ($products["products"] as $product) {
             $options = "";
             if (is_array($product["options"]) && !empty($product["options"])) {
                 $options = " (";
                 foreach ($product["options"] as $option) {
                     $options .= $option["option_name"] . ", ";
                 }
                 $options = substr($options, 0, strlen($options) - 2) . ")";
             }
             $quantity = GFCommon::to_number($product["quantity"]);
             $quantity_label = $quantity > 1 ? $quantity . " " : "";
             $purpose .= $quantity_label . $product["name"] . $options . ", ";
         }
         $total = GFCommon::get_order_total($form, $entry);
     }
     if (!empty($purpose)) {
         $purpose = substr($purpose, 0, strlen($purpose) - 2);
     }
     $purpose = urlencode($purpose);
     //truncating to maximum length allowed by PayPal
     if (strlen($purpose) > 127) {
         $purpose = substr($purpose, 0, 124) . "...";
     }
     $fields = "&amount={$total}&item_name={$purpose}&cmd=_donations";
     return $total > 0 ? $fields : false;
 }
开发者ID:hscale,项目名称:webento,代码行数:48,代码来源:paypal.php

示例6: get_value_save_entry

 public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead)
 {
     $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
     $value = GFCommon::get_order_total($form, $lead);
     return $value;
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:6,代码来源:class-gf-field-total.php

示例7: admin_edit_payment_status_details

    public function admin_edit_payment_status_details($form_id, $lead)
    {
        $form_action = strtolower(rgpost('save'));
        if (!$this->is_payment_gateway($lead['id']) || $form_action != 'edit') {
            return;
        }
        //get data from entry to pre-populate fields
        $payment_amount = rgar($lead, 'payment_amount');
        if (empty($payment_amount)) {
            $form = GFFormsModel::get_form_meta($form_id);
            $payment_amount = GFCommon::get_order_total($form, $lead);
        }
        $transaction_id = rgar($lead, 'transaction_id');
        $payment_date = rgar($lead, 'payment_date');
        if (empty($payment_date)) {
            $payment_date = gmdate('y-m-d H:i:s');
        }
        //display edit fields
        ?>
		<div id="edit_payment_status_details" style="display:block">
			<table>
				<tr>
					<td colspan="2"><strong>Payment Information</strong></td>
				</tr>

				<tr>
					<td>Date:<?php 
        gform_tooltip('paypal_edit_payment_date');
        ?>
</td>
					<td>
						<input type="text" id="payment_date" name="payment_date" value="<?php 
        echo $payment_date;
        ?>
">
					</td>
				</tr>
				<tr>
					<td>Amount:<?php 
        gform_tooltip('paypal_edit_payment_amount');
        ?>
</td>
					<td>
						<input type="text" id="payment_amount" name="payment_amount" class="gform_currency" value="<?php 
        echo $payment_amount;
        ?>
">
					</td>
				</tr>
				<tr>
					<td nowrap>Transaction ID:<?php 
        gform_tooltip('paypal_edit_payment_transaction_id');
        ?>
</td>
					<td>
						<input type="text" id="paypal_transaction_id" name="paypal_transaction_id" value="<?php 
        echo $transaction_id;
        ?>
">
					</td>
				</tr>
			</table>
		</div>
	<?php 
    }
开发者ID:gbernatchez,项目名称:galeriegalerie,代码行数:65,代码来源:class-gf-paypal.php

示例8: prepare_value

 /**
  * Prepare the value before saving it to the lead.
  *
  * @param mixed $form
  * @param mixed $field
  * @param mixed $value
  * @param mixed $input_name
  * @param mixed $lead_id the current lead ID, used for fields that are processed after other fields have been saved (ie Total, Calculations)
  * @param mixed $lead passed by the RGFormsModel::create_lead() method, lead ID is not available for leads created by this function
  */
 public static function prepare_value($form, $field, $value, $input_name, $lead_id, $lead = array())
 {
     $form_id = $form["id"];
     $input_type = self::get_input_type($field);
     switch ($input_type) {
         case "total":
             $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
             $value = GFCommon::get_order_total($form, $lead);
             break;
         case "calculation":
             // ignore submitted value and recalculate price in backend
             list(, , $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == 2) {
                 require_once GFCommon::get_base_path() . '/currency.php';
                 $currency = new RGCurrency(GFCommon::get_currency());
                 $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
                 $value = $currency->to_money(GFCommon::calculate($field, $form, $lead));
             }
             break;
         case "phone":
             if ($field["phoneFormat"] == "standard" && preg_match('/^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/', $value, $matches)) {
                 $value = sprintf("(%s)%s-%s", $matches[1], $matches[2], $matches[3]);
             }
             break;
         case "time":
             if (!is_array($value) && !empty($value)) {
                 preg_match('/^(\\d*):(\\d*) ?(.*)$/', $value, $matches);
                 $value = array();
                 $value[0] = $matches[1];
                 $value[1] = $matches[2];
                 $value[2] = rgar($matches, 3);
             }
             $hour = empty($value[0]) ? "0" : strip_tags($value[0]);
             $minute = empty($value[1]) ? "0" : strip_tags($value[1]);
             $ampm = strip_tags(rgar($value, 2));
             if (!empty($ampm)) {
                 $ampm = " {$ampm}";
             }
             if (!(empty($hour) && empty($minute))) {
                 $value = sprintf("%02d:%02d%s", $hour, $minute, $ampm);
             } else {
                 $value = "";
             }
             break;
         case "date":
             $value = self::prepare_date(rgar($field, 'dateFormat'), $value);
             break;
         case "post_image":
             $url = self::get_fileupload_value($form_id, $input_name);
             $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : "";
             $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : "";
             $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : "";
             $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : "";
             break;
         case "fileupload":
             if (rgar($field, "multipleFiles")) {
                 global $_gf_uploaded_files;
                 if (isset($_gf_uploaded_files[$input_name])) {
                     $value = $_gf_uploaded_files[$input_name];
                 } else {
                     if (isset(GFFormsModel::$uploaded_files[$form_id][$input_name])) {
                         $uploaded_temp_files = GFFormsModel::$uploaded_files[$form_id][$input_name];
                         $uploaded_files = array();
                         foreach ($uploaded_temp_files as $i => $file_info) {
                             $temp_filepath = self::get_upload_path($form_id) . '/tmp/' . $file_info['temp_filename'];
                             if ($file_info && file_exists($temp_filepath)) {
                                 $uploaded_files[$i] = self::move_temp_file($form_id, $file_info);
                             }
                         }
                         if (!empty($value)) {
                             // merge with existing files (admin edit entry)
                             $value = json_decode($value, true);
                             $value = array_merge($value, $uploaded_files);
                             $value = json_encode($value);
                         } else {
                             $value = json_encode($uploaded_files);
                         }
                     } else {
                         $value = '';
                     }
                     $_gf_uploaded_files[$input_name] = $value;
                 }
             } else {
                 $value = self::get_fileupload_value($form_id, $input_name);
             }
             break;
         case "number":
             $value = GFCommon::maybe_add_leading_zero($value);
             $is_hidden = RGFormsModel::is_field_hidden($form, $field, array());
             $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
//.........这里部分代码省略.........
开发者ID:BisongT,项目名称:Myevent_website,代码行数:101,代码来源:forms_model.php

示例9: gf_create_user

 public static function gf_create_user($entry, $form, $fulfilled = false)
 {
     // if the entry is marked as spam
     if (rgar($entry, 'status') == 'spam') {
         return;
     }
     $config = self::get_config($form['id']);
     $meta = rgar($config, 'meta');
     // if there is no registration feed or the registration condition is not met or the feed is not active, abandon ship
     if (!$config || !self::registration_condition_met($form, $config, $entry) || !$config['is_active']) {
         return;
     }
     // if PayPal Add-on was used for this entry, integrate
     $paypal_config = self::get_paypal_config($form["id"], $entry);
     if ($paypal_config) {
         //$paypal_config = self::get_paypal_config($form["id"], $entry);
         $order_total = GFCommon::get_order_total($form, $entry);
         // delay the registration IF:
         // - the delay registration option is checked
         // - the order total does NOT equal zero (no delay since there will never be a payment)
         // - the payment has not already been fulfilled
         if ($paypal_config && $paypal_config['meta']['delay_registration'] && $order_total != 0 && $fulfilled != true) {
             return;
         }
     }
     $user_name = apply_filters("gform_username_{$form['id']}", apply_filters('gform_username', self::get_meta_value('username', $config, $form, $entry), $config, $form, $entry), $config, $form, $entry);
     $user_email = self::get_meta_value('email', $config, $form, $entry);
     $user_pass = self::get_meta_value('password', $config, $form, $entry);
     if (empty($user_name) || empty($user_email)) {
         return;
     }
     if (!function_exists('username_exists')) {
         require_once ABSPATH . WPINC . "/registration.php";
     }
     $user_id = username_exists($user_name);
     // create the user and password, then add user meta
     if (!$user_id && empty($user_pass)) {
         $user_pass = wp_generate_password();
         $user_id = wp_create_user($user_name, $user_pass, $user_email);
         if (is_wp_error($user_id)) {
             return;
         }
         update_user_option($user_id, 'default_password_nag', true, false);
         self::add_user_meta($user_id, $config, $form, $entry, array());
     } else {
         if (!$user_id) {
             $user_id = wp_create_user($user_name, $user_pass, $user_email);
             if (is_wp_error($user_id)) {
                 return;
             }
             GFUserData::remove_password($form['id'], $entry['id'], rgar($meta, 'password'));
             self::add_user_meta($user_id, $config, $form, $entry, array());
         } else {
             // if user with this username already exists, abort user registration
             return;
         }
     }
     if (rgar($meta, 'role')) {
         $user = new WP_User($user_id);
         $user->set_role(rgar($meta, 'role'));
     }
     // set post author
     if (!empty($entry['post_id']) && rgar($meta, 'set_post_author')) {
         self::attribute_post_author($user_id, $entry['post_id']);
     }
     // send user/admin notifications
     if (rgar($meta, 'notification')) {
         wp_new_user_notification($user_id, $user_pass);
     } else {
         wp_new_user_notification($user_id, "");
         // sending a blank password only sends notification to admin
     }
     do_action('gform_user_registered', $user_id, $config, $entry, $user_pass);
 }
开发者ID:hscale,项目名称:webento,代码行数:74,代码来源:userregistration.php

示例10: maybe_delay_user_registration

 /**
  * Maybe delay user registration
  */
 public function maybe_delay_user_registration($disable_registration, $form, $entry, $fulfilled)
 {
     if ($this->is_processing($form)) {
         $order_total = GFCommon::get_order_total($form, $entry);
         // delay the registration IF:
         // - the delay registration option is checked
         // - the order total does NOT equal zero (no delay since there will never be a payment)
         // - the payment has not already been fulfilled
         $disable_registration = $this->feed->delay_user_registration && 0 !== $order_total && !$fulfilled;
     }
     return $disable_registration;
 }
开发者ID:wp-pay-extensions,项目名称:gravityforms,代码行数:15,代码来源:Processor.php

示例11: handle_form_submission

 public static function handle_form_submission($entry, $form)
 {
     if (class_exists('GFPayPal')) {
         $paypal_config = GFPayPal::get_config($form['id']);
         //don't send SMS if PayPal delay twilio setting is ON
         if (rgget('delay_twilio', $paypal_config['meta'])) {
             $order_total = GFCommon::get_order_total($form, $entry);
             if ($order_total != 0) {
                 return;
             }
         }
     }
     self::export($entry, $form);
 }
开发者ID:hscale,项目名称:webento,代码行数:14,代码来源:twilio.php

示例12: prepare_value

 private static function prepare_value($form, $field, $value, $input_name, $lead_id)
 {
     $form_id = $form["id"];
     $input_type = self::get_input_type($field);
     switch ($input_type) {
         case "total":
             $lead = RGFormsModel::get_lead($lead_id);
             $value = GFCommon::get_order_total($form, $lead);
             break;
         case "post_category":
             $cat = get_category($value);
             $value = !empty($cat) ? $cat->name . ":" . $value : "";
             break;
         case "phone":
             if ($field["phoneFormat"] == "standard" && preg_match('/^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/', $value, $matches)) {
                 $value = sprintf("(%s)%s-%s", $matches[1], $matches[2], $matches[3]);
             }
             break;
         case "time":
             if (!is_array($value) && !empty($value)) {
                 preg_match('/^(\\d*):(\\d*) ?(.*)$/', $value, $matches);
                 $value = array();
                 $value[0] = $matches[1];
                 $value[1] = $matches[2];
                 $value[2] = rgar($matches, 3);
             }
             $hour = empty($value[0]) ? "0" : strip_tags($value[0]);
             $minute = empty($value[1]) ? "0" : strip_tags($value[1]);
             $ampm = strip_tags(rgar($value, 2));
             if (!empty($ampm)) {
                 $ampm = " {$ampm}";
             }
             if (!(empty($hour) && empty($minute))) {
                 $value = sprintf("%02d:%02d%s", $hour, $minute, $ampm);
             } else {
                 $value = "";
             }
             break;
         case "date":
             $format = empty($field["dateFormat"]) ? "mdy" : $field["dateFormat"];
             $date_info = GFCommon::parse_date($value, $format);
             if (!empty($date_info)) {
                 $value = sprintf("%d-%02d-%02d", $date_info["year"], $date_info["month"], $date_info["day"]);
             } else {
                 $value = "";
             }
             break;
         case "post_image":
             $url = self::get_fileupload_value($form_id, $input_name);
             $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : "";
             $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : "";
             $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : "";
             $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : "";
             break;
         case "fileupload":
             $value = self::get_fileupload_value($form_id, $input_name);
             break;
         case "number":
             $value = GFCommon::clean_number($value, rgar($field, "numberFormat"));
             break;
         case "website":
             if ($value == "http://") {
                 $value = "";
             }
             break;
         case "list":
             if (GFCommon::is_empty_array($value)) {
                 $value = "";
             } else {
                 $value = self::create_list_array($field, $value);
                 $value = serialize($value);
             }
             break;
         case "radio":
             if (rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') {
                 $value = rgpost("input_{$field['id']}_other");
             }
             break;
         case "multiselect":
             $value = empty($value) ? "" : implode(",", $value);
             break;
         case "creditcard":
             //saving last 4 digits of credit card
             list($input_token, $field_id_token, $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == "1") {
                 $value = str_replace(" ", "", $value);
                 $card_number_length = strlen($value);
                 $value = substr($value, -4, 4);
                 $value = str_pad($value, $card_number_length, "X", STR_PAD_LEFT);
             } else {
                 if ($input_id == "4") {
                     $card_number = rgpost("input_{$field_id_token}_1");
                     $card_type = GFCommon::get_card_type($card_number);
                     $value = $card_type ? $card_type["name"] : "";
                 } else {
                     $value = "";
                 }
             }
             break;
         default:
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:101,代码来源:forms_model.php

示例13: confirmation_page

 public static function confirmation_page($config, $billing_data, $entry, $form)
 {
     //compiling products that will be used for the recurring calculation
     $recurring_products = array();
     $recurring_amount = 0;
     foreach ($billing_data["products"]["products"] as $product_id => $product) {
         if (self::include_in_total($product_id, $config)) {
             $recurring_products[] = $product;
             $recurring_amount += self::get_product_price($product);
         }
     }
     if ($config["meta"]["type"] == "product") {
         $recurring_amount = 0;
     }
     self::get_interval_unit($config["meta"]["billing_cycle_type"]);
     $recurring_label = self::get_recurring_label($config);
     $setup_fee = self::get_setup_fee($config, $billing_data);
     $trial_data = self::get_trial_data($config, $billing_data);
     $trial_label = sprintf(__("%s %s trial", "gravityformspaypalpro"), $trial_data["frequency"], $trial_data["period"]);
     $total_label = $config["meta"]["type"] == "product" ? __("Total", "gravityformspaypalpro") : __("Today's Payment", "gravityformspaypalpro");
     $todays_payment = $trial_data ? $trial_data["amount"] : $setup_fee + $recurring_amount;
     $total = $config["meta"]["type"] == "product" ? GFCommon::get_order_total($form, $entry) : $todays_payment;
     $output = self::load_template("payment_confirmation.php", array("setup_fee" => self::get_setup_fee($config, $billing_data), "trial_data" => self::get_trial_data($config, $billing_data), "trial_label" => $trial_label, "recurring_products" => $recurring_products, "recurring_amount" => $recurring_amount, "recurring_label" => $recurring_label, "total_label" => $total_label, "total_amount" => $total, "entry" => $entry, "form" => $form, "products" => $billing_data["products"]));
     return $output;
 }
开发者ID:bryanmonzon,项目名称:jenjonesdirect,代码行数:25,代码来源:paypalpro.php

示例14: getPrice

 public static function getPrice($entry_id)
 {
     $price = null;
     if (class_exists('GFCommon')) {
         $form_id = self::getGravityFormIdForEntry($entry_id);
         $form = RGFormsModel::get_form_meta($form_id);
         $lead = RGFormsModel::get_lead($entry_id);
         $price = GFCommon::get_order_total($form, $lead);
     }
     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Gravity Forms Product Price: {$price} :: Form id: {$form_id} :: Entry id: {$entry_id}");
     return $price;
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:12,代码来源:Cart66GravityReader.php


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