本文整理汇总了PHP中pmpro_formatPrice函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_formatPrice函数的具体用法?PHP pmpro_formatPrice怎么用?PHP pmpro_formatPrice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_formatPrice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pmpro_report_sales_widget
function pmpro_report_sales_widget()
{
global $wpdb;
?>
<style>
#pmpro_report_sales div {text-align: center;}
#pmpro_report_sales em {display: block; font-style: normal; font-size: 2em; margin: 5px;}
</style>
<span id="#pmpro_report_sales">
<div style="width: 25%; float: left;">
<em><?php
echo pmpro_getSales("all time");
?>
</em>
<label>All Time</label>
<em><?php
echo pmpro_formatPrice(pmpro_getRevenue("all time"));
?>
</em>
</div>
<div style="width: 25%; float: left;">
<em><?php
echo pmpro_getSales("this year");
?>
</em>
<label>This Year</label>
<em><?php
echo pmpro_formatPrice(pmpro_getRevenue("this year"));
?>
</em>
</div>
<div style="width: 25%; float: left;">
<em><?php
echo pmpro_getSales("this month");
?>
</em>
<label>This Month</label>
<em><?php
echo pmpro_formatPrice(pmpro_getRevenue("this month"));
?>
</em>
</div>
<div style="width: 25%; float: left;">
<em><?php
echo pmpro_getSales("today");
?>
</em>
<label>Today</label>
<em><?php
echo pmpro_formatPrice(pmpro_getRevenue("today"));
?>
</em>
</div>
<div class="clear"></div>
</span>
<?php
}
示例2: pmpro_formatPrice
echo pmpro_formatPrice($auser->initial_payment);
?>
<?php
}
?>
<?php
if ((double) $auser->initial_payment > 0 && (double) $auser->billing_amount > 0) {
?>
+<br /><?php
}
?>
<?php
if ((double) $auser->billing_amount > 0) {
?>
<?php
echo pmpro_formatPrice($auser->billing_amount);
?>
/<?php
if ($auser->cycle_number > 1) {
echo $auser->cycle_number . " " . $auser->cycle_period . "s";
} else {
echo $auser->cycle_period;
}
?>
<?php
}
?>
<?php
if ((double) $auser->initial_payment <= 0 && (double) $auser->billing_amount <= 0) {
?>
-
示例3: sendToTwocheckout
function sendToTwocheckout(&$order)
{
global $pmpro_currency;
$tco_args = array('sid' => pmpro_getOption("twocheckout_accountnumber"), 'mode' => '2CO', 'li_0_type' => 'product', 'li_0_name' => substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127), 'li_0_quantity' => 1, 'li_0_tangible' => 'N', 'li_0_product_id' => $order->code, 'merchant_order_id' => $order->code, 'currency_code' => $pmpro_currency, 'pay_method' => 'CC', 'purchase_step' => 'billing-information', 'x_receipt_link_url' => admin_url("admin-ajax.php") . "?action=twocheckout-ins");
//taxes on initial amount
$initial_payment = $order->InitialPayment;
$initial_payment_tax = $order->getTaxForPrice($initial_payment);
$initial_payment = round((double) $initial_payment + (double) $initial_payment_tax, 2);
//taxes on the amount (NOT CURRENTLY USED)
$amount = $order->PaymentAmount;
$amount_tax = $order->getTaxForPrice($amount);
$amount = round((double) $amount + (double) $amount_tax, 2);
// Recurring membership
if (pmpro_isLevelRecurring($order->membership_level)) {
$tco_args['li_0_startup_fee'] = number_format($initial_payment - $amount, 2, ".", "");
//negative amount for lower initial payments
$recurring_payment = number_format($order->membership_level->billing_amount, 2, ".", "");
$recurring_payment_tax = number_format($order->getTaxForPrice($recurring_payment), 2, ".", "");
$recurring_payment = number_format(round((double) $recurring_payment + (double) $recurring_payment_tax, 2), 2, ".", "");
$tco_args['li_0_price'] = number_format($recurring_payment, 2, ".", "");
$tco_args['li_0_recurrence'] = $order->BillingFrequency == 1 ? $order->BillingFrequency . ' ' . $order->BillingPeriod : $order->BillingFrequency . ' ' . $order->BillingPeriod . 's';
if (property_exists($order, 'TotalBillingCycles')) {
$tco_args['li_0_duration'] = $order->BillingFrequency * $order->TotalBillingCycles . ' ' . $order->BillingPeriod;
} else {
$tco_args['li_0_duration'] = 'Forever';
}
} else {
$tco_args['li_0_price'] = number_format($initial_payment, 2, ".", "");
}
// Demo mode?
if (empty($order->gateway_environment)) {
$gateway_environment = pmpro_getOption("gateway_environment");
} else {
$gateway_environment = $order->gateway_environment;
}
if ("sandbox" === $gateway_environment || "beta-sandbox" === $gateway_environment) {
Twocheckout::sandbox(true);
$tco_args['demo'] = 'Y';
} else {
Twocheckout::sandbox(false);
}
// Trial?
//li_#_startup_fee Any start up fees for the product or service. Can be negative to provide discounted first installment pricing, but cannot equal or surpass the product price.
if (!empty($order->TrialBillingPeriod)) {
$trial_amount = $order->TrialAmount;
$trial_tax = $order->getTaxForPrice($trial_amount);
$trial_amount = pmpro_formatPrice(round((double) $trial_amount + (double) $trial_tax, 2), false, false);
$tco_args['li_0_startup_fee'] = $trial_amount;
// Negative trial amount
}
$ptpStr = '';
foreach ($tco_args as $key => $value) {
reset($tco_args);
// Used to verify whether or not we're on the first argument
$ptpStr .= $key == key($tco_args) ? '?' . $key . '=' . urlencode($value) : '&' . $key . '=' . urlencode($value);
}
//anything modders might add
$additional_parameters = apply_filters('pmpro_twocheckout_return_url_parameters', array());
if (!empty($additional_parameters)) {
foreach ($additional_parameters as $key => $value) {
$ptpStr .= "&" . urlencode($key) . "=" . urlencode($value);
}
}
$ptpStr = apply_filters('pmpro_twocheckout_ptpstr', $ptpStr, $order);
///useful for debugging
///echo str_replace("&", "&<br />", $ptpStr);
///exit;
//figure out gateway environment and URL to use
if ($gateway_environment == "live") {
$host = "www.2checkout.com";
} else {
$host = "sandbox.2checkout.com";
}
$tco_url = 'https://' . $host . '/checkout/purchase' . $ptpStr;
//redirect to 2checkout
wp_redirect($tco_url);
exit;
}
示例4: sendToMigs
function sendToMigs(&$order)
{
global $pmpro_currency;
//$order_id = $order->code;
//taxes on initial amount
$initial_payment = $order->InitialPayment;
$initial_payment_tax = $order->getTaxForPrice($initial_payment);
$initial_payment = round((double) $initial_payment + (double) $initial_payment_tax, 2);
$details = '';
//taxes on the amount (NOT CURRENTLY USED)
$amount = $order->PaymentAmount;
$amount_tax = $order->getTaxForPrice($amount);
$amount = round((double) $amount + (double) $amount_tax, 2);
// Recurring membership
if (pmpro_isLevelRecurring($order->membership_level)) {
$amount = number_format($initial_payment - $amount, 2, ".", "");
//negative amount for lower initial payments
$recurring_payment = number_format($order->membership_level->billing_amount, 2, ".", "");
$recurring_payment_tax = number_format($order->getTaxForPrice($recurring_payment), 2, ".", "");
$recurring_payment = number_format(round((double) $recurring_payment + (double) $recurring_payment_tax, 2), 2, ".", "");
$amount = number_format($recurring_payment, 2, ".", "");
$details = $order->BillingFrequency == 1 ? $order->BillingFrequency . ' ' . $order->BillingPeriod : $order->BillingFrequency . ' ' . $order->BillingPeriod . 's';
if (property_exists($order, 'TotalBillingCycles')) {
$details = $order->BillingFrequency * $order->TotalBillingCycles . ' ' . $order->BillingPeriod;
} else {
$details = 'Forever';
}
} else {
$amount = number_format($initial_payment, 2, ".", "");
}
if (!empty($order->TrialBillingPeriod)) {
$trial_amount = $order->TrialAmount;
$trial_tax = $order->getTaxForPrice($trial_amount);
$trial_amount = pmpro_formatPrice(round((double) $trial_amount + (double) $trial_tax, 2), false, false);
$amount = $trial_amount;
// Negative trial amount
}
global $pmpro_level;
//create a code for the order
if (empty($order->code)) {
$order->code = $order->getRandomCode();
}
//what amount to charge?
$amount = $order->InitialPayment;
//tax
$order->subtotal = $amount;
$tax = $order->getTax(true);
$amount = round((double) $order->subtotal + (double) $tax, 2);
//create a customer
//$result = $this->getCustomer($order);
/*if(empty($result))
{
//failed to create customer
return false;
}*/
//charge
try {
$order_id = $order->code;
$order_amount = 100 * $amount;
$md5Hash = pmpro_getOption("securehashe");
/* Make sure user entered MIGS url, otherwise use the default one */
if (trim($this->service_host) == "" || $this->service_host == null) {
$this->service_host = "https://migs.mastercard.com.au/vpcpay";
}
$service_host = $this->service_host . "?";
$rurl = admin_url("admin-ajax.php") . "?action=migspaymenthandler";
//$rurl='https://nibaya.com/ccc/wp-content/plugins/pmpro-example-gateway/classes/paymenthandler.php?';
//$rurl = pmpro_url("confirmation", "?level=" . $order->membership_level);
$user_ID = get_current_user_id();
$DigitalOrder = array("vpc_Version" => "1", "vpc_Command" => "pay", "vpc_AccessCode" => pmpro_getOption("accescodee"), "vpc_MerchTxnRef" => $order_id . '_' . date("Y-m-d"), "vpc_Merchant" => pmpro_getOption("merchantide"), "vpc_OrderInfo" => $order_id . '_' . date("Y-m-d"), "vpc_Amount" => $order_amount, "vpc_Locale" => "en", "vpc_ReturnURL" => $rurl . '&level=1');
ksort($DigitalOrder);
foreach ($DigitalOrder as $key => $value) {
if (strlen($value) > 0) {
if ($appendAmp == 0) {
$service_host .= urlencode($key) . '=' . urlencode($value);
$appendAmp = 1;
} else {
$service_host .= '&' . urlencode($key) . "=" . urlencode($value);
}
$md5Hash .= $value;
}
}
$service_host .= "&vpc_SecureHash=" . strtoupper(md5($md5Hash));
//$order->saveOrder();
//echo $service_host;
header("Location:" . $service_host);
exit;
} catch (Exception $e) {
//$order->status = "error";
$order->errorcode = true;
$order->error = "Error: " . $e->getMessage();
$order->shorterror = $order->error;
return false;
}
//$order->saveOrder();
//echo $service_host;
//header("Location:".$service_host);
//exit();
// Demo mode?
// if(empty($order->gateway_environment))
//.........这里部分代码省略.........
示例5: pmpro_membership_level_profile_fields
function pmpro_membership_level_profile_fields($user)
{
global $current_user;
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
if (!current_user_can($membership_level_capability)) {
return false;
}
global $wpdb;
/*$user->membership_level = $wpdb->get_row("SELECT l.id AS ID, l.name AS name
FROM {$wpdb->pmpro_membership_levels} AS l
JOIN {$wpdb->pmpro_memberships_users} AS mu ON (l.id = mu.membership_id)
WHERE mu.user_id = " . $user->ID . "
LIMIT 1");*/
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
$levels = $wpdb->get_results("SELECT * FROM {$wpdb->pmpro_membership_levels}", OBJECT);
if (!$levels) {
return "";
}
?>
<h3><?php
_e("Membership Level", "pmpro");
?>
</h3>
<table class="form-table">
<?php
$show_membership_level = true;
$show_membership_level = apply_filters("pmpro_profile_show_membership_level", $show_membership_level, $user);
if ($show_membership_level) {
?>
<tr>
<th><label for="membership_level"><?php
_e("Current Level", "pmpro");
?>
</label></th>
<td>
<select name="membership_level" onchange="pmpro_mchange_warning();">
<option value="" <?php
if (empty($user->membership_level->ID)) {
?>
selected="selected"<?php
}
?>
>-- <?php
_e("None", "pmpro");
?>
--</option>
<?php
foreach ($levels as $level) {
$current_level = $user->membership_level->ID == $level->id;
?>
<option value="<?php
echo $level->id;
?>
" <?php
if ($current_level) {
?>
selected="selected"<?php
}
?>
><?php
echo $level->name;
?>
</option>
<?php
}
?>
</select>
<script>
var pmpro_mchange_once = 0;
function pmpro_mchange_warning()
{
if(pmpro_mchange_once == 0)
{
alert('Warning: The existing membership will be cancelled, and the new membership will be free.');
pmpro_mchange_once = 1;
}
}
</script>
<?php
$membership_values = $wpdb->get_row("SELECT * FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND user_id = '" . $user->ID . "' LIMIT 1");
if (!empty($membership_values->billing_amount) || !empty($membership_values->trial_amount)) {
?>
<?php
if ($membership_values->billing_amount > 0) {
?>
at <?php
echo pmpro_formatPrice($membership_values->billing_amount);
?>
<?php
if ($membership_values->cycle_number > 1) {
?>
per <?php
echo $membership_values->cycle_number;
?>
<?php
echo sornot($membership_values->cycle_period, $membership_values->cycle_number);
?>
<?php
} elseif ($membership_values->cycle_number == 1) {
?>
//.........这里部分代码省略.........
示例6: pmpro_getLevelCost
function pmpro_getLevelCost(&$level, $tags = true, $short = false)
{
//initial payment
if (!$short) {
$r = sprintf(__('The price for membership is <strong>%s</strong> now', 'pmpro'), pmpro_formatPrice($level->initial_payment));
} else {
$r = sprintf(__('<strong>%s</strong> now', 'pmpro'), pmpro_formatPrice($level->initial_payment));
}
//recurring part
if ($level->billing_amount != '0.00') {
if ($level->billing_limit > 1) {
if ($level->cycle_number == '1') {
$r .= sprintf(__(' and then <strong>%s per %s for %d more %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
} else {
$r .= sprintf(__(' and then <strong>%s every %d %s for %d more %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number), $level->billing_limit, pmpro_translate_billing_period($level->cycle_period, $level->billing_limit));
}
} elseif ($level->billing_limit == 1) {
$r .= sprintf(__(' and then <strong>%s after %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
} else {
if ($level->billing_amount === $level->initial_payment) {
if ($level->cycle_number == '1') {
if (!$short) {
$r = sprintf(__('The price for membership is <strong>%s per %s</strong>.', 'pmpro'), pmpro_formatPrice($level->initial_payment), pmpro_translate_billing_period($level->cycle_period));
} else {
$r = sprintf(__('<strong>%s per %s</strong>.', 'pmpro'), pmpro_formatPrice($level->initial_payment), pmpro_translate_billing_period($level->cycle_period));
}
} else {
if (!$short) {
$r = sprintf(__('The price for membership is <strong>%s every %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->initial_payment), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
} else {
$r = sprintf(__('<strong>%s every %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->initial_payment), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
}
}
} else {
if ($level->cycle_number == '1') {
$r .= sprintf(__(' and then <strong>%s per %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period));
} else {
$r .= sprintf(__(' and then <strong>%s every %d %s</strong>.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
}
}
}
} else {
$r .= '.';
}
//add a space
$r .= ' ';
//trial part
if ($level->trial_limit) {
if ($level->trial_amount == '0.00') {
if ($level->trial_limit == '1') {
$r .= ' ' . __('After your initial payment, your first payment is Free.', 'pmpro');
} else {
$r .= ' ' . sprintf(__('After your initial payment, your first %d payments are Free.', 'pmpro'), $level->trial_limit);
}
} else {
if ($level->trial_limit == '1') {
$r .= ' ' . sprintf(__('After your initial payment, your first payment will cost %s.', 'pmpro'), pmpro_formatPrice($level->trial_amount));
} else {
$r .= ' ' . sprintf(__('After your initial payment, your first %d payments will cost %s.', 'pmpro'), $level->trial_limit, pmpro_formatPrice($level->trial_amount));
}
}
}
//taxes part
$tax_state = pmpro_getOption("tax_state");
$tax_rate = pmpro_getOption("tax_rate");
if ($tax_state && $tax_rate && !pmpro_isLevelFree($level)) {
$r .= sprintf(__('Customers in %s will be charged %s%% tax.', 'pmpro'), $tax_state, round($tax_rate * 100, 2));
}
if (!$tags) {
$r = strip_tags($r);
}
$r = apply_filters("pmpro_level_cost_text", $r, $level, $tags, $short);
//passing $tags and $short since v2.0
return $r;
}
示例7: pmpro_addon_packages_shortcode
//.........这里部分代码省略.........
echo $view_button;
?>
</a></td>
<?php
} else {
//which level to use for checkout link?
$text_level_id = pmproap_getLevelIDForCheckoutLink($post->ID, $current_user->ID);
?>
<td width="25%" class="pmpro_addon_package-buy">
<?php
if (empty($text_level_id)) {
?>
<a class="pmpro_btn" href="<?php
echo pmpro_url("levels");
?>
">
<?php
echo $levels_button;
?>
</a>
<?php
} else {
//what's the price
$pmproap_price = get_post_meta($post->ID, "_pmproap_price", true);
?>
<a class="pmpro_btn" href="<?php
echo pmpro_url("checkout", "?level=" . $text_level_id . "&ap=" . $post->ID);
?>
">
<?php
echo $checkout_button;
?>
— <span class="pmpro_addon_package-price"><?php
echo pmpro_formatPrice($pmproap_price);
?>
</span>
</a>
<?php
}
?>
</td>
<?php
}
?>
</tr> <!-- end pmpro_addon_package-->
<?php
}
?>
</tbody>
</table> <!-- end #pmpro_addon_packages -->
<?php
} else {
?>
<div id="pmpro_addon_packages">
<?php
foreach ($pmproap_posts_chunks as $row) {
?>
<div class="row">
<?php
foreach ($row as $post) {
$pmproap_price = get_post_meta($post->ID, "_pmproap_price", true);
?>
<div class="medium-<?php
if ($layout == '2col') {
echo '6 ';
} elseif ($layout == '3col') {
示例8: pmpro_membership_level_profile_fields
function pmpro_membership_level_profile_fields($user)
{
global $current_user;
$membership_level_capability = apply_filters("pmpro_edit_member_capability", "manage_options");
if (!current_user_can($membership_level_capability)) {
return false;
}
global $wpdb;
/*$user->membership_level = $wpdb->get_row("SELECT l.id AS ID, l.name AS name
FROM {$wpdb->pmpro_membership_levels} AS l
JOIN {$wpdb->pmpro_memberships_users} AS mu ON (l.id = mu.membership_id)
WHERE mu.user_id = " . $user->ID . "
LIMIT 1");*/
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
$levels = $wpdb->get_results("SELECT * FROM {$wpdb->pmpro_membership_levels}", OBJECT);
if (!$levels) {
return "";
}
?>
<h3><?php
_e("Membership Level", "pmpro");
?>
</h3>
<table class="form-table">
<?php
$show_membership_level = true;
$show_membership_level = apply_filters("pmpro_profile_show_membership_level", $show_membership_level, $user);
if ($show_membership_level) {
?>
<tr>
<th><label for="membership_level"><?php
_e("Current Level", "pmpro");
?>
</label></th>
<td>
<select name="membership_level">
<option value="" <?php
if (empty($user->membership_level->ID)) {
?>
selected="selected"<?php
}
?>
>-- <?php
_e("None", "pmpro");
?>
--</option>
<?php
foreach ($levels as $level) {
?>
<option value="<?php
echo $level->id;
?>
" <?php
selected($level->id, isset($user->membership_level->ID) ? $user->membership_level->ID : 0);
?>
><?php
echo $level->name;
?>
</option>
<?php
}
?>
</select>
<span id="current_level_cost">
<?php
$membership_values = pmpro_getMembershipLevelForUser($user->ID);
//we tweak the initial payment here so the text here effectively shows the recurring amount
if (!empty($membership_values)) {
$membership_values->original_initial_payment = $membership_values->initial_payment;
$membership_values->initial_payment = $membership_values->billing_amount;
}
if (empty($membership_values) || pmpro_isLevelFree($membership_values)) {
if (!empty($membership_values->original_initial_payment) && $membership_values->original_initial_payment > 0) {
echo "Paid " . pmpro_formatPrice($membership_values->original_initial_payment) . ".";
} else {
_e('Not paying.', 'pmpro');
}
} else {
echo pmpro_getLevelCost($membership_values, true, true);
}
?>
</span>
<p id="cancel_description" class="description hidden"><?php
_e("This will not change the subscription at the gateway unless the 'Cancel' checkbox is selected below.", "pmpro");
?>
</p>
</td>
</tr>
<?php
}
$show_expiration = true;
$show_expiration = apply_filters("pmpro_profile_show_expiration", $show_expiration, $user);
if ($show_expiration) {
//is there an end date?
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
$end_date = !empty($user->membership_level->enddate);
//some vars for the dates
$current_day = date("j");
if ($end_date) {
$selected_expires_day = date("j", $user->membership_level->enddate);
//.........这里部分代码省略.........
示例9: pmpro_report_sales_widget
function pmpro_report_sales_widget()
{
global $wpdb;
?>
<style>
#pmpro_report_sales tbody td:last-child {text-align: right; }
</style>
<span id="pmpro_report_sales">
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th scope="col"> </th>
<th scope="col"><?php
_e('Sales', 'pmpro');
?>
</th>
<th scope="col"><?php
_e('Revenue', 'pmpro');
?>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"><?php
_e('Today', 'pmpro');
?>
</th>
<td><?php
echo number_format_i18n(pmpro_getSales("today"));
?>
</td>
<td><?php
echo pmpro_formatPrice(pmpro_getRevenue("today"));
?>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('This Month', 'pmpro');
?>
</th>
<td><?php
echo number_format_i18n(pmpro_getSales("this month"));
?>
</td>
<td><?php
echo pmpro_formatPrice(pmpro_getRevenue("this month"));
?>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('This Year', 'pmpro');
?>
</th>
<td><?php
echo number_format_i18n(pmpro_getSales("this year"));
?>
</td>
<td><?php
echo pmpro_formatPrice(pmpro_getRevenue("this year"));
?>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('All Time', 'pmpro');
?>
</th>
<td><?php
echo number_format_i18n(pmpro_getSales("all time"));
?>
</td>
<td><?php
echo pmpro_formatPrice(pmpro_getRevenue("all time"));
?>
</td>
</tr>
</tbody>
</table>
</span>
<?php
}
示例10: pmpro_formatPrice
<?php
}
?>
</td>
<td>
<?php
if (!pmpro_isLevelTrial($level)) {
?>
--
<?php
} else {
?>
<?php
echo pmpro_formatPrice($level->trial_amount);
?>
<?php
_e('for', 'pmpro');
?>
<?php
echo $level->trial_limit;
?>
<?php
echo sornot("payment", $level->trial_limit);
?>
<?php
}
?>
</td>
<td>
示例11: billing_content_func
function billing_content_func($atts)
{
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
//-> If a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.)
if ($current_user->membership_level->ID) {
if ($pmpro_msg) {
?>
<div class="pmpro_message <?php
echo $pmpro_msgt;
?>
"><?php
echo $pmpro_msg;
?>
</div>
<?php
}
?>
<div class="row billing-content">
<div class="col-md-8 col-sm-8 col-sm-offset-3 col-md-offset-3">
<!-- BEGIN CONTENT-->
<div id="pmpro_account">
<div id="pmpro_account-membership" class="pmpro_box-first">
<?php
//wpex_logo();
?>
<!--
<div class="clear clearfix"></div>
<br/>
-->
<?php
$level = $current_user->membership_level->name;
?>
<p><?php
_e("Membership status: <strong>" . $level . "</strong>", "pmpro");
?>
</p>
<?php
//die(var_dump($current_user));
?>
<ul>
<li><strong><?php
_e("Level", "pmpro");
?>
:</strong> <?php
echo $current_user->membership_level->name;
?>
</li>
<?php
if ($current_user->membership_level->billing_amount > 0) {
?>
<li><strong><?php
_e("Membership Fee", "pmpro");
?>
:</strong>
<?php
$level = $current_user->membership_level;
if ($current_user->membership_level->cycle_number > 1) {
printf(__('%s every %d %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
} elseif ($current_user->membership_level->cycle_number == 1) {
printf(__('%s per %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period));
} else {
echo pmpro_formatPrice($current_user->membership_level->billing_amount);
}
?>
</li>
<?php
}
?>
<?php
if ($current_user->membership_level->billing_limit) {
?>
<li><strong><?php
_e("Duration", "pmpro");
?>
:</strong> <?php
echo $current_user->membership_level->billing_limit . ' ' . sornot($current_user->membership_level->cycle_period, $current_user->membership_level->billing_limit);
?>
</li>
<?php
}
?>
<?php
if ($current_user->membership_level->enddate) {
?>
<li><strong><?php
_e("Next billing date", "pmpro");
?>
:</strong> <?php
echo date_i18n(get_option('date_format'), $current_user->membership_level->enddate);
?>
</li>
<?php
}
?>
//.........这里部分代码省略.........
示例12: pmpropbc_reminder_emails
function pmpropbc_reminder_emails()
{
global $wpdb;
//make sure we only run once a day
$now = current_time('timestamp');
$today = date("Y-m-d", $now);
//have to run for each level, so get levels
$levels = pmpro_getAllLevels(true, true);
if (empty($levels)) {
return;
}
foreach ($levels as $level) {
//get options
$options = pmpropbc_getOptions($level->id);
if (!empty($options['reminder_days'])) {
$date = date("Y-m-d", strtotime("+ " . $options['reminder_days'] . " days", $now));
} else {
$date = $today;
}
//need to get all combos of pay cycle and period
$sqlQuery = "SELECT DISTINCT(CONCAT(cycle_number, ' ', cycle_period)) FROM {$wpdb->pmpro_memberships_users} WHERE membership_id = '" . $level->id . "' AND cycle_number > 0 AND status = 'active'";
$combos = $wpdb->get_col($sqlQuery);
if (empty($combos)) {
continue;
}
foreach ($combos as $combo) {
//get all check orders still pending after X days
$sqlQuery = "\r\n\t\t\t\tSELECT id \r\n\t\t\t\tFROM {$wpdb->pmpro_membership_orders} \r\n\t\t\t\tWHERE membership_id = {$level->id} \r\n\t\t\t\t\tAND gateway = 'check' \r\n\t\t\t\t\tAND status = 'pending' \r\n\t\t\t\t\tAND DATE_ADD(timestamp, INTERVAL {$combo}) <= '" . $date . "'\r\n\t\t\t\t\tAND notes NOT LIKE '%Reminder Sent:%' AND notes NOT LIKE '%Reminder Skipped:%'\r\n\t\t\t\tORDER BY id\r\n\t\t\t";
if (defined('PMPRO_CRON_LIMIT')) {
$sqlQuery .= " LIMIT " . PMPRO_CRON_LIMIT;
}
$orders = $wpdb->get_col($sqlQuery);
if (empty($orders)) {
continue;
}
foreach ($orders as $order_id) {
//get some data
$order = new MemberOrder($order_id);
$user = get_userdata($order->user_id);
$user->membership_level = pmpro_getMembershipLevelForUser($order->user_id);
//if they are no longer a member, let's not send them an email
if (empty($user->membership_level) || empty($user->membership_level->ID) || $user->membership_level->id != $order->membership_id) {
//note when we send the reminder
$new_notes = $order->notes . "Reminder Skipped:" . $today . "\n";
$wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET notes = '" . esc_sql($new_notes) . "' WHERE id = '" . $order_id . "' LIMIT 1");
continue;
}
//note when we send the reminder
$new_notes = $order->notes . "Reminder Sent:" . $today . "\n";
$wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET notes = '" . esc_sql($new_notes) . "' WHERE id = '" . $order_id . "' LIMIT 1");
//setup email to send
$email = new PMProEmail();
$email->template = "check_pending_reminder";
$email->email = $user->user_email;
$email->subject = sprintf(__("Reminder: New Invoice for %s at %s", "pmpropbc"), $user->membership_level->name, get_option("blogname"));
//get body from template
$email->body = file_get_contents(PMPRO_PAY_BY_CHECK_DIR . "/email/" . $email->template . ".html");
//setup more data
$email->data = array("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);
$email->data["instructions"] = pmpro_getOption('instructions');
$email->data["invoice_id"] = $order->code;
$email->data["invoice_total"] = pmpro_formatPrice($order->total);
$email->data["invoice_date"] = date(get_option('date_format'), $order->timestamp);
$email->data["billing_name"] = $order->billing->name;
$email->data["billing_street"] = $order->billing->street;
$email->data["billing_city"] = $order->billing->city;
$email->data["billing_state"] = $order->billing->state;
$email->data["billing_zip"] = $order->billing->zip;
$email->data["billing_country"] = $order->billing->country;
$email->data["billing_phone"] = $order->billing->phone;
$email->data["cardtype"] = $order->cardtype;
$email->data["accountnumber"] = hideCardNumber($order->accountnumber);
$email->data["expirationmonth"] = $order->expirationmonth;
$email->data["expirationyear"] = $order->expirationyear;
$email->data["billing_address"] = pmpro_formatAddress($order->billing->name, $order->billing->street, "", $order->billing->city, $order->billing->state, $order->billing->zip, $order->billing->country, $order->billing->phone);
if ($order->getDiscountCode()) {
$email->data["discount_code"] = "<p>" . __("Discount Code", "pmpro") . ": " . $order->discount_code->code . "</p>\n";
} else {
$email->data["discount_code"] = "";
}
//send the email
$email->sendEmail();
}
}
}
}
示例13: pmprodon_pmpro_email_filter
function pmprodon_pmpro_email_filter($email)
{
global $wpdb;
//only update admin confirmation emails
if (strpos($email->template, "checkout") !== false) {
//get the user_id from the email
$order_id = $email->data['invoice_id'];
if (!empty($order_id)) {
$order = new MemberOrder($order_id);
$components = pmprodon_getPriceComponents($order);
//add to bottom of email
if (!empty($components['donation'])) {
$email->body = preg_replace("/\\<p\\>\\s*Invoice/", "<p>Donation Amount: " . pmpro_formatPrice($components['donation']) . "</p><p>Invoice", $email->body);
}
}
}
return $email;
}
示例14: pmpro_report_memberships_widget
//.........这里部分代码省略.........
echo pmpro_getSignups('this month');
?>
</em>
</div>
<div style="width: 25%; float: left;">
<label><?php
_e('Today', 'pmpro');
?>
</label>
<em><?php
echo pmpro_getSignups('today');
?>
</em>
</div>
<div class="clear"></div>
<label class="section-label"><?php
_e('Cancellations', 'pmpro');
?>
:</label>
<div style="width: 25%; float: left;">
<label><?php
_e('All Time', 'pmpro');
?>
</label>
<em><?php
echo pmpro_getCancellations('all time');
?>
</em>
</div>
<div style="width: 25%; float: left;">
<label><?php
_e('This Year', 'pmpro');
?>
</label>
<em><?php
echo pmpro_getCancellations('this year');
?>
</em>
</div>
<div style="width: 25%; float: left;">
<label><?php
_e('This Month', 'pmpro');
?>
</label>
<em><?php
echo pmpro_getCancellations('this month');
?>
</em>
</div>
<div style="width: 25%; float: left;">
<label><?php
_e('Today', 'pmpro');
?>
</label>
<em><?php
echo pmpro_getCancellations('today');
?>
</em>
</div>
<div class="clear"></div>
<label class="section-label"><?php
_e('Other Stats', 'pmpro');
?>
:</label>
<div style="width: 33%; float: left;">
<label><?php
_e('Monthly Recurring Revenue (MRR)', 'pmpro');
?>
</label>
<em><?php
echo pmpro_formatPrice(pmpro_getMRR('all time'));
?>
</em>
</div>
<div style="width: 33%; float: left;">
<label><?php
_e('Cancellation Rate', 'pmpro');
?>
</label>
<em><?php
echo pmpro_getCancellationRate('all time');
?>
%</em>
</div>
<div style="width: 33%; float: left;">
<label><?php
_e('Lifetime Value (LTV)', 'pmpro');
?>
</label>
<em><?php
echo pmpro_formatPrice(pmpro_getLTV('all time'));
?>
</em>
</div>
<div class="clear"></div>
</span>
<?php
}
示例15: _e
</li>
<?php
if ($level->billing_amount > 0) {
?>
<li><strong><?php
_e("Membership Fee", "pmpro");
?>
:</strong>
<?php
$level = $current_user->membership_level;
if ($current_user->membership_level->cycle_number > 1) {
printf(__('%s every %d %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
} elseif ($current_user->membership_level->cycle_number == 1) {
printf(__('%s per %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period));
} else {
echo pmpro_formatPrice($current_user->membership_level->billing_amount);
}
?>
</li>
<?php
}
?>
<?php
if ($level->billing_limit) {
?>
<li><strong><?php
_e("Duration", "pmpro");
?>
:</strong> <?php
echo $level->billing_limit . ' ' . sornot($level->cycle_period, $level->billing_limit);