Source Code Documentation


s2member\includes\classes\paypal-notify-in-rec-profile-creation-w-level.inc.php


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

s2member\includes\classes\paypal-notify-in-rec-profile-creation-w-level.inc.php

Source Code Documentation