PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 260805
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v260805
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
s2member / src / includes / classes / paypal-notify-in-cart.inc.php

paypal-notify-in-cart.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 260805, at src/includes/classes/paypal-notify-in-cart.inc.php

79 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // @codingStandardsIgnoreFile
3 /**
4 * s2Member's PayPal IPN handler (inner processing routine).
5 *
6 * Copyright: © 2009-2011
7 * {@link http://websharks-inc.com/ WebSharks, Inc.}
8 * (coded in the USA)
9 *
10 * Released under the terms of the GNU General Public License.
11 * You should have received a copy of the GNU General Public License,
12 * along with this software. In the main directory, see: /licensing/
13 * If not, see: {@link http://www.gnu.org/licenses/}.
14 *
15 * @package s2Member\PayPal
16 * @since 110720
17 */
18 if(!defined('WPINC')) // MUST have WordPress.
19 exit ("Do not access this file directly.");
20
21 if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_cart"))
22 {
23 /**
24 * s2Member's PayPal IPN handler (inner processing routine).
25 *
26 * @package s2Member\PayPal
27 * @since 110720
28 */
29 class c_ws_plugin__s2member_paypal_notify_in_cart
30 {
31 /**
32 * s2Member's PayPal IPN handler (inner processing routine).
33 *
34 * @package s2Member\PayPal
35 * @since 110720
36 *
37 * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
38 * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
39 */
40 public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
41 {
42 extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
43
44 if (!empty($paypal["txn_type"]) && preg_match ("/^cart$/i", $paypal["txn_type"]))
45 {
46 foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
47 do_action("ws_plugin__s2member_during_paypal_notify_before_cart", get_defined_vars ());
48 unset($__refs, $__v);
49
50 if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
51 {
52 $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `cart` ).";
53
54 $processing = $during = true; // Yes, we ARE processing this.
55
56 $paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
57 $paypal["s2member_log"][] = "s2Member Pro handles Cart events on-site, with an IPN proxy.";
58
59 foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
60 do_action("ws_plugin__s2member_during_paypal_notify_during_cart", get_defined_vars ());
61 unset($__refs, $__v);
62 }
63 else // Else, this is a duplicate IPN. Must stop here.
64 {
65 $paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
66 $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `cart` ).";
67 $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
68 }
69 foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
70 do_action("ws_plugin__s2member_during_paypal_notify_after_cart", get_defined_vars ());
71 unset($__refs, $__v);
72
73 return apply_filters("c_ws_plugin__s2member_paypal_notify_in_cart", $paypal, get_defined_vars ());
74 }
75 else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_cart", false, get_defined_vars ());
76 }
77 }
78 }
79