本文整理汇总了PHP中GFFormDisplay::handle_confirmation方法的典型用法代码示例。如果您正苦于以下问题:PHP GFFormDisplay::handle_confirmation方法的具体用法?PHP GFFormDisplay::handle_confirmation怎么用?PHP GFFormDisplay::handle_confirmation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFFormDisplay
的用法示例。
在下文中一共展示了GFFormDisplay::handle_confirmation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maybe_thankyou_page
public static function maybe_thankyou_page()
{
if (!self::is_gravityforms_supported()) {
return;
}
if ($str = RGForms::get("gf_paypal_return")) {
$str = base64_decode($str);
parse_str($str, $query);
if (wp_hash("ids=" . $query["ids"]) == $query["hash"]) {
list($form_id, $lead_id) = explode("|", $query["ids"]);
$form = RGFormsModel::get_form_meta($form_id);
$lead = RGFormsModel::get_lead($lead_id);
if (!class_exists("GFFormDisplay")) {
require_once GFCommon::get_base_path() . "/form_display.php";
}
$confirmation = GFFormDisplay::handle_confirmation($form, $lead, false);
if (is_array($confirmation) && isset($confirmation["redirect"])) {
header("Location: {$confirmation["redirect"]}");
exit;
}
GFFormDisplay::$submission[$form_id] = array("is_confirmation" => true, "confirmation_message" => $confirmation, "form" => $form, "lead" => $lead);
}
}
}
示例2: maybe_thankyou_page
public static function maybe_thankyou_page()
{
$instance = self::get_instance();
if (!$instance->is_gravityforms_supported()) {
return;
}
if ($str = rgget('gf_paypal_return')) {
$str = base64_decode($str);
parse_str($str, $query);
if (wp_hash('ids=' . $query['ids']) == $query['hash']) {
list($form_id, $lead_id) = explode('|', $query['ids']);
$form = GFAPI::get_form($form_id);
$lead = GFAPI::get_entry($lead_id);
if (!class_exists('GFFormDisplay')) {
require_once GFCommon::get_base_path() . '/form_display.php';
}
$confirmation = GFFormDisplay::handle_confirmation($form, $lead, false);
if (is_array($confirmation) && isset($confirmation['redirect'])) {
header("Location: {$confirmation['redirect']}");
exit;
}
GFFormDisplay::$submission[$form_id] = array('is_confirmation' => true, 'confirmation_message' => $confirmation, 'form' => $form, 'lead' => $lead);
}
}
}
示例3: confirm_express_checkout
public static function confirm_express_checkout($form, $entry, $config, $billing_data)
{
$token = rgget("token");
//finalize PayPal transaction
if ($config["meta"]["type"] != "product") {
$fields = "METHOD=CreateRecurringPaymentsProfile&" . "TOKEN={$token}&" . "PROFILESTARTDATE=" . urlencode(gmdate(DATE_ATOM)) . "&" . "DESC=" . urlencode(self::get_recurring_description($config, $billing_data)) . "&" . "MAXFAILEDPAYMENTS=0&" . "BILLINGPERIOD=" . self::get_interval_unit($config["meta"]["billing_cycle_type"]) . "&" . "BILLINGFREQUENCY=" . $config["meta"]["billing_cycle_number"] . "&" . "AMT=" . $billing_data["amount"] . "&" . "CURRENCYCODE=" . GFCommon::get_currency() . "&" . "TOTALBILLINGCYCLES=" . $config["meta"]["recurring_times"] . "&";
$trial_data = self::get_trial_data($config, $billing_data);
$trial_amount = 0;
if ($trial_data) {
$fields .= "TRIALBILLINGPERIOD=" . $trial_data["period"] . "&" . "TRIALBILLINGFREQUENCY=" . $trial_data["frequency"] . "&" . "TRIALTOTALBILLINGCYCLES=" . $trial_data["cycles"] . "&";
if ($trial_data["amount"] > 0) {
$fields .= "TRIALAMT=" . $trial_data["amount"] . "&";
}
}
//setup fee
$setup_fee_amount = self::get_setup_fee($config, $billing_data);
if ($setup_fee_amount) {
$fields .= "INITAMT=" . $setup_fee_amount;
}
$success = self::send_request($config, $fields, $response, $form, $entry);
if (!$success || !in_array($response["PROFILESTATUS"], array("PendingProfile", "ActiveProfile"))) {
//3a- if failure, display message and abort
self::log_error("Error on CreateRecurringPaymentsProfile \n\nFields:\n{$fields} \n\nResponse:\n " . print_r($response, true));
return __("There was an error while confirming your payment. Your payment could not be processed. Please try again later.", "gravityformspaypalpro");
} else {
//Everything OK. confirm subscription
$subscriber_id = rgar($response, "PROFILEID");
$is_pending = $response["PROFILESTATUS"] == "PendingProfile";
$amount = $billing_data["amount"];
//marking entry as Active
self::update_entry($entry, $form, $subscriber_id, true, $amount, $is_pending);
//inserting initial signup transaction
GFPayPalProData::insert_transaction($entry["id"], $config["id"], "signup", $subscriber_id, "", "", 0);
//fulfilling order if profile was created successfully
if (!$is_pending) {
self::fulfill_order($entry, $subscriber_id, $setup_fee_amount, $amount);
}
$confirmation = GFFormDisplay::handle_confirmation($form, $entry);
return $confirmation;
}
} else {
//Confirm payment
$fields = "METHOD=DoExpressCheckoutPayment&" . "PAYERID=" . rgget("PayerID") . "&" . "PAYMENTREQUEST_0_AMT=" . $billing_data["amount"] . "&" . "PAYMENTREQUEST_0_NOTIFYURL=" . urlencode(get_bloginfo("url") . "/?page=gf_paypalpro_ipn") . "&" . "TOKEN={$token}&";
$success = self::send_request($config, $fields, $response, $form, $entry);
if (!$success || !in_array($response["PAYMENTINFO_0_PAYMENTSTATUS"], array("Pending", "Completed"))) {
//GCCommon::log_error("paypalpro", "Error on DoExpressCheckoutPayment \n\nFields:\n{$fields} \n\nResponse:\n " . print_r($response, true));
return __("There was an error while confirming your payment. Your payment could not be processed. Please try again later.", "gravityformspaypalpro");
} else {
$transaction_id = rgar($response, "PAYMENTINFO_0_TRANSACTIONID");
$is_pending = $response["PAYMENTINFO_0_PAYMENTSTATUS"] == "Pending";
$amount = $response["PAYMENTINFO_0_AMT"];
self::confirm_payment($entry, $form, "", $transaction_id, false, $amount, 0, $is_pending);
$confirmation = GFFormDisplay::handle_confirmation($form, $entry);
return $confirmation;
}
}
}
示例4: gpoll_ajax
/**
* Handler for the gpoll_ajax AJAX request.
* Returns the json encoded result for processing by gpoll.js.
*/
public function gpoll_ajax()
{
$output = array();
$form_id = rgpost('formId');
$form = RGFormsModel::get_form_meta($form_id);
$preview_results = rgpost('previewResults');
$preview_results = $preview_results == '1' ? true : false;
$has_voted = isset($_COOKIE['gpoll_form_' . $form_id]);
$override = false;
if (rgpost('override') == 1) {
$show_results_link = rgpost('showResultsLink') == '1' ? true : false;
$display_results = rgpost('displayResults') == '1' ? true : false;
$confirmation = rgpost('confirmation') == '1' ? true : false;
$percentages = rgpost('percentages') == '1' ? true : false;
$counts = rgpost('counts') == '1' ? true : false;
$cookie_duration = urldecode(rgpost('cookieDuration'));
$style = rgpost('style');
$checksum = rgpost('checksum');
if ($checksum == $this->generate_checksum($display_results, $show_results_link, $cookie_duration, $confirmation, $percentages, $counts, $style)) {
$override = true;
}
}
if (false === $override) {
$show_results_link = $this->get_form_setting($form, 'showResultsLink');
$display_results = $this->get_form_setting($form, 'displayResults');
$confirmation = true;
$percentages = $this->get_form_setting($form, 'showPercentages');
$counts = $this->get_form_setting($form, 'showCounts');
$style = $this->get_form_setting($form, 'style');
$block_repeat_voters = $this->get_form_setting($form, 'blockRepeatVoters');
if ($block_repeat_voters) {
$cookie_duration = $this->get_form_setting($form, 'cookie');
} else {
$cookie_duration = '';
}
}
$can_vote = !$has_voted || empty($cookie_duration) && $has_voted;
$output['canVote'] = $can_vote;
if ($preview_results || false === $can_vote) {
if ('' === $show_results_link) {
$show_results_link = true;
}
if ($preview_results && $show_results_link || $display_results) {
$results = $this->gpoll_get_results($form_id, '0', $style, $percentages, $counts);
$results_summary = $results['summary'];
$output['resultsUI'] = $results_summary;
} else {
if ($confirmation) {
require_once GFCommon::get_base_path() . '/form_display.php';
$output['resultsUI'] = GFFormDisplay::handle_confirmation($form, null);
} else {
$output['resultsUI'] = '';
}
}
} else {
$output['resultsUI'] = '';
}
echo json_encode($output);
die;
}
示例5: get_confirmation
/**
* Get confirmations for lead based on payment status.
*
* @param $lead
*
* @param string $payment_status
*
* @return mixed
*/
public function get_confirmation($lead, $payment_status = Pronamic_WP_Pay_Statuses::OPEN)
{
$form = GFAPI::get_form($lead['form_id']);
$feed = get_pronamic_gf_pay_feed_by_entry_id($lead['id']);
$link = Pronamic_WP_Pay_Extensions_GravityForms_Links::transform_status($payment_status);
if (!class_exists('GFFormDisplay')) {
require_once GFCommon::get_base_path() . '/form_display.php';
}
// Use only link confirmation if set
if (isset($feed->links[$link]['confirmation_id']) && !empty($feed->links[$link]['confirmation_id'])) {
$confirmation_id = $feed->links[$link]['confirmation_id'];
if (isset($form['confirmations'][$confirmation_id])) {
$form['confirmations'] = array_intersect_key($form['confirmations'], array($confirmation_id => true));
}
}
return GFFormDisplay::handle_confirmation($form, $lead, false);
}