本文整理汇总了PHP中pmpro_isLevelTrial函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_isLevelTrial函数的具体用法?PHP pmpro_isLevelTrial怎么用?PHP pmpro_isLevelTrial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_isLevelTrial函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(&$order)
{
//clean up a couple values
$order->payment_type = "Check";
$order->CardType = "";
$order->cardtype = "";
//check for initial payment
if(floatval($order->InitialPayment) == 0)
{
//auth first, then process
if($this->authorize($order))
{
$this->void($order);
if(!pmpro_isLevelTrial($order->membership_level))
{
//subscription will start today with a 1 period trial
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingPeriod = $order->BillingPeriod;
$order->TrialBillingFrequency = $order->BillingFrequency;
$order->TrialBillingCycles = 1;
$order->TrialAmount = 0;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
{
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingCycles++;
//add a billing cycle to make up for the trial, if applicable
if($order->TotalBillingCycles)
$order->TotalBillingCycles++;
}
else
{
//add a period to the start date to account for the initial payment
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $order->BillingFrequency . " " . $order->BillingPeriod)) . "T0:0:0";
}
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
return $this->subscribe($order);
}
else
{
if(empty($order->error))
$order->error = "Unknown error: Authorization failed.";
return false;
}
}
else
{
//charge first payment
if($this->charge($order))
{
//setup recurring billing
if(pmpro_isLevelRecurring($order->membership_level))
{
if(!pmpro_isLevelTrial($order->membership_level))
{
//subscription will start today with a 1 period trial
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingPeriod = $order->BillingPeriod;
$order->TrialBillingFrequency = $order->BillingFrequency;
$order->TrialBillingCycles = 1;
$order->TrialAmount = 0;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
elseif($order->InitialPayment == 0 && $order->TrialAmount == 0)
{
//it has a trial, but the amount is the same as the initial payment, so we can squeeze it in there
$order->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$order->TrialBillingCycles++;
//add a billing cycle to make up for the trial, if applicable
if(!empty($order->TotalBillingCycles))
$order->TotalBillingCycles++;
}
else
{
//add a period to the start date to account for the initial payment
$order->ProfileStartDate = date("Y-m-d", strtotime("+ " . $this->BillingFrequency . " " . $this->BillingPeriod)) . "T0:0:0";
}
$order->ProfileStartDate = apply_filters("pmpro_profile_start_date", $order->ProfileStartDate, $order);
if($this->subscribe($order))
{
return true;
}
else
{
if($this->void($order))
{
if(!$order->error)
//.........这里部分代码省略.........
示例2: pmpro_checkout_confirmed
/**
* Review and Confirmation code.
*
* @since 1.8
*/
static function pmpro_checkout_confirmed($pmpro_confirmed)
{
global $pmpro_msg, $pmpro_msgt, $pmpro_level, $current_user, $pmpro_review, $pmpro_paypal_token, $discount_code, $bemail;
//PayPal Express Call Backs
if (!empty($_REQUEST['review'])) {
if (!empty($_REQUEST['PayerID'])) {
$_SESSION['payer_id'] = $_REQUEST['PayerID'];
}
if (!empty($_REQUEST['paymentAmount'])) {
$_SESSION['paymentAmount'] = $_REQUEST['paymentAmount'];
}
if (!empty($_REQUEST['currencyCodeType'])) {
$_SESSION['currCodeType'] = $_REQUEST['currencyCodeType'];
}
if (!empty($_REQUEST['paymentType'])) {
$_SESSION['paymentType'] = $_REQUEST['paymentType'];
}
$morder = new MemberOrder();
$morder->getMemberOrderByPayPalToken($_REQUEST['token']);
$morder->Token = $morder->paypal_token;
$pmpro_paypal_token = $morder->paypal_token;
if ($morder->Token) {
if ($morder->Gateway->getExpressCheckoutDetails($morder)) {
$pmpro_review = true;
} else {
$pmpro_msg = $morder->error;
$pmpro_msgt = "pmpro_error";
}
} else {
$pmpro_msg = __("The PayPal Token was lost.", "pmpro");
$pmpro_msgt = "pmpro_error";
}
} elseif (!empty($_REQUEST['confirm'])) {
$morder = new MemberOrder();
$morder->getMemberOrderByPayPalToken($_REQUEST['token']);
$morder->Token = $morder->paypal_token;
$pmpro_paypal_token = $morder->paypal_token;
if ($morder->Token) {
//set up values
$morder->membership_id = $pmpro_level->id;
$morder->membership_name = $pmpro_level->name;
$morder->discount_code = $discount_code;
$morder->InitialPayment = $pmpro_level->initial_payment;
$morder->PaymentAmount = $pmpro_level->billing_amount;
$morder->ProfileStartDate = date("Y-m-d") . "T0:0:0";
$morder->BillingPeriod = $pmpro_level->cycle_period;
$morder->BillingFrequency = $pmpro_level->cycle_number;
$morder->Email = $bemail;
//set up level var
$morder->getMembershipLevel();
$morder->membership_level = apply_filters("pmpro_checkout_level", $morder->membership_level);
//tax
$morder->subtotal = $morder->InitialPayment;
$morder->getTax();
if ($pmpro_level->billing_limit) {
$morder->TotalBillingCycles = $pmpro_level->billing_limit;
}
if (pmpro_isLevelTrial($pmpro_level)) {
$morder->TrialBillingPeriod = $pmpro_level->cycle_period;
$morder->TrialBillingFrequency = $pmpro_level->cycle_number;
$morder->TrialBillingCycles = $pmpro_level->trial_limit;
$morder->TrialAmount = $pmpro_level->trial_amount;
}
if ($morder->confirm()) {
$pmpro_confirmed = true;
} else {
$pmpro_msg = $morder->error;
$pmpro_msgt = "pmpro_error";
}
} else {
$pmpro_msg = __("The PayPal Token was lost.", "pmpro");
$pmpro_msgt = "pmpro_error";
}
}
if (!empty($morder)) {
return array("pmpro_confirmed" => $pmpro_confirmed, "morder" => $morder);
} else {
return $pmpro_confirmed;
}
}
示例3: jQuery
" <?php
if (pmpro_isLevelTrial($level)) {
echo "checked='checked'";
}
?>
onclick="if(jQuery(this).attr('checked')) jQuery(this).parent().parent().siblings('.trial_info').show(); else jQuery(this).parent().parent().siblings('.trial_info').hide();" /> <label for="custom_trial_<?php
echo $level->id;
?>
"><?php
_e('Check to add a custom trial period.', 'pmpro');
?>
</label></td>
</tr>
<tr class="trial_info recurring_info" <?php
if (!pmpro_isLevelTrial($level)) {
echo "style='display:none;'";
}
?>
>
<th scope="row" valign="top"><label for="trial_amount"><?php
_e('Trial Billing Amount', 'pmpro');
?>
:</label></th>
<td>
<?php
if (pmpro_getCurrencyPosition() == "left") {
echo $pmpro_currency_symbol;
}
?>
<input name="trial_amount[]" type="text" size="20" value="<?php
示例4: do_action
do_action('pmpro_checkout_before_processing');
//process checkout if required
if ($pmpro_requirebilling) {
$morder = new MemberOrder();
$morder->membership_id = $pmpro_level->id;
$morder->membership_name = $pmpro_level->name;
$morder->discount_code = $discount_code;
$morder->InitialPayment = $pmpro_level->initial_payment;
$morder->PaymentAmount = $pmpro_level->billing_amount;
$morder->ProfileStartDate = date("Y-m-d", current_time("timestamp")) . "T0:0:0";
$morder->BillingPeriod = $pmpro_level->cycle_period;
$morder->BillingFrequency = $pmpro_level->cycle_number;
if ($pmpro_level->billing_limit) {
$morder->TotalBillingCycles = $pmpro_level->billing_limit;
}
if (pmpro_isLevelTrial($pmpro_level)) {
$morder->TrialBillingPeriod = $pmpro_level->cycle_period;
$morder->TrialBillingFrequency = $pmpro_level->cycle_number;
$morder->TrialBillingCycles = $pmpro_level->trial_limit;
$morder->TrialAmount = $pmpro_level->trial_amount;
}
//credit card values
$morder->cardtype = $CardType;
$morder->accountnumber = $AccountNumber;
$morder->expirationmonth = $ExpirationMonth;
$morder->expirationyear = $ExpirationYear;
$morder->ExpirationDate = $ExpirationMonth . $ExpirationYear;
$morder->ExpirationDate_YdashM = $ExpirationYear . "-" . $ExpirationMonth;
$morder->CVV2 = $CVV;
//not saving email in order table, but the sites need it
$morder->Email = $bemail;
示例5: sendCheckoutAdminEmail
function sendCheckoutAdminEmail($user = NULL, $invoice = NULL)
{
global $wpdb, $current_user, $pmpro_currency_symbol;
if(!$user)
$user = $current_user;
if(!$user)
return false;
//check settings
$send = pmpro_getOption("email_admin_checkout");
if(empty($send))
return true; //didn't send, but we also don't want to indicate failure because the settings say to not send
$this->email = get_bloginfo("admin_email");
$this->subject = "Member Checkout for " . $user->membership_level->name . " at " . get_option("blogname");
$this->data = array(
"subject" => $this->subject,
"name" => $user->display_name,
"user_login" => $user->user_login,
"sitename" => get_option("blogname"),
"siteemail" => pmpro_getOption("from_email"),
"membership_level_name" => $user->membership_level->name,
"membership_cost" => pmpro_getLevelCost($user->membership_level),
"login_link" => pmpro_url("account"),
"display_name" => $user->display_name,
"user_email" => $user->user_email,0
);
if($invoice)
{
if($invoice->gateway == "paypalexpress")
$this->template = "checkout_express_admin";
elseif($invoice->gateway == "check")
$this->template = "checkout_check_admin";
elseif(pmpro_isLevelTrial($user->membership_level))
$this->template = "checkout_trial_admin";
else
$this->template = "checkout_paid_admin";
$this->data["invoice_id"] = $invoice->code;
$this->data["invoice_total"] = $pmpro_currency_symbol . number_format($invoice->total, 2);
$this->data["invoice_date"] = date(get_option('date_format'), $invoice->timestamp);
$this->data["billing_name"] = $invoice->billing->name;
$this->data["billing_street"] = $invoice->billing->street;
$this->data["billing_city"] = $invoice->billing->city;
$this->data["billing_state"] = $invoice->billing->state;
$this->data["billing_zip"] = $invoice->billing->zip;
$this->data["billing_country"] = $invoice->billing->country;
$this->data["billing_phone"] = $invoice->billing->phone;
$this->data["cardtype"] = $invoice->cardtype;
$this->data["accountnumber"] = hideCardNumber($invoice->accountnumber);
$this->data["expirationmonth"] = $invoice->expirationmonth;
$this->data["expirationyear"] = $invoice->expirationyear;
if($invoice->getDiscountCode())
$this->data["discount_code"] = "<p>Discount Code: " . $invoice->discount_code->code . "</p>\n";
else
$this->data["discount_code"] = "";
}
elseif(pmpro_isLevelFree($user->membership_level))
{
$this->template = "checkout_free_admin";
global $discount_code;
if(!empty($discount_code))
$this->data["discount_code"] = "<p>Discount Code: " . $discount_code . "</p>\n";
else
$this->data["discount_code"] = "";
}
else
{
$this->template = "checkout_freetrial_admin";
$this->data["discount_code"] = "";
}
$enddate = $wpdb->get_var("SELECT UNIX_TIMESTAMP(enddate) FROM $wpdb->pmpro_memberships_users WHERE user_id = '" . $user->ID . "' AND status = 'active' LIMIT 1");
if($enddate)
$this->data["membership_expiration"] = "<p>This membership will expire on " . date(get_option('date_format'), $enddate) . ".</p>\n";
else
$this->data["membership_expiration"] = "";
return $this->sendEmail();
}
示例6: pmpro_checkLevelForTwoCheckoutCompatibility
function pmpro_checkLevelForTwoCheckoutCompatibility($level = NULL)
{
$gateway = pmpro_getOption("gateway");
if ($gateway == "twocheckout") {
global $wpdb;
//check ALL the levels
if (empty($level)) {
$sqlQuery = "SELECT * FROM {$wpdb->pmpro_membership_levels} ORDER BY id ASC";
$levels = $wpdb->get_results($sqlQuery, OBJECT);
if (!empty($levels)) {
foreach ($levels as $level) {
/*
2Checkout currently does not support:
* Trial amounts less than or greater than the absolute value of amonthly recurring amount.
*/
if (pmpro_isLevelTrial($level)) {
return false;
}
}
}
} else {
//need to look it up?
if (is_numeric($level)) {
$level = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->pmpro_membership_levels} WHERE id = %d LIMIT 1", $level));
}
//check this level
if (pmpro_isLevelTrial($level)) {
return false;
}
}
}
return true;
}
示例7: sendCheckoutAdminEmail
function sendCheckoutAdminEmail($user = NULL, $invoice = NULL)
{
global $wpdb, $current_user;
if (!$user) {
$user = $current_user;
}
if (!$user) {
return false;
}
//check settings
$send = pmpro_getOption("email_admin_checkout");
if (empty($send)) {
return true;
}
//didn't send, but we also don't want to indicate failure because the settings say to not send
$this->email = get_bloginfo("admin_email");
$this->subject = sprintf(__("Member Checkout for %s at %s", "pmpro"), $user->membership_level->name, get_option("blogname"));
$this->data = array("subject" => $this->subject, "name" => $user->display_name, "user_login" => $user->user_login, "sitename" => get_option("blogname"), "siteemail" => pmpro_getOption("from_email"), "membership_id" => $user->membership_level->id, "membership_level_name" => $user->membership_level->name, "membership_cost" => pmpro_getLevelCost($user->membership_level), "login_link" => wp_login_url(pmpro_url("account")), "display_name" => $user->display_name, "user_email" => $user->user_email);
if (!empty($invoice) && !pmpro_isLevelFree($user->membership_level)) {
if ($invoice->gateway == "paypalexpress") {
$this->template = "checkout_express_admin";
} elseif ($invoice->gateway == "check") {
$this->template = "checkout_check_admin";
} elseif (pmpro_isLevelTrial($user->membership_level)) {
$this->template = "checkout_trial_admin";
} else {
$this->template = "checkout_paid_admin";
}
$this->data["invoice_id"] = $invoice->code;
$this->data["invoice_total"] = pmpro_formatPrice($invoice->total);
$this->data["invoice_date"] = date_i18n(get_option('date_format'), $invoice->timestamp);
$this->data["billing_name"] = $invoice->billing->name;
$this->data["billing_street"] = $invoice->billing->street;
$this->data["billing_city"] = $invoice->billing->city;
$this->data["billing_state"] = $invoice->billing->state;
$this->data["billing_zip"] = $invoice->billing->zip;
$this->data["billing_country"] = $invoice->billing->country;
$this->data["billing_phone"] = $invoice->billing->phone;
$this->data["cardtype"] = $invoice->cardtype;
$this->data["accountnumber"] = hideCardNumber($invoice->accountnumber);
$this->data["expirationmonth"] = $invoice->expirationmonth;
$this->data["expirationyear"] = $invoice->expirationyear;
$this->data["billing_address"] = pmpro_formatAddress($invoice->billing->name, $invoice->billing->street, "", $invoice->billing->city, $invoice->billing->state, $invoice->billing->zip, $invoice->billing->country, $invoice->billing->phone);
if ($invoice->getDiscountCode()) {
$this->data["discount_code"] = "<p>" . __("Discount Code", "pmpro") . ": " . $invoice->discount_code->code . "</p>\n";
} else {
$this->data["discount_code"] = "";
}
} elseif (pmpro_isLevelFree($user->membership_level)) {
$this->template = "checkout_free_admin";
global $discount_code;
if (!empty($discount_code)) {
$this->data["discount_code"] = "<p>" . __("Discount Code", "pmpro") . ": " . $discount_code . "</p>\n";
} else {
$this->data["discount_code"] = "";
}
} else {
$this->template = "checkout_freetrial_admin";
$this->data["discount_code"] = "";
}
$enddate = $wpdb->get_var("SELECT UNIX_TIMESTAMP(enddate) FROM {$wpdb->pmpro_memberships_users} WHERE user_id = '" . $user->ID . "' AND status = 'active' LIMIT 1");
if ($enddate) {
$this->data["membership_expiration"] = "<p>" . sprintf(__("This membership will expire on %s.", "pmpro"), date_i18n(get_option('date_format'), $enddate)) . "</p>\n";
} else {
$this->data["membership_expiration"] = "";
}
return $this->sendEmail();
}
示例8: if
</tr>
<tr class="recurring_info" <?php if(!pmpro_isLevelRecurring($level)) {?>style="display: none;"<?php } ?>>
<th scope="row" valign="top"><label for="billing_limit">Billing Cycle Limit:</label></th>
<td>
<input name="billing_limit[]" type="text" size="20" value="<?php echo $level->billing_limit?>" />
<br /><small>The <strong>total</strong> number of billing cycles for this level, including the trial period (if applicable). Set to zero if membership is indefinite.</small>
</td>
</tr>
<tr class="recurring_info" <?php if (!pmpro_isLevelRecurring($level)) echo "style='display:none;'";?>>
<th scope="row" valign="top"><label>Custom Trial:</label></th>
<td><input id="custom_trial_<?php echo $level->id?>" name="custom_trial[]" type="checkbox" value="<?php echo $level->id?>" <?php if ( pmpro_isLevelTrial($level) ) { echo "checked='checked'"; } ?> onclick="if(jQuery(this).attr('checked')) jQuery(this).parent().parent().siblings('.trial_info').show(); else jQuery(this).parent().parent().siblings('.trial_info').hide();" /> Check to add a custom trial period.</td>
</tr>
<tr class="trial_info recurring_info" <?php if (!pmpro_isLevelTrial($level)) echo "style='display:none;'";?>>
<th scope="row" valign="top"><label for="trial_amount">Trial Billing Amount:</label></th>
<td>
<?php echo $pmpro_currency_symbol?><input name="trial_amount[]" type="text" size="20" value="<?php echo str_replace("\"", """, stripslashes($level->trial_amount))?>" />
<small>for the first</small>
<input name="trial_limit[]" type="text" size="10" value="<?php echo str_replace("\"", """, stripslashes($level->trial_limit))?>" />
<small>subscription payments.</small>
</td>
</tr>
<tr>
<th scope="row" valign="top"><label>Membership Expiration:</label></th>
<td><input id="expiration" name="expiration[]" type="checkbox" value="<?php echo $level->id?>" <?php if(pmpro_isLevelExpiring($level)) { echo "checked='checked'"; } ?> onclick="if(jQuery(this).is(':checked')) { jQuery(this).parent().parent().siblings('.expiration_info').show(); } else { jQuery(this).parent().parent().siblings('.expiration_info').hide();}" /> <small>Check this to set an expiration date for new sign ups.</small></td>
</tr>
<tr class="expiration_info" <?php if(!pmpro_isLevelExpiring($level)) {?>style="display: none;"<?php } ?>>