本文整理汇总了PHP中pmpro_getOption函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_getOption函数的具体用法?PHP pmpro_getOption怎么用?PHP pmpro_getOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_getOption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMProGateway_stripe
function PMProGateway_stripe($gateway = NULL)
{
$this->gateway = $gateway;
$this->gateway_environment = pmpro_getOption("gateway_environment");
Stripe::setApiKey(pmpro_getOption("stripe_secretkey"));
return $this->gateway;
}
示例2: pmpro_checkLevelForBraintreeCompatibility
function pmpro_checkLevelForBraintreeCompatibility($level = NULL)
{
$gateway = pmpro_getOption("gateway");
if ($gateway == "braintree") {
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) {
/*
Braintree currently does not support:
* Trial Amounts > 0.
* Daily or Weekly billing periods.
*/
if ($level->trial_amount > 0 || $level->cycle_number > 0 && ($level->cycle_period == "Day" || $level->cycle_period == "Week")) {
return false;
}
}
}
} else {
//need to look it up?
if (is_numeric($level)) {
$level = $wpdb->get_row("SELECT * FROM {$wpdb->pmpro_membership_levels} WHERE id = '" . $wpdb->escape($level) . "' LIMIT 1");
}
//check this level
if ($level->trial_amount > 0 || $level->cycle_number > 0 && ($level->cycle_period == "Day" || $level->cycle_period == "Week")) {
return false;
}
}
}
return true;
}
示例3: 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;
}
示例4: pmpro_wp_mail_from
function pmpro_wp_mail_from($from_email)
{
$pmpro_from_email = pmpro_getOption("from_email");
if ($pmpro_from_email && is_email($pmpro_from_email)) {
return $pmpro_from_email;
}
return $from_email;
}
示例5: pmpro_wp_signup_location
function pmpro_wp_signup_location($location)
{
if (is_multisite() && pmpro_getOption("redirecttosubscription")) {
return pmpro_url("levels");
} else {
return $location;
}
}
示例6: pmpro_footer_link
function pmpro_footer_link()
{
if (!pmpro_getOption("hide_footer_link")) {
?>
<!-- <?php
echo pmpro_link();
?>
-->
<?php
}
}
示例7: my_template_redirect
function my_template_redirect()
{
global $current_user;
$okay_pages = array('oops', 'login', 'lostpassword', 'resetpass', 'logout', pmpro_getOption('billing_page_id'), pmpro_getOption('account_page_id'), pmpro_getOption('levels_page_id'), pmpro_getOption('checkout_page_id'), pmpro_getOption('confirmation_page_id'));
//if the user doesn't have a membership, send them home
if (!$current_user->ID && !is_page($okay_pages) && !strpos($_SERVER['REQUEST_URI'], "login")) {
wp_redirect(home_url("wp-login.php?redirect_to=" . urlencode($_SERVER['REQUEST_URI'])));
} elseif (is_page() && !is_page($okay_pages) && !$current_user->membership_level->ID) {
//change this to wp_redirect(pmpro_url("levels")); to redirect to the levels page.
wp_redirect(wp_login_url());
}
}
示例8: PMProGateway_braintree
function PMProGateway_braintree($gateway = NULL)
{
$this->gateway = $gateway;
$this->gateway_environment = pmpro_getOption("gateway_environment");
//convert to braintree nomenclature
$environment = $this->gateway_environment;
if ($environment == "live") {
$environment = "production";
}
Braintree_Configuration::environment($environment);
Braintree_Configuration::merchantId(pmpro_getOption("braintree_merchantid"));
Braintree_Configuration::publicKey(pmpro_getOption("braintree_publickey"));
Braintree_Configuration::privateKey(pmpro_getOption("braintree_privatekey"));
return $this->gateway;
}
示例9: pmpro_upgrade_1_4_2
function pmpro_upgrade_1_4_2()
{
/*
Setting the new use_ssl setting.
PayPal Website Payments Pro, Authorize.net, and Stripe will default to use ssl.
PayPal Express and the test gateway (no gateway) will default to not use ssl.
*/
$gateway = pmpro_getOption("gateway");
if ($gateway == "paypal" || $gateway == "authorizenet" || $gateway == "stripe") {
pmpro_setOption("use_ssl", 1);
} else {
pmpro_setOption("use_ssl", 0);
}
pmpro_setOption("db_version", "1.42");
return 1.42;
}
示例10: pmproeewe_extra_emails
function pmproeewe_extra_emails()
{
global $wpdb;
//make sure we only run once a day
$today = date("Y-m-d 00:00:00");
/*
Here is where you set how many emails you want to send, how early, and which template files to e-mail.
If you set the template file to an empty string '' then it will send the default PMPro expiring e-mail.
Place your email templates in a subfolder of your active theme. Create a paid-memberships-pro folder in your theme folder,
and then create an email folder within that. Your template files should have a suffix of .html, but you don't put it below. So if you
create a file in there called myexpirationemail.html, then you'd just put 'myexpirationemail' in the array below.
(PMPro will fill in the .html for you.)
*/
$emails = array(30 => 'mem_expiring_30days', 60 => 'mem_expiring_60days', 90 => 'mem_expiring_90days');
//<--- !!! UPDATE THIS ARRAY TO CHANGE WHEN EMAILS GO OUT AND THEIR TEMPLATE FILES !!! -->
ksort($emails, SORT_NUMERIC);
//array to store ids of folks we sent emails to so we don't email them twice
$sent_emails = array();
foreach (array_keys($emails) as $days) {
//look for memberships that are going to expire within one week (but we haven't emailed them within a week)
$sqlQuery = "SELECT mu.user_id, mu.membership_id, mu.startdate, mu.enddate FROM {$wpdb->pmpro_memberships_users} mu LEFT JOIN {$wpdb->usermeta} um ON um.user_id = mu.user_id AND um.meta_key = 'pmpro_expiration_notice_" . $days . "' WHERE mu.status = 'active' AND mu.enddate IS NOT NULL AND mu.enddate <> '' AND mu.enddate <> '0000-00-00 00:00:00' AND DATE_SUB(mu.enddate, INTERVAL " . $days . " Day) <= '" . $today . "' AND (um.meta_value IS NULL OR DATE_ADD(um.meta_value, INTERVAL " . $days . " Day) <= '" . $today . "') ORDER BY mu.enddate";
$expiring_soon = $wpdb->get_results($sqlQuery);
foreach ($expiring_soon as $e) {
if (!in_array($e->user_id, $sent_emails)) {
//send an email
$pmproemail = new PMProEmail();
$euser = get_userdata($e->user_id);
if ($euser) {
$euser->membership_level = pmpro_getMembershipLevelForUser($euser->ID);
$pmproemail->email = $euser->user_email;
$pmproemail->subject = sprintf(__("Your membership at %s will end soon", "pmpro"), get_option("blogname"));
if (strlen($emails[$days]) > 0) {
$pmproemail->template = $emails[$days];
} else {
$pmproemail->template = "membership_expiring";
}
$pmproemail->data = array("subject" => $pmproemail->subject, "name" => $euser->display_name, "user_login" => $euser->user_login, "sitename" => get_option("blogname"), "membership_id" => $euser->membership_level->id, "membership_level_name" => $euser->membership_level->name, "siteemail" => pmpro_getOption("from_email"), "login_link" => wp_login_url(), "enddate" => date(get_option('date_format'), $euser->membership_level->enddate), "display_name" => $euser->display_name, "user_email" => $euser->user_email);
$pmproemail->sendEmail();
printf(__("Membership expiring email sent to %s. ", "pmpro"), $euser->user_email);
$sent_emails[] = $e->user_id;
}
}
//update user meta so we don't email them again
update_user_meta($e->user_id, "pmpro_expiration_notice_" . $days, $today);
}
}
}
开发者ID:greathmaster,项目名称:pmpro-extra-expiration-warning-emails,代码行数:47,代码来源:pmpro-extra-expiration-warning-emails.php
示例11: pmpro_init_recaptcha
function pmpro_init_recaptcha()
{
//don't load in admin
if (is_admin()) {
return;
}
//use recaptcha?
global $recaptcha;
$recaptcha = pmpro_getOption("recaptcha");
if ($recaptcha) {
global $recaptcha_publickey, $recaptcha_privatekey;
require_once PMPRO_DIR . "/includes/lib/recaptchalib.php";
function pmpro_recaptcha_get_html($pubkey, $error = null, $use_ssl = false)
{
$locale = get_locale();
if (!empty($locale)) {
$parts = explode("_", $locale);
$lang = $parts[0];
} else {
$lang = "en";
}
//filter
$lang = apply_filters('pmpro_recaptcha_lang', $lang);
?>
<div class="g-recaptcha" data-sitekey="<?php
echo $pubkey;
?>
"></div>
<script type="text/javascript"
src="https://www.google.com/recaptcha/api.js?hl=<?php
echo $lang;
?>
">
</script>
<?php
}
//for templates using the old recaptcha_get_html
if (!function_exists('recaptcha_get_html')) {
function recaptcha_get_html($pubkey, $error = null, $use_ssl = false)
{
return pmpro_recaptcha_get_html($pubkey, $error, $use_ssl);
}
}
$recaptcha_publickey = pmpro_getOption("recaptcha_publickey");
$recaptcha_privatekey = pmpro_getOption("recaptcha_privatekey");
}
}
示例12: pmpro_wp_mail_from
function pmpro_wp_mail_from($from_email)
{
// default from email wordpress@sitename
$sitename = strtolower($_SERVER['SERVER_NAME']);
if (substr($sitename, 0, 4) == 'www.') {
$sitename = substr($sitename, 4);
}
$default_from_email = 'wordpress@' . $sitename;
//make sure it's the default email address
if ($from_email == $default_from_email) {
$pmpro_from_email = pmpro_getOption("from_email");
if ($pmpro_from_email && is_email($pmpro_from_email)) {
$from_email = $pmpro_from_email;
}
}
return $from_email;
}
示例13: pmpro_init_recaptcha
function pmpro_init_recaptcha()
{
//don't load in admin
if (is_admin()) {
return;
}
//use recaptcha?
global $recaptcha;
$recaptcha = pmpro_getOption("recaptcha");
if ($recaptcha) {
global $recaptcha_publickey, $recaptcha_privatekey;
if (!function_exists("recaptcha_get_html")) {
require_once PMPRO_DIR . "/includes/lib/recaptchalib.php";
}
$recaptcha_publickey = pmpro_getOption("recaptcha_publickey");
$recaptcha_privatekey = pmpro_getOption("recaptcha_privatekey");
}
}
示例14: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure payza is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_payza', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_payza', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_payza', 'pmpro_payment_option_fields'), 10, 2);
//add some fields to edit user page (Updates)
add_action('pmpro_after_membership_level_profile_fields', array('PMProGateway_payza', 'user_profile_fields'));
add_action('profile_update', array('PMProGateway_payza', 'user_profile_fields_save'));
//updates cron
add_action('pmpro_activation', array('PMProGateway_payza', 'pmpro_activation'));
add_action('pmpro_deactivation', array('PMProGateway_payza', 'pmpro_deactivation'));
add_action('pmpro_cron_example_subscription_updates', array('PMProGateway_payza', 'pmpro_cron_example_subscription_updates'));
//code to add at checkout if payza is the current gateway
$gateway = pmpro_getOption("gateway");
if ($gateway == "payza") {
add_action('pmpro_checkout_preheader', array('PMProGateway_payza', 'pmpro_checkout_preheader'));
add_filter('pmpro_checkout_order', array('PMProGateway_payza', 'pmpro_checkout_order'));
add_filter('pmpro_include_billing_address_fields', array('PMProGateway_payza', 'pmpro_include_billing_address_fields'));
add_filter('pmpro_include_cardtype_field', array('PMProGateway_payza', 'pmpro_include_billing_address_fields'));
add_filter('pmpro_include_payment_information_fields', array('PMProGateway_payza', 'pmpro_include_payment_information_fields'));
}
}
示例15: printf
<thead>
<tr>
<th colspan="2"><span class="pmpro_thead-msg"><?php
printf(__('We accept %s', 'pmpro'), $pmpro_accepted_credit_cards_string);
?>
</span><?php
_e('Credit Card Information', 'pmpro');
?>
</th>
</tr>
</thead>
<tbody>
<tr valign="top">
<td>
<?php
$sslseal = pmpro_getOption("sslseal");
if ($sslseal) {
?>
<div class="pmpro_sslseal"><?php
echo stripslashes($sslseal);
?>
</div>
<?php
}
?>
<?php
if (empty($pmpro_stripe_lite) || $gateway != "stripe") {
?>
<div>
<label for="CardType"><?php
_e('Card Type', 'pmpro');