本文整理汇总了PHP中pmpro_getGateway函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_getGateway函数的具体用法?PHP pmpro_getGateway怎么用?PHP pmpro_getGateway使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_getGateway函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pmpro_upgrade_1_8_9_3_ajax
function pmpro_upgrade_1_8_9_3_ajax()
{
global $wpdb;
$debug = false;
$run = true;
//some vars
$all_levels = pmpro_getAllLevels(true, true);
//keeping track of which user we're working on
$last_user_id = get_option('pmpro_upgrade_1_8_9_3_last_user_id', 0);
//get all active users during the period where things may have been broken
$user_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' AND user_id > {$last_user_id} ORDER BY user_id LIMIT 10");
//track progress
$first_load = get_transient('pmpro_updates_first_load');
if ($first_load) {
$total_users = $wpdb->get_var("SELECT COUNT(user_id) FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' ORDER BY user_id");
update_option('pmpro_upgrade_1_8_9_3_total', $total_users, 'no');
$progress = 0;
} else {
$total_users = get_option('pmpro_upgrade_1_8_9_3_total', 0);
$progress = get_option('pmpro_upgrade_1_8_9_3_progress', 0);
}
update_option('pmpro_upgrade_1_8_9_3_progress', $progress + count($user_ids), 'no');
global $pmpro_updates_progress;
if ($total_users > 0) {
$pmpro_updates_progress = "[" . $progress . "/" . $total_users . "]";
} else {
$pmpro_updates_progress = "";
}
if (empty($user_ids)) {
//done with this update
pmpro_removeUpdate('pmpro_upgrade_1_8_9_3_ajax');
delete_option('pmpro_upgrade_1_8_9_3_last_user_id');
delete_option('pmpro_upgrade_1_8_9_3_total');
delete_option('pmpro_upgrade_1_8_9_3_progress');
} else {
foreach ($user_ids as $user_id) {
$last_user_id = $user_id;
//keeping track of the last user we processed
$user = get_userdata($user_id);
//user not found for some reason
if (empty($user)) {
if ($debug) {
echo "User #" . $user_id . " not found.\n";
}
continue;
}
//get level
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
//has a start and end date already
if (!empty($user->membership_level->enddate) && !empty($user->membership_level->startdate)) {
if ($debug) {
echo "User #" . $user_id . ", " . $user->user_email . " already has a start and end date.\n";
}
continue;
}
//get order
$last_order = new MemberOrder();
$last_order->getLastMemberOrder();
/*
Figure out if this user should have been given an end date.
The level my have an end date.
They might have used a discount code.
They might be using the set-expiration-dates code.
They might have custom code setting the end date.
Let's setup some vars as if we are at checkout.
Then pass recreate the level with the pmpro_checkout_level filter.
And use the end date there if there is one.
*/
global $pmpro_level, $discount_code, $discount_code_id;
//level
$level_id = $user->membership_level->id;
$_REQUEST['level'] = $level_id;
//gateway
if (!empty($last_order) && !empty($last_order->gateway)) {
$_REQUEST['gateway'] = $last_order->gateway;
} else {
$_REQUEST['gateway'] = pmpro_getGateway();
}
//discount code
$discount_code_id = $user->membership_level->code_id;
$discount_code = $wpdb->get_var("SELECT code FROM {$wpdb->pmpro_discount_codes} WHERE id = '" . $discount_code_id . "' LIMIT 1");
//get level
if (!empty($discount_code_id)) {
$sqlQuery = "SELECT l.id, cl.*, l.name, l.description, l.allow_signups FROM {$wpdb->pmpro_discount_codes_levels} cl LEFT JOIN {$wpdb->pmpro_membership_levels} l ON cl.level_id = l.id LEFT JOIN {$wpdb->pmpro_discount_codes} dc ON dc.id = cl.code_id WHERE dc.code = '" . $discount_code . "' AND cl.level_id = '" . (int) $level_id . "' LIMIT 1";
$pmpro_level = $wpdb->get_row($sqlQuery);
//if the discount code doesn't adjust the level, let's just get the straight level
if (empty($pmpro_level)) {
$pmpro_level = $all_levels[$level_id];
}
//filter adjustments to the level
$pmpro_level->code_id = $discount_code_id;
$pmpro_level = apply_filters("pmpro_discount_code_level", $pmpro_level, $discount_code_id);
}
//no level yet, use default
if (empty($pmpro_level)) {
$pmpro_level = $all_levels[$level_id];
}
//no level for some reason
if (empty($pmpro_level) && empty($pmpro_level->id)) {
//.........这里部分代码省略.........
示例2: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure PayPal Express is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_paypalstandard', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_paypalstandard', 'pmpro_payment_options'));
/*
This code is the same for PayPal Website Payments Pro, PayPal Express, and PayPal Standard
So we only load it if we haven't already.
*/
global $pmpro_payment_option_fields_for_paypal;
if (empty($pmpro_payment_option_fields_for_paypal)) {
add_filter('pmpro_payment_option_fields', array('PMProGateway_paypalstandard', 'pmpro_payment_option_fields'), 10, 2);
$pmpro_payment_option_fields_for_paypal = true;
}
//code to add at checkout
$gateway = pmpro_getGateway();
if ($gateway == "paypalstandard") {
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
add_filter('pmpro_required_billing_fields', array('PMProGateway_paypalstandard', 'pmpro_required_billing_fields'));
add_filter('pmpro_checkout_default_submit_button', array('PMProGateway_paypalstandard', 'pmpro_checkout_default_submit_button'));
add_filter('pmpro_checkout_before_change_membership_level', array('PMProGateway_paypalstandard', 'pmpro_checkout_before_change_membership_level'), 10, 2);
}
}
示例3: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
global $wpdb;
$result = $wpdb->query("SELECT fondy_token from `{$wpdb->pmpro_membership_orders}` LIMIT 1' ");
if (!$result) {
$wpdb->query("ALTER TABLE {$wpdb->pmpro_membership_orders} ADD fondy_token TEXT");
}
//make sure fondy is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_fondy', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_fondy', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_fondy', 'pmpro_payment_option_fields'), 10, 2);
//add some fields to edit user page (Updates)
add_action('pmpro_after_membership_level_profile_fields', array('PMProGateway_fondy', 'user_profile_fields'));
add_action('profile_update', array('PMProGateway_fondy', 'user_profile_fields_save'));
//updates cron
add_action('pmpro_activation', array('PMProGateway_fondy', 'pmpro_activation'));
add_action('pmpro_deactivation', array('PMProGateway_fondy', 'pmpro_deactivation'));
add_action('pmpro_cron_fondy_subscription_updates', array('PMProGateway_fondy', 'pmpro_cron_fondy_subscription_updates'));
//code to add at checkout if fondy is the current gateway
$gateway = pmpro_getOption("gateway");
$gateway = pmpro_getGateway();
if ($gateway == "fondy") {
//add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
add_filter('pmpro_required_billing_fields', array('PMProGateway_fondy', 'pmpro_required_billing_fields'));
add_filter('pmpro_checkout_default_submit_button', array('PMProGateway_fondy', 'pmpro_checkout_default_submit_button'));
add_filter('pmpro_checkout_before_change_membership_level', array('PMProGateway_fondy', 'pmpro_checkout_before_change_membership_level'), 10, 2);
}
}
示例4: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure PayPal Express is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_payfast', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_payfast', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_payfast', 'pmpro_payment_option_fields'), 10, 2);
//code to add at checkout
$gateway = pmpro_getGateway();
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
add_filter('pmpro_required_billing_fields', '__return_false');
add_filter('pmpro_checkout_default_submit_button', array('PMProGateway_payfast', 'pmpro_checkout_default_submit_button'));
add_filter('pmpro_checkout_before_change_membership_level', array('PMProGateway_payfast', 'pmpro_checkout_before_change_membership_level'), 10, 2);
}
示例5: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure Pay by Check is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_check', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_check', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_check', 'pmpro_payment_option_fields'), 10, 2);
//code to add at checkout
$gateway = pmpro_getGateway();
if ($gateway == "check") {
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
add_filter('pmpro_required_billing_fields', array('PMProGateway_check', 'pmpro_required_billing_fields'));
}
}
示例6: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure Braintree Payments is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_braintree', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_braintree', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_braintree', 'pmpro_payment_option_fields'), 10, 2);
//code to add at checkout if Braintree is the current gateway
$gateway = pmpro_getGateway();
if ($gateway == "braintree") {
add_action('pmpro_checkout_before_submit_button', array('PMProGateway_braintree', 'pmpro_checkout_before_submit_button'));
add_filter('pmpro_checkout_order', array('PMProGateway_braintree', 'pmpro_checkout_order'));
add_filter('pmpro_required_billing_fields', array('PMProGateway_braintree', 'pmpro_required_billing_fields'));
add_filter('pmpro_include_payment_information_fields', array('PMProGateway_braintree', 'pmpro_include_payment_information_fields'));
}
}
示例7: init
/**
* 1.2 Run on WP init
*/
public static function init()
{
//make sure Pay by Bitcoin/Altcoin is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_gourl', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_gourl', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_gourl', 'pmpro_payment_option_fields'), 10, 2);
//code to add at checkout
$gateway = pmpro_getGateway();
if ($gateway == "gourl") {
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
add_filter('pmpro_required_billing_fields', array('PMProGateway_gourl', 'pmpro_required_billing_fields'));
add_filter('pmpro_checkout_before_change_membership_level', array('PMProGateway_gourl', 'pmpro_checkout_before_change_membership_level'), 10, 2);
}
}
开发者ID:MediaPreneur,项目名称:Bitcoin-Gateway-Paid-Memberships-Pro,代码行数:19,代码来源:gourl_paidmembershipspro.php
示例8: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure PayPal Website Payments Pro is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_paypal', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_paypal', 'pmpro_payment_options'));
/*
This code is the same for PayPal Website Payments Pro, PayPal Express, and PayPal Standard
So we only load it if we haven't already.
*/
global $pmpro_payment_option_fields_for_paypal;
if (empty($pmpro_payment_option_fields_for_paypal)) {
add_filter('pmpro_payment_option_fields', array('PMProGateway_paypal', 'pmpro_payment_option_fields'), 10, 2);
$pmpro_payment_option_fields_for_paypal = true;
}
//code to add at checkout
$gateway = pmpro_getGateway();
if ($gateway == "paypal") {
add_filter('pmpro_checkout_default_submit_button', array('PMProGateway_paypal', 'pmpro_checkout_default_submit_button'));
add_action('pmpro_checkout_after_form', array('PMProGateway_paypal', 'pmpro_checkout_after_form'));
}
}
示例9: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure PayPal Express is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_paypalexpress', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_paypalexpress', 'pmpro_payment_options'));
/*
Filter pmpro_next_payment to get actual value
via the PayPal API. This is disabled by default
for performance reasons, but you can enable it
by copying this line into a custom plugin or
your active theme's functions.php and uncommenting
it there.
*/
//add_filter('pmpro_next_payment', array('PMProGateway_paypalexpress', 'pmpro_next_payment'), 10, 3);
/*
This code is the same for PayPal Website Payments Pro, PayPal Express, and PayPal Standard
So we only load it if we haven't already.
*/
global $pmpro_payment_option_fields_for_paypal;
if (empty($pmpro_payment_option_fields_for_paypal)) {
add_filter('pmpro_payment_option_fields', array('PMProGateway_paypalexpress', 'pmpro_payment_option_fields'), 10, 2);
$pmpro_payment_option_fields_for_paypal = true;
}
//code to add at checkout
$gateway = pmpro_getGateway();
if ($gateway == "paypalexpress") {
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
add_filter('pmpro_required_billing_fields', array('PMProGateway_paypalexpress', 'pmpro_required_billing_fields'));
add_filter('pmpro_checkout_new_user_array', array('PMProGateway_paypalexpress', 'pmpro_checkout_new_user_array'));
add_filter('pmpro_checkout_confirmed', array('PMProGateway_paypalexpress', 'pmpro_checkout_confirmed'));
add_action('pmpro_checkout_before_processing', array('PMProGateway_paypalexpress', 'pmpro_checkout_before_processing'));
add_filter('pmpro_checkout_default_submit_button', array('PMProGateway_paypalexpress', 'pmpro_checkout_default_submit_button'));
add_action('pmpro_checkout_after_form', array('PMProGateway_paypalexpress', 'pmpro_checkout_after_form'));
add_action('http_api_curl', array('PMProGateway_paypalexpress', 'http_api_curl'), 10, 3);
}
}
示例10: do_action
?>
</p>
<?php
}
?>
<?php
do_action('pmpro_checkout_after_user_fields');
?>
<?php
do_action('pmpro_checkout_boxes');
?>
<?php
if (pmpro_getGateway() == "paypal" && empty($pmpro_review)) {
?>
<table id="pmpro_payment_method" class="pmpro_checkout top1em" width="100%" cellpadding="0" cellspacing="0" border="0" <?php
if (!$pmpro_requirebilling) {
?>
style="display: none;"<?php
}
?>
>
<thead>
<tr>
<th><?php
_e('Choose your Payment Method', 'pmpro');
?>
</th>
</tr>
示例11: init
/**
* Run on WP init
*
* @since 1.8
*/
static function init()
{
//make sure Stripe is a gateway option
add_filter('pmpro_gateways', array('PMProGateway_stripe', 'pmpro_gateways'));
//add fields to payment settings
add_filter('pmpro_payment_options', array('PMProGateway_stripe', 'pmpro_payment_options'));
add_filter('pmpro_payment_option_fields', array('PMProGateway_stripe', 'pmpro_payment_option_fields'), 10, 2);
//add some fields to edit user page (Updates)
add_action('pmpro_after_membership_level_profile_fields', array('PMProGateway_stripe', 'user_profile_fields'));
add_action('profile_update', array('PMProGateway_stripe', 'user_profile_fields_save'));
//old global RE showing billing address or not
global $pmpro_stripe_lite;
$pmpro_stripe_lite = apply_filters("pmpro_stripe_lite", !pmpro_getOption("stripe_billingaddress"));
//default is oposite of the stripe_billingaddress setting
//updates cron
add_action('pmpro_cron_stripe_subscription_updates', array('PMProGateway_stripe', 'pmpro_cron_stripe_subscription_updates'));
/*
Filter pmpro_next_payment to get actual value
via the Stripe API. This is disabled by default
for performance reasons, but you can enable it
by copying this line into a custom plugin or
your active theme's functions.php and uncommenting
it there.
*/
//add_filter('pmpro_next_payment', array('PMProGateway_stripe', 'pmpro_next_payment'), 10, 3);
//code to add at checkout if Stripe is the current gateway
$default_gateway = pmpro_getOption('gateway');
$current_gateway = pmpro_getGateway();
if (($default_gateway == "stripe" || $current_gateway == "stripe") && empty($_REQUEST['review'])) {
add_action('pmpro_checkout_preheader', array('PMProGateway_stripe', 'pmpro_checkout_preheader'));
add_filter('pmpro_checkout_order', array('PMProGateway_stripe', 'pmpro_checkout_order'));
add_filter('pmpro_include_billing_address_fields', array('PMProGateway_stripe', 'pmpro_include_billing_address_fields'));
add_filter('pmpro_include_cardtype_field', array('PMProGateway_stripe', 'pmpro_include_billing_address_fields'));
add_filter('pmpro_include_payment_information_fields', array('PMProGateway_stripe', 'pmpro_include_payment_information_fields'));
}
}
示例12:
}
//hide/show billing
if (pmpro_isLevelFree($code_level) || pmpro_getGateway() == "paypalexpress" || pmpro_getGateway() == "paypalstandard" || pmpro_getGateway() == 'check') {
?>
jQuery('#pmpro_billing_address_fields').hide();
jQuery('#pmpro_payment_information_fields').hide();
<?php
} else {
?>
jQuery('#pmpro_billing_address_fields').show();
jQuery('#pmpro_payment_information_fields').show();
<?php
}
//hide/show paypal button
if (pmpro_getGateway() == "paypalexpress" || pmpro_getGateway() == "paypalstandard") {
if (pmpro_isLevelFree($code_level)) {
?>
jQuery('#pmpro_paypalexpress_checkout').hide();
jQuery('#pmpro_submit_span').show();
<?php
} else {
?>
jQuery('#pmpro_submit_span').hide();
jQuery('#pmpro_paypalexpress_checkout').show();
<?php
}
}
//filter to insert your own code
示例13: pmpro_getMembershipLevelForUser
<?php
global $current_user, $pmpro_invoice;
if ($current_user->ID) {
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
}
/*
Use the filter to add your gateway here if you want to show them a message on the confirmation page while their checkout is pending.
For example, when PayPal Standard is used, we need to wait for PayPal to send a message through IPN that the payment was accepted.
In the meantime, the order is in pending status and the confirmation page shows a message RE waiting.
*/
$gateways_with_pending_status = apply_filters('pmpro_gateways_with_pending_status', array('paypalstandard', 'twocheckout', 'gourl'));
//must be logged in
if (empty($current_user->ID) || empty($current_user->membership_level->ID) && !in_array(pmpro_getGateway(), $gateways_with_pending_status)) {
wp_redirect(home_url());
}
//if membership is a paying one, get invoice from DB
if (!empty($current_user->membership_level) && !pmpro_isLevelFree($current_user->membership_level)) {
$pmpro_invoice = new MemberOrder();
$pmpro_invoice->getLastMemberOrder($current_user->ID, apply_filters("pmpro_confirmation_order_status", array("success", "pending")));
}
示例14: pmpropbc_init_include_billing_address_fields
function pmpropbc_init_include_billing_address_fields()
{
//make sure PMPro is active
if (!function_exists('pmpro_getGateway')) {
return;
}
if (pmpro_getGateway() !== 'check') {
remove_filter('pmpro_include_billing_address_fields', '__return_false');
} elseif (!empty($_REQUEST['level'])) {
$level_id = intval($_REQUEST['level']);
$options = pmpropbc_getOptions($level_id);
if ($options['setting'] == 2) {
//hide billing address and payment info fields
add_filter('pmpro_include_billing_address_fields', '__return_false', 20);
add_filter('pmpro_include_payment_information_fields', '__return_false', 20);
}
}
}