本文整理汇总了PHP中pmpro_url函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_url函数的具体用法?PHP pmpro_url怎么用?PHP pmpro_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendToPayFast
function sendToPayFast(&$order)
{
global $pmpro_currency;
//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
$amount = $order->PaymentAmount;
$amount_tax = $order->getTaxForPrice($amount);
$order->subtotal = $amount;
$amount = round((double) $amount + (double) $amount_tax, 2);
//build PayFast Redirect
$environment = pmpro_getOption("gateway_environment");
if ("sandbox" === $environment || "beta-sandbox" === $environment) {
$merchant_id = self::SANDBOX_MERCHANT_ID;
$merchant_key = self::SANDBOX_MERCHANT_KEY;
$payfast_url = "https://sandbox.payfast.co.za/eng/process";
} else {
$merchant_id = pmpro_getOption("payfast_merchant_id");
$merchant_key = pmpro_getOption("payfast_merchant_key");
$payfast_url = "https://www.payfast.co.za/eng/process";
}
$data = array('merchant_id' => $merchant_id, 'merchant_key' => $merchant_key, 'return_url' => pmpro_url("confirmation", "?level=" . $order->membership_level->id), 'cancel_url' => '', 'notify_url' => admin_url("admin-ajax.php") . "?action=payfast_itn_handler", 'name_first' => $order->FirstName, 'name_last' => $order->LastName, 'email_address' => $order->Email, 'm_payment_id' => $order->code, 'amount' => number_format($initial_payment, 2), 'item_name' => substr($order->membership_level->name . " at " . get_bloginfo("name"), 0, 127));
$pfOutput = "";
foreach ($data as $key => $val) {
$pfOutput .= $key . '=' . urlencode(trim($val)) . '&';
}
// Remove last ampersand
$pfOutput = substr($pfOutput, 0, -1);
$signature = md5($pfOutput);
$payfast_url .= '?' . $pfOutput . '&signature=' . $signature;
wp_redirect($payfast_url);
exit;
}
示例2: pmpro_send_html
function pmpro_send_html($phpmailer)
{
// Set the original plain text message
$phpmailer->AltBody = wp_specialchars_decode($phpmailer->Body, ENT_QUOTES);
// Clean < and > around text links in WP 3.1
$phpmailer->Body = preg_replace('#<(http://[^*]+)>#', '$1', $phpmailer->Body);
// Convert line breaks & make links clickable
$phpmailer->Body = make_clickable($phpmailer->Body);
// Add header to message if found
if (file_exists(get_stylesheet_directory() . "/email_header.html")) {
$phpmailer->Body = file_get_contents(get_stylesheet_directory() . "/email_header.html") . "\n" . $phpmailer->Body;
} elseif (file_exists(get_template_directory() . "/email_header.html")) {
$phpmailer->Body = file_get_contents(get_template_directory() . "/email_header.html") . "\n" . $phpmailer->Body;
}
// Add footer to message if found
if (file_exists(get_stylesheet_directory() . "/email_footer.html")) {
$phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(get_stylesheet_directory() . "/email_footer.html");
} elseif (file_exists(get_template_directory() . "/email_footer.html")) {
$phpmailer->Body = $phpmailer->Body . "\n" . file_get_contents(get_template_directory() . "/email_footer.html");
}
// Replace variables in email
global $current_user;
$data = array("name" => $current_user->display_name, "sitename" => get_option("blogname"), "login_link" => pmpro_url("account"), "display_name" => $current_user->display_name, "user_email" => $current_user->user_email, "subject" => $phpmailer->Subject);
foreach ($data as $key => $value) {
$phpmailer->Body = str_replace("!!" . $key . "!!", $value, $phpmailer->Body);
}
do_action("pmpro_after_phpmailer_init", $phpmailer);
do_action("pmpro_after_pmpmailer_init", $phpmailer);
//typo left in for backwards compatibility
}
示例3: pmpron_manage_sites_preheader
function pmpron_manage_sites_preheader()
{
if (!is_admin()) {
global $post, $current_user;
if (!empty($post->post_content) && strpos($post->post_content, "[pmpron_manage_sites]") !== false) {
/*
Preheader operations here.
*/
//make sure they have site credits
global $current_user;
$credits = $current_user->pmpron_site_credits;
if (empty($credits)) {
//redirect to levels
wp_redirect(pmpro_url("levels"));
exit;
}
}
}
}
示例4: pmpro_addon_packages_shortcode
//.........这里部分代码省略.........
}
?>
<td class="pmpro_addon_package-title">
<h3>
<?php
if (!empty($link)) {
echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
} else {
echo get_the_title();
}
?>
</h3>
</td>
<?php
if (!empty($current_user->ID) && pmproap_hasAccess($current_user->ID, $post->ID)) {
?>
<td width="25%" class="pmpro_addon_package-view"><a class="pmpro_btn" href="<?php
echo the_permalink();
?>
"><?php
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
示例5: pmpro_getCheckoutButton
function pmpro_getCheckoutButton($level_id, $button_text = NULL, $classes = NULL)
{
if (empty($button_text)) {
$button_text = __("Sign Up for !!name!! Now", "pmpro");
}
if (empty($classes)) {
$classes = "pmpro_btn";
}
if (empty($level_id)) {
$r = __("Please specify a level id.", "pmpro");
} else {
//get level
$level = pmpro_getLevel($level_id);
//replace vars
$replacements = array("!!id!!" => $level->id, "!!name!!" => $level->name, "!!description!!" => $level->description, "!!confirmation!!" => $level->confirmation, "!!initial_payment!!" => $level->initial_payment, "!!billing_amount!!" => $level->billing_amount, "!!cycle_number!!" => $level->cycle_number, "!!cycle_period!!" => $level->cycle_period, "!!billing_limit!!" => $level->billing_limit, "!!trial_amount!!" => $level->trial_amount, "!!trial_limit!!" => $level->trial_limit, "!!expiration_number!!" => $level->expiration_number, "!!expiration_period!!" => $level->expiration_period);
$button_text = str_replace(array_keys($replacements), $replacements, $button_text);
//button text
$r = "<a href=\"" . pmpro_url("checkout", "?level=" . $level_id) . "\" class=\"" . $classes . "\">" . $button_text . "</a>";
}
return $r;
}
示例6: wp_redirect
<?php
global $besecure;
$besecure = false;
global $current_user, $pmpro_msg, $pmpro_msgt, $pmpro_confirm, $pmpro_error;
//if they don't have a membership, send them back to the subscription page
if (empty($current_user->membership_level->ID)) {
wp_redirect(pmpro_url("levels"));
}
if (isset($_REQUEST['confirm'])) {
$pmpro_confirm = $_REQUEST['confirm'];
} else {
$pmpro_confirm = false;
}
if ($pmpro_confirm) {
$old_level_id = $current_user->membership_level->id;
$worked = pmpro_changeMembershipLevel(false, $current_user->ID);
if ($worked === true && empty($pmpro_error)) {
$pmpro_msg = __("Your membership has been cancelled.", 'pmpro');
$pmpro_msgt = "pmpro_success";
//send an email to the member
$myemail = new PMProEmail();
$myemail->sendCancelEmail();
//send an email to the admin
$myemail = new PMProEmail();
$myemail->sendCancelAdminEmail($current_user, $old_level_id);
} else {
global $pmpro_error;
$pmpro_msg = $pmpro_error;
$pmpro_msgt = "pmpro_error";
}
示例7: pmprorh_email_passed
function pmprorh_email_passed($level)
{
global $wpdb, $pmpro_msg, $pmpro_msgt;
//confirm email
if (!empty($_GET['bemail']) && !is_user_logged_in()) {
//make sure the email is available
$oldemail = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE user_email = '" . esc_sql($_REQUEST['bemail']) . "' LIMIT 1");
if (!$oldemail || !apply_filters('pmpro_checkout_oldemail', true)) {
//confirm email
global $bemail, $bconfirmemail;
$bemail = str_replace(" ", "+", $_REQUEST['bemail']);
$bconfirmemail = $bemail;
$_REQUEST['bconfirmemail'] = $_REQUEST['bemail'];
//make sure bemail is still set later
add_action("pmpro_checkout_after_password", "pmproh_pmpro_checkout_after_password");
//don't show the confirm email
add_filter("pmpro_checkout_confirm_email", "pmproh_pmpro_checkout_confirm_email");
} else {
//email is in use
wp_redirect(home_url("/login/?redirect_to=" . pmpro_url("checkout", "?level=" . $_REQUEST['level'])));
exit;
}
}
return $level;
}
示例8: pmprosm_pmpro_email_body
function pmprosm_pmpro_email_body($body, $pmpro_email)
{
global $wpdb, $pmprosm_sponsored_account_levels;
//only checkout emails, not admins
if (strpos($pmpro_email->template, "checkout") !== false && strpos($pmpro_email->template, "admin") === false && strpos($pmpro_email->template, "debug") === false) {
//get the user_id from the email
$user_id = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE user_email = '" . $pmpro_email->data['user_email'] . "' LIMIT 1");
$level_id = $pmpro_email->data['membership_id'];
$code_id = pmprosm_getCodeByUserID($user_id);
if (!empty($user_id) && !empty($code_id) && pmprosm_isMainLevel($level_id)) {
//get code
$code = $wpdb->get_row("SELECT * FROM {$wpdb->pmpro_discount_codes} WHERE id = '" . esc_sql($code_id) . "' LIMIT 1");
//get sponsored levels
$pmprosm_values = pmprosm_getValuesByMainLevel($level_id);
if (!is_array($pmprosm_values['sponsored_level_id'])) {
$sponsored_level_ids = array($pmprosm_values['sponsored_level_id']);
} else {
$sponsored_level_ids = $pmprosm_values['sponsored_level_id'];
}
//no sponsored levels to use codes for
if (empty($sponsored_level_ids) || empty($sponsored_level_ids[0])) {
return $body;
}
//no uses for this code
if (empty($code->uses)) {
return $body;
}
//check if we should update confirmation email
if (isset($pmprosm_values['add_code_to_confirmation_email']) && $pmprosm_values['add_code_to_confirmation_email'] === false) {
return $body;
}
//figure out urls for code
$code_urls = array();
$pmpro_levels = pmpro_getAllLevels(true, true);
foreach ($sponsored_level_ids as $sponsored_level_id) {
$level_name = $pmpro_levels[$sponsored_level_id]->name;
$code_urls[] = array("name" => $level_name, "url" => pmpro_url("checkout", "?level=" . $sponsored_level_id . "&discount_code=" . $code->code));
}
//build message
$message = "<p>" . sprintf(__("Give this code to your sponsored members to use at checkout: %s", "pmpro_sponsored_members"), $code->code) . "<br />";
if (count($code_urls) > 1) {
$message .= __("Or provide one of these direct links to register:", "pmpro_sponsored_members") . "</p>";
} else {
$message .= __("Or provide this direct link to register:", "pmpro_sponsored_members") . "</p>";
}
$message .= "<ul>";
foreach ($code_urls as $code_url) {
$message .= "<li>" . $code_url['name'] . ": <strong>" . $code_url['url'] . "</strong></li>";
}
$message .= "</ul>";
$body = $message . "<hr />" . $body;
}
}
return $body;
}
示例9: pmpro_shortcode_account
function pmpro_shortcode_account($atts, $content = null, $code = "")
{
global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_account] [pmpro_account sections="membership,profile"/]
extract(shortcode_atts(array('section' => '', 'sections' => 'membership,profile,invoices,links'), $atts));
//did they use 'section' instead of 'sections'?
if (!empty($section)) {
$sections = $section;
}
//turn into an array
$sections = explode(',', $sections);
ob_start();
//if a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.)
if (pmpro_hasMembershipLevel()) {
$ssorder = new MemberOrder();
$ssorder->getLastMemberOrder();
$invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' ORDER BY timestamp DESC LIMIT 6");
?>
<div id="pmpro_account">
<?php
if (in_array('membership', $sections) || in_array('memberships', $sections)) {
?>
<div id="pmpro_account-membership" class="pmpro_box">
<h3><?php
_e("My Memberships", "pmpro");
?>
</h3>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th><?php
_e("Level", "pmpro");
?>
</th>
<th><?php
_e("Billing", "pmpro");
?>
</th>
<th><?php
_e("Expiration", "pmpro");
?>
</th>
</tr>
</thead>
<tbody>
<?php
//TODO: v2.0 will loop through levels here
$level = $current_user->membership_level;
?>
<tr>
<td class="pmpro_account-membership-levelname">
<?php
echo $current_user->membership_level->name;
?>
<div class="pmpro_actionlinks">
<?php
do_action("pmpro_member_action_links_before");
?>
<?php
if (pmpro_isLevelExpiringSoon($current_user->membership_level)) {
?>
<a href="<?php
echo pmpro_url("checkout", "?level=" . $current_user->membership_level->id, "https");
?>
"><?php
_e("Renew", "pmpro");
?>
</a>
<?php
}
?>
<?php
if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) {
?>
<a href="<?php
echo pmpro_url("billing", "", "https");
?>
"><?php
_e("Update Billing Info", "pmpro");
?>
</a>
<?php
}
?>
<?php
//To do: Only show CHANGE link if this level is in a group that has upgrade/downgrade rules
if (count($pmpro_levels) > 1 && !defined("PMPRO_DEFAULT_LEVEL")) {
?>
<a href="<?php
echo pmpro_url("levels");
?>
//.........这里部分代码省略.........
示例10: pmpro_twocheckoutExit
pmpro_twocheckoutExit(pmpro_url("confirmation", "?level=" . $morder->membership_level->id));
}
// First Payment (checkout) (Will probably want to update order, but not send another email/etc)
if ($message_type == 'ORDER_CREATED') {
//initial payment, get the order
$morder = new MemberOrder($order_id);
$morder->getMembershipLevel();
$morder->getUser();
inslog("ORDER_CREATED: ORDER: " . var_export($morder, true) . "\n---\n");
//update membership
if (pmpro_insChangeMembershipLevel($txn_id, $morder)) {
inslog("Checkout processed (" . $morder->code . ") success!");
} else {
inslog("ERROR: Couldn't change level for order (" . $morder->code . ").");
}
pmpro_twocheckoutExit(pmpro_url("confirmation", "?level=" . $morder->membership_level->id));
}
// Recurring Payment Success (recurring installment success and recurring is true)
if ($message_type == 'RECURRING_INSTALLMENT_SUCCESS') {
//is this a first payment?
$last_subscr_order = new MemberOrder();
if ($last_subscr_order->getLastMemberOrderBySubscriptionTransactionID($txn_id) == false) {
//first payment, get order
$morder = new MemberOrder($order_id);
$morder->getMembershipLevel();
$morder->getUser();
//update membership
if (pmpro_insChangeMembershipLevel($txn_id, $morder)) {
inslog("Checkout processed (" . $morder->code . ") success!");
} else {
inslog("ERROR: Couldn't change level for order (" . $morder->code . ").");
示例11: MemberOrder
//setup some values for the emails
if (!empty($morder)) {
$invoice = new MemberOrder($morder->id);
} else {
$invoice = NULL;
}
$current_user->membership_level = $pmpro_level;
//make sure they have the right level info
//send email to member
$pmproemail = new PMProEmail();
$pmproemail->sendCheckoutEmail($current_user, $invoice);
//send email to admin
$pmproemail = new PMProEmail();
$pmproemail->sendCheckoutAdminEmail($current_user, $invoice);
//redirect to confirmation
$rurl = pmpro_url("confirmation", "?level=" . $pmpro_level->id);
$rurl = apply_filters("pmpro_confirmation_url", $rurl, $user_id, $pmpro_level);
wp_redirect($rurl);
exit;
} else {
//uh oh. we charged them then the membership creation failed
if (isset($morder) && $morder->cancel()) {
$pmpro_msg = __("IMPORTANT: Something went wrong during membership creation. Your credit card authorized, but we cancelled the order immediately. You should not try to submit this form again. Please contact the site owner to fix this issue.", "pmpro");
$morder = NULL;
} else {
$pmpro_msg = __("IMPORTANT: Something went wrong during membership creation. Your credit card was charged, but we couldn't assign your membership. You should not submit this form again. Please contact the site owner to fix this issue.", "pmpro");
}
}
}
}
//default values
示例12: sendMembershipExpiredEmail
function sendMembershipExpiredEmail($user = NULL)
{
global $current_user, $wpdb;
if(!$user)
$user = $current_user;
if(!$user)
return false;
$this->email = $user->user_email;
$this->subject = "Your membership at " . get_option("blogname") . " has ended";
$this->template = "membership_expired";
$this->data = array("subject" => $this->subject, "name" => $user->display_name, "user_login" => $user->user_login, "sitename" => get_option("blogname"), "siteemail" => get_bloginfo("admin_email"), "login_link" => wp_login_url(), "display_name" => $user->display_name, "user_email" => $user->user_email, "levels_link" => pmpro_url("levels"));
return $this->sendEmail();
}
示例13: apply_filters
}
else
{
$pmpro_msg = false;
}
//if no user, redirect to levels page
if(empty($current_user->ID))
{
$redirect = apply_filters("pmpro_account_preheader_no_user_redirect", pmpro_url("levels"));
if($redirect)
{
wp_redirect($redirect);
exit;
}
}
//if no membership level, redirect to levels page
if(empty($current_user->membership_level->ID))
{
$redirect = apply_filters("pmpro_account_preheader_redirect", pmpro_url("levels"));
if($redirect)
{
wp_redirect($redirect);
exit;
}
}
global $pmpro_levels;
$pmpro_levels = pmpro_getAllLevels();
?>
示例14: pmprorh_signup_shortcode
function pmprorh_signup_shortcode($atts, $content = null, $code = "")
{
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_signup level="3" short="1" intro="0" button="Signup Now"]
//make sure PMPro is activated
if (!function_exists('pmpro_getLevel')) {
return "Paid Memberships Pro must be installed to use the pmpro_signup shortcode.";
}
//default title
if (!empty($level)) {
$default_title = 'Register For ' . pmpro_getLevel($level)->name;
} else {
$default_title = 'Register For ' . get_option('blogname');
}
//set defaults
extract(shortcode_atts(array('button' => "Sign Up Now", 'intro' => "0", 'level' => NULL, 'login' => true, 'short' => NULL, 'title' => $default_title), $atts));
//turn 0's into falses
if ($login === "0" || $login === "false" || $login === "no") {
$login = false;
} else {
$login = true;
}
if ($short === "0" || $short === "false" || $short === "no") {
$short = false;
} else {
$short = true;
}
if ($intro === "0" || $intro === "false" || $intro === "no") {
$intro = false;
}
global $current_user, $membership_levels;
ob_start();
?>
<?php
if (!empty($current_user->ID) && pmpro_hasMembershipLevel($level, $current_user->ID)) {
?>
<p>You are logged in as <?php
echo $current_user->user_login;
?>
.</p>
<?php
} else {
?>
<form class="pmpro_form pmpro_signup_form" action="<?php
echo pmpro_url("checkout");
?>
" method="post">
<h2><?php
echo $title;
?>
</h2>
<?php
if (!empty($intro)) {
echo wpautop($intro);
}
?>
<input type="hidden" id="level" name="level" value="<?php
echo $level;
?>
" />
<?php
if (!empty($current_user->ID)) {
?>
<p id="pmpro_account_loggedin">
<?php
printf(__('You are logged in as <strong>%s</strong>. If you would like to use a different account for this membership, <a href="%s">log out now</a>.', 'pmpro'), $current_user->user_login, wp_logout_url($_SERVER['REQUEST_URI']));
?>
</p>
<?php
} else {
?>
<div>
<label for="username">Username</label>
<input id="username" name="username" type="text" class="input" size="30" value="" />
</div>
<?php
do_action("pmpro_checkout_after_username");
?>
<div>
<label for="password">Password</label>
<input id="password" name="password" type="password" class="input" size="30" value="" />
</div>
<?php
if ($short) {
?>
<input type="hidden" name="password2_copy" value="1" />
<?php
} else {
?>
<div>
<label for="password2">Confirm Password</label>
<input id="password2" name="password2" type="password" class="input" size="30" value="" />
</div>
<?php
}
?>
<?php
do_action("pmpro_checkout_after_password");
//.........这里部分代码省略.........
示例15: sendBillableInvoiceEmail
/**
* Send billable invoice email.
*
* @since 1.8.6
*
* @param WP_User $user
* @param MemberOrder $order
*
* @return bool Whether the email was sent successfully.
*/
function sendBillableInvoiceEmail($user = NULL, $order = NULL)
{
global $current_user;
if (!$user) {
$user = $current_user;
}
if (!$user || !$order) {
return false;
}
$level = pmpro_getLevel($order->membership_id);
$this->email = $user->user_email;
$this->subject = __('Invoice for Order #: ', 'pmpro') . $order->code;
$this->template = "billable_invoice";
// Load invoice template
if (file_exists(get_stylesheet_directory() . '/paid-memberships-pro/pages/orders-email.php')) {
$template = get_stylesheet_directory() . '/paid-memberships-pro/pages/orders-email.php';
} elseif (file_exists(get_template_directory() . '/paid-memberships-pro/pages/orders-email.php')) {
$template = get_template_directory() . '/paid-memberships-pro/pages/orders-email.php';
} else {
$template = PMPRO_DIR . '/adminpages/templates/orders-email.php';
}
ob_start();
require_once $template;
$invoice = ob_get_contents();
ob_end_clean();
$this->data = array('order_code' => $order->code, 'login_link' => wp_login_url(pmpro_url("account")), 'invoice_link' => wp_login_url(pmpro_url("invoice", "?invoice=" . $order->code)), 'invoice' => $invoice);
return $this->sendEmail();
}