s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) - Version 110731

Version Description

Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 110731
Comparing to
See all releases

Code changes from version 110710 to 110731

Files changed (71) hide show
  1. includes/classes/constants.inc.php +120 -12
  2. includes/classes/css-js-in.inc.php +18 -13
  3. includes/classes/custom-reg-fields-4bp.inc.php +107 -99
  4. includes/classes/custom-reg-fields.inc.php +33 -33
  5. includes/classes/files-in.inc.php +7 -4
  6. includes/classes/login-redirects.inc.php +16 -11
  7. includes/classes/option-forces.inc.php +5 -5
  8. includes/classes/paypal-notify-in-cart.inc.php +82 -0
  9. includes/classes/paypal-notify-in-express-checkout.inc.php +82 -0
  10. includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php +84 -0
  11. includes/classes/paypal-notify-in-send-money.inc.php +81 -0
  12. includes/classes/paypal-notify-in-sp-refund-reversal.inc.php +151 -0
  13. includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +263 -0
  14. includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +194 -0
  15. includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +438 -0
  16. includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php +85 -0
  17. includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +224 -0
  18. includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +634 -0
  19. includes/classes/paypal-notify-in-virtual-terminal.inc.php +81 -0
  20. includes/classes/paypal-notify-in-web-accept-sp.inc.php +241 -0
  21. includes/classes/paypal-notify-in.inc.php +80 -2008
  22. includes/classes/paypal-return-in-no-tx-data.inc.php +72 -0
  23. includes/classes/paypal-return-in-proxy-ty-email.inc.php +70 -0
  24. includes/classes/paypal-return-in-proxy-x-preview.inc.php +70 -0
  25. includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +192 -0
  26. includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +340 -0
  27. includes/classes/paypal-return-in-web-accept-sp.inc.php +146 -0
  28. includes/classes/paypal-return-in.inc.php +66 -492
  29. includes/classes/paypal-utilities.inc.php +9 -9
  30. includes/classes/profile-in.inc.php +23 -43
  31. includes/classes/register-access.inc.php +1 -1
  32. includes/classes/register-in.inc.php +4 -4
  33. includes/classes/registrations.inc.php +29 -20
  34. includes/classes/return-templates.inc.php +82 -0
  35. includes/classes/ruris.inc.php +4 -2
  36. includes/classes/sc-paypal-button-in.inc.php +23 -12
  37. includes/classes/sp-access.inc.php +1 -1
  38. includes/classes/systematics-sp.inc.php +2 -2
  39. includes/classes/systematics.inc.php +3 -3
  40. includes/classes/tracking-codes.inc.php +22 -0
  41. includes/classes/user-deletions.inc.php +1 -0
  42. includes/classes/user-new-in.inc.php +1 -1
  43. includes/classes/users-list-in.inc.php +1 -1
  44. includes/classes/users-list.inc.php +12 -8
  45. includes/classes/utilities.inc.php +4 -4
  46. includes/classes/utils-arrays.inc.php +30 -0
  47. includes/classes/utils-conds.inc.php +25 -1
  48. includes/classes/utils-html.inc.php +74 -0
  49. includes/classes/utils-users.inc.php +6 -6
  50. includes/functions/api-functions.inc.php +38 -2
  51. includes/hooks.inc.php +6 -2
  52. includes/menu-pages/code-samples/current-user-login-counter.php +7 -0
  53. includes/menu-pages/down-ops.inc.php +1 -1
  54. includes/menu-pages/els-ops.inc.php +2 -2
  55. includes/menu-pages/gen-ops.inc.php +25 -7
  56. includes/menu-pages/menu-pages-s-min.js +1 -1
  57. includes/menu-pages/menu-pages-s.js +9 -4
  58. includes/menu-pages/paypal-ops.inc.php +5 -2
  59. includes/menu-pages/res-ops.inc.php +1 -1
  60. includes/menu-pages/scripting.inc.php +9 -0
  61. includes/menu-pages/trk-ops.inc.php +3 -3
  62. includes/s2member-min.js +1 -1
  63. includes/s2member.css +108 -0
  64. includes/s2member.js +2 -2
  65. includes/syscon.inc.php +5 -3
  66. includes/templates/buttons/paypal-checkout-button.html +3 -1
  67. includes/templates/buttons/paypal-sp-checkout-button.html +3 -1
  68. includes/templates/returns/default-return.html +38 -0
  69. includes/templates/returns/index.php +0 -0
  70. readme.txt +23 -3
  71. s2member.php +5 -5
includes/classes/constants.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
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_constants"))
21
  {
@@ -61,8 +61,9 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
61
  $registration_ip = ($user) ? get_user_option ("s2member_registration_ip", $user->ID) : "";
62
  $custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
63
  $paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
 
64
  /**/
65
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
66
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
67
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
68
  /**
@@ -91,6 +92,37 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
91
  if (!defined ("S2MEMBER_VERSION"))
92
  define ("S2MEMBER_VERSION", ($c[] = (string)WS_PLUGIN__S2MEMBER_VERSION));
93
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  * Is the current User logged-in at all.
95
  *
96
  * True if the current User IS logged-in, else false.
@@ -2021,6 +2053,66 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2021
  if (!defined ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN"))
2022
  define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
2023
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2024
  * PayPal® value for Payment Buttons with input name: `on0`.
2025
  *
2026
  * Used in PayPal® Modification Buttons *( i.e. upgrades/downgrades )*.
@@ -2029,7 +2121,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2029
  * this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
2030
  * Otherwise, it will be set to a default value of: "Originating Domain".
2031
  *
2032
- * These four API Constants are special.
 
2033
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2034
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2035
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
@@ -2037,6 +2130,9 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2037
  *
2038
  * They are used by the PayPal® Button Generator for s2Member.
2039
  *
 
 
 
2040
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2041
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2042
  *
@@ -2047,7 +2143,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2047
  *
2048
  * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2049
  *
2050
- * Anyway, these four API Constants are just documented here for clarity;
2051
  * you probably won't use any of these directly; the Button Generator pops them in.
2052
  *
2053
  * ———— Quick PHP Code Sample ————
@@ -2083,7 +2179,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2083
  * this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
2084
  * Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *( the originating domain name )*.
2085
  *
2086
- * These four API Constants are special.
 
2087
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2088
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2089
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
@@ -2091,6 +2188,9 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2091
  *
2092
  * They are used by the PayPal® Button Generator for s2Member.
2093
  *
 
 
 
2094
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2095
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2096
  *
@@ -2101,7 +2201,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2101
  *
2102
  * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2103
  *
2104
- * Anyway, these four API Constants are just documented here for clarity;
2105
  * you probably won't use any of these directly; the Button Generator pops them in.
2106
  *
2107
  * ———— Quick PHP Code Sample ————
@@ -2134,7 +2234,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2134
  * This auto-fills the `on1` value in PayPal® Button Codes.
2135
  * This always contains the string: "Customer IP Address".
2136
  *
2137
- * These four API Constants are special.
 
2138
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2139
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2140
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
@@ -2142,7 +2243,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2142
  *
2143
  * They are used by the PayPal® Button Generator for s2Member.
2144
  *
2145
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
 
2146
  *
2147
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2148
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
@@ -2152,7 +2254,9 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2152
  * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2153
  * you won't even see these, because they're added internally by the Shortcode processor.
2154
  *
2155
- * Anyway, these four API Constants are just documented here for clarity;
 
 
2156
  * you probably won't use any of these directly; the Button Generator pops them in.
2157
  *
2158
  * ———— Quick PHP Code Sample ————
@@ -2185,7 +2289,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2185
  * This auto-fills the `os1` value in PayPal® Button Codes,
2186
  * with the Customer's IP Address, via ``$_SERVER["REMOTE_ADDR"]``.
2187
  *
2188
- * These four API Constants are special.
 
2189
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2190
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2191
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
@@ -2193,7 +2298,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2193
  *
2194
  * They are used by the PayPal® Button Generator for s2Member.
2195
  *
2196
- * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
 
2197
  *
2198
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2199
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
@@ -2203,7 +2309,9 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2203
  * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2204
  * you won't even see these, because they're added internally by the Shortcode processor.
2205
  *
2206
- * Anyway, these four API Constants are just documented here for clarity;
 
 
2207
  * you probably won't use any of these directly; the Button Generator pops them in.
2208
  *
2209
  * ———— Quick PHP Code Sample ————
15
  * @since 3.5
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_constants"))
21
  {
61
  $registration_ip = ($user) ? get_user_option ("s2member_registration_ip", $user->ID) : "";
62
  $custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
63
  $paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
64
+ $login_counter = ($user) ? (int)get_user_option ("s2member_login_counter") : -1;
65
  /**/
66
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
67
  do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
68
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
69
  /**
92
  if (!defined ("S2MEMBER_VERSION"))
93
  define ("S2MEMBER_VERSION", ($c[] = (string)WS_PLUGIN__S2MEMBER_VERSION));
94
  /**
95
+ * The number of times the current User has logged into your site.
96
+ *
97
+ * Negative `-1` through number of times logged-in.
98
+ * Negative `-1` indicates they are NOT logged-in.
99
+ *
100
+ * ———— Quick PHP Code Sample ————
101
+ * ```
102
+ * <!php echo S2MEMBER_CURRENT_USER_LOGIN_COUNTER; !>
103
+ * ```
104
+ * ———— Shortcode & JavaScript Equivalents ————
105
+ * ```
106
+ * [s2Get constant="S2MEMBER_CURRENT_USER_LOGIN_COUNTER" /]
107
+ *
108
+ * <script type="text/javascript">
109
+ * document.write(S2MEMBER_CURRENT_USER_LOGIN_COUNTER);
110
+ * </script>
111
+ * ```
112
+ *
113
+ * @package s2Member\API_Constants
114
+ * @since 110720
115
+ *
116
+ * @var int
117
+ *
118
+ * @see s2Member\API_Functions\get_user_field()
119
+ * @see `get_user_field("s2member_login_counter")`
120
+ *
121
+ * @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
122
+ */
123
+ if (!defined ("S2MEMBER_CURRENT_USER_LOGIN_COUNTER"))
124
+ define ("S2MEMBER_CURRENT_USER_LOGIN_COUNTER", ($c[] = (int)$login_counter));
125
+ /**
126
  * Is the current User logged-in at all.
127
  *
128
  * True if the current User IS logged-in, else false.
2053
  if (!defined ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN"))
2054
  define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
2055
  /**
2056
+ * PayPal® value for Payment Buttons with input name: `invoice`.
2057
+ *
2058
+ * This can be used to auto-fill the `invoice` value in PayPal® Button Codes, with a unique Code~IP combination.
2059
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2060
+ *
2061
+ * Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
2062
+ * It MUST be excluded, because the value of this particular API Constant will change too often *( i.e. it changes, depending on microtime )*.
2063
+ * So, when including this API Constant in the JavaScript API as a Global, care must be taken to build an Invoice, using JavaScript
2064
+ * to calculate the unique time-based code, with something like: `Math.round (new Date ().getTime ())`.
2065
+ *
2066
+ * These five API Constants are special.
2067
+ * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2068
+ * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2069
+ * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2070
+ * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2071
+ * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1}
2072
+ *
2073
+ * They are used by the PayPal® Button Generator for s2Member.
2074
+ *
2075
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2076
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2077
+ *
2078
+ * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2079
+ * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2080
+ *
2081
+ * Instead of forcing a Member *( and/or a Free Subscriber )* to re-register for a new account,
2082
+ * s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
2083
+ * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2084
+ * you won't even see these, because they're added internally by the Shortcode processor.
2085
+ *
2086
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2087
+ *
2088
+ * Anyway, these five API Constants are just documented here for clarity;
2089
+ * you probably won't use any of these directly; the Button Generator pops them in.
2090
+ *
2091
+ * ———— Quick PHP Code Sample ————
2092
+ * ```
2093
+ * <!php echo S2MEMBER_VALUE_FOR_PP_INV; !>
2094
+ * ```
2095
+ * ———— Shortcode & JavaScript Equivalents ————
2096
+ * ```
2097
+ * [s2Get constant="S2MEMBER_VALUE_FOR_PP_INV" /]
2098
+ *
2099
+ * <script type="text/javascript">
2100
+ * document.write(S2MEMBER_VALUE_FOR_PP_INV);
2101
+ * </script>
2102
+ * ```
2103
+ *
2104
+ * @package s2Member\API_Constants
2105
+ * @since 110720
2106
+ *
2107
+ * @var str
2108
+ *
2109
+ * @see s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()
2110
+ *
2111
+ * @see `Dashboard -> s2Member -> PayPal® Buttons`
2112
+ */
2113
+ if (!defined ("S2MEMBER_VALUE_FOR_PP_INV"))
2114
+ define ("S2MEMBER_VALUE_FOR_PP_INV", uniqid () . "~" . S2MEMBER_CURRENT_USER_IP);
2115
+ /**
2116
  * PayPal® value for Payment Buttons with input name: `on0`.
2117
  *
2118
  * Used in PayPal® Modification Buttons *( i.e. upgrades/downgrades )*.
2121
  * this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
2122
  * Otherwise, it will be set to a default value of: "Originating Domain".
2123
  *
2124
+ * These five API Constants are special.
2125
+ * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2126
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2127
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2128
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2130
  *
2131
  * They are used by the PayPal® Button Generator for s2Member.
2132
  *
2133
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2134
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2135
+ *
2136
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2137
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2138
  *
2143
  *
2144
  * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2145
  *
2146
+ * Anyway, these five API Constants are just documented here for clarity;
2147
  * you probably won't use any of these directly; the Button Generator pops them in.
2148
  *
2149
  * ———— Quick PHP Code Sample ————
2179
  * this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
2180
  * Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *( the originating domain name )*.
2181
  *
2182
+ * These five API Constants are special.
2183
+ * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2184
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2185
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2186
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2188
  *
2189
  * They are used by the PayPal® Button Generator for s2Member.
2190
  *
2191
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2192
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2193
+ *
2194
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2195
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2196
  *
2201
  *
2202
  * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2203
  *
2204
+ * Anyway, these five API Constants are just documented here for clarity;
2205
  * you probably won't use any of these directly; the Button Generator pops them in.
2206
  *
2207
  * ———— Quick PHP Code Sample ————
2234
  * This auto-fills the `on1` value in PayPal® Button Codes.
2235
  * This always contains the string: "Customer IP Address".
2236
  *
2237
+ * These five API Constants are special.
2238
+ * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2239
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2240
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2241
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2243
  *
2244
  * They are used by the PayPal® Button Generator for s2Member.
2245
  *
2246
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2247
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2248
  *
2249
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2250
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2254
  * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2255
  * you won't even see these, because they're added internally by the Shortcode processor.
2256
  *
2257
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2258
+ *
2259
+ * Anyway, these five API Constants are just documented here for clarity;
2260
  * you probably won't use any of these directly; the Button Generator pops them in.
2261
  *
2262
  * ———— Quick PHP Code Sample ————
2289
  * This auto-fills the `os1` value in PayPal® Button Codes,
2290
  * with the Customer's IP Address, via ``$_SERVER["REMOTE_ADDR"]``.
2291
  *
2292
+ * These five API Constants are special.
2293
+ * o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
2294
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0}
2295
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0}
2296
  * o {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1}
2298
  *
2299
  * They are used by the PayPal® Button Generator for s2Member.
2300
  *
2301
+ * The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
2302
+ * However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\S2MEMBER_VALUE_FOR_PP_INV()} function should be used instead.
2303
  *
2304
  * The `ON0/OS0` values, are how s2Member identifies an existing Member *( and/or a Free Subscriber )*, who is already logged-in
2305
  * when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
2309
  * These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
2310
  * you won't even see these, because they're added internally by the Shortcode processor.
2311
  *
2312
+ * The `ON1/OS1` values, are used by s2Member to identify a Customer's IP Address through IPN communications with PayPal®.
2313
+ *
2314
+ * Anyway, these five API Constants are just documented here for clarity;
2315
  * you probably won't use any of these directly; the Button Generator pops them in.
2316
  *
2317
  * ———— Quick PHP Code Sample ————
includes/classes/css-js-in.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
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_css_js_in"))
21
  {
@@ -43,16 +43,16 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
43
  /**/
44
  if (!empty ($_GET["ws_plugin__s2member_css"]))
45
  {
46
- header ("Content-Type: text/css; charset=utf-8");
47
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
48
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
49
- header ("Cache-Control: max-age=604800");
50
- header ("Pragma: public");
51
  /**/
52
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
53
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
54
  /**/
55
- ob_start ("c_ws_plugin__s2member_utils_css::compress_css");
56
  /**/
57
  include_once dirname (dirname (__FILE__)) . "/s2member.css";
58
  /**/
@@ -81,14 +81,16 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
81
  /**/
82
  if (!empty ($_GET["ws_plugin__s2member_js_w_globals"]))
83
  {
84
- header ("Content-Type: text/javascript; charset=utf-8");
85
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
86
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
87
- header ("Cache-Control: max-age=604800");
88
- header ("Pragma: public");
89
  /**/
90
  $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',";
91
  /**/
 
 
92
  $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
93
  $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
94
  /**/
@@ -164,6 +166,9 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
164
  $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
165
  $g .= "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
166
  /**/
 
 
 
167
  $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
168
  $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
169
  /**/
@@ -176,7 +181,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
176
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
177
  /**/
178
  echo $g . "\n"; /* Add a line break. */
179
- unset ($g); /* Now unset this variable. */
180
  /**/
181
  include_once dirname (dirname (__FILE__)) . "/s2member-min.js";
182
  /**/
15
  * @since 3.5
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_css_js_in"))
21
  {
43
  /**/
44
  if (!empty ($_GET["ws_plugin__s2member_css"]))
45
  {
46
+ header("Content-Type: text/css; charset=utf-8");
47
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
48
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
49
+ header("Cache-Control: max-age=604800");
50
+ header("Pragma: public");
51
  /**/
52
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
53
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
54
  /**/
55
+ ob_start("c_ws_plugin__s2member_utils_css::compress_css");
56
  /**/
57
  include_once dirname (dirname (__FILE__)) . "/s2member.css";
58
  /**/
81
  /**/
82
  if (!empty ($_GET["ws_plugin__s2member_js_w_globals"]))
83
  {
84
+ header("Content-Type: text/javascript; charset=utf-8");
85
+ header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
86
+ header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
87
+ header("Cache-Control: max-age=604800");
88
+ header("Pragma: public");
89
  /**/
90
  $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',";
91
  /**/
92
+ $g .= "S2MEMBER_CURRENT_USER_LOGIN_COUNTER = " . S2MEMBER_CURRENT_USER_LOGIN_COUNTER . ",";
93
+ /**/
94
  $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
95
  $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
96
  /**/
166
  $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
167
  $g .= "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
168
  /**/
169
+ $g .= "S2MEMBER_VALUE_FOR_PP_INV = Math.round (new Date ().getTime ()) + '~" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_IP) . "',";
170
+ $g .= "S2MEMBER_VALUE_FOR_PP_INV_GEN = function(){ var invoice = '', formatSeed = function(seed, reqWidth) { seed = parseInt(seed, 10).toString (16); if (reqWidth < seed.length) return seed.slice (seed.length - reqWidth); else if (reqWidth > seed.length) return Array(1 + (reqWidth - seed.length)).join ('0') + seed; return seed; }; if (typeof S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED === 'undefined') S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED = Math.floor (Math.random () * 0x75bcd15); S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED++; invoice = formatSeed(parseInt(new Date ().getTime () / 1000, 10), 8); invoice += formatSeed(S2MEMBER_VALUE_FOR_PP_INV_GEN_UNIQUE_SEED, 5); invoice += '~' + S2MEMBER_CURRENT_USER_IP; return invoice; },";
171
+ /**/
172
  $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
173
  $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
174
  /**/
181
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
182
  /**/
183
  echo $g . "\n"; /* Add a line break. */
184
+ unset($g); /* Now unset this variable. */
185
  /**/
186
  include_once dirname (dirname (__FILE__)) . "/s2member-min.js";
187
  /**/
includes/classes/custom-reg-fields-4bp.inc.php CHANGED
@@ -142,61 +142,65 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
142
  */
143
  public static function custom_profile_fields_4bp ()
144
  {
 
145
  static $processed = false; /* Process this routine only one time. */
146
  /**/
147
  do_action ("ws_plugin__s2member_before_custom_profile_fields_4bp", get_defined_vars ());
148
  /**/
149
  if (!$processed && in_array ("profile", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
150
  if (apply_filters ("ws_plugin__s2member_custom_profile_fields_4bp_display", true, get_defined_vars ()))
151
- if (bp_is_user_profile () && bp_is_profile_edit () && (int)bp_get_the_profile_group_id () === 1 && ($processed = true))
152
- {
153
- echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
154
- /**/
155
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
156
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
157
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
158
- /**/
159
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
160
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
161
- {
162
- $fields = get_user_option ("s2member_custom_fields"); /* Existing Custom Fields. */
163
- /**/
164
- foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
165
- {
166
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
167
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
168
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
169
- /**/
170
- if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
171
- {
172
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
173
- $field_id_class = preg_replace ("/_/", "-", $field_var);
174
- /**/
175
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
176
- if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
177
- {
178
- if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
179
- echo '<div class="ws-plugin--s2member-profile-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div>';
180
- /**/
181
- echo '<div class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' editfield">' . "\n";
182
- echo '<label for="ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . '">' . "\n";
183
- echo '<span' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . (($field["required"] === "yes") ? ' *' : '') . '</span></label>' . "\n";
184
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile");
185
- echo '</div>' . "\n";
186
- }
187
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
188
- }
189
- /**/
190
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
191
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
192
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
193
- }
194
- }
195
- /**/
196
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
197
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
198
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
199
- }
 
 
 
200
  /**/
201
  do_action ("ws_plugin__s2member_after_custom_profile_fields_4bp", get_defined_vars ());
202
  /**/
@@ -214,62 +218,66 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
214
  */
215
  public static function custom_profile_field_items_4bp ()
216
  {
 
217
  static $processed = false; /* Process this routine only one time. */
218
  /**/
219
  do_action ("ws_plugin__s2member_before_custom_profile_field_items_4bp", get_defined_vars ());
220
  /**/
221
  if (!$processed && in_array ("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
222
  if (apply_filters ("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars ()))
223
- if (bp_is_user_profile () && !bp_is_profile_edit () && (int)bp_get_the_profile_group_id () === 1 && ($processed = true))
224
- {
225
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
226
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
227
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
228
- /**/
229
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
230
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile-view"))
231
- {
232
- $fields = get_user_option ("s2member_custom_fields"); /* Existing Custom Fields. */
233
- /**/
234
- foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
235
- {
236
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
237
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
238
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
239
- /**/
240
- if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
241
- {
242
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
243
- $field_id_class = preg_replace ("/_/", "-", $field_var);
244
- /**/
245
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
246
- if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
247
- {
248
- if (!empty ($field["section"]) && $field["section"] === "yes") /* New section? */
249
- {
250
- echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
251
- echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div></td>' . "\n";
252
- echo '</tr>' . "\n";
253
- }
254
- /**/
255
- echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . '">' . "\n";
256
- echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' label"><span>' . $field["label"] . '</span></td>' . "\n";
257
- echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile-view") . '</td>' . "\n";
258
- echo '</tr>' . "\n";
259
- }
260
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
261
- }
262
- /**/
263
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
264
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
265
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
266
- }
267
- }
268
- /**/
269
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
270
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
271
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
272
- }
 
 
 
273
  /**/
274
  do_action ("ws_plugin__s2member_after_custom_profile_field_items_4bp", get_defined_vars ());
275
  /**/
142
  */
143
  public static function custom_profile_fields_4bp ()
144
  {
145
+ global $bp; /* Global BuddyPress object reference. */
146
  static $processed = false; /* Process this routine only one time. */
147
  /**/
148
  do_action ("ws_plugin__s2member_before_custom_profile_fields_4bp", get_defined_vars ());
149
  /**/
150
  if (!$processed && in_array ("profile", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
151
  if (apply_filters ("ws_plugin__s2member_custom_profile_fields_4bp_display", true, get_defined_vars ()))
152
+ if (bp_is_user_profile () && bp_is_profile_edit () && (int)bp_get_the_profile_group_id () === 1)
153
+ if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
154
+ if (($processed = true)) /* Mark as having been processed now. */
155
+ {
156
+ echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
157
+ /**/
158
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
159
+ do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
160
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
161
+ /**/
162
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
163
+ if (($level = c_ws_plugin__s2member_user_access::user_access_level (new WP_User ($user_id))) >= 0)
164
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level, "profile"))
165
+ {
166
+ $fields = get_user_option ("s2member_custom_fields", $user_id); /* Existing Custom Fields. */
167
+ /**/
168
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
169
+ {
170
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
171
+ do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
172
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
173
+ /**/
174
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
175
+ {
176
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
177
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
178
+ /**/
179
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
180
+ if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
181
+ {
182
+ if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
183
+ echo '<div class="ws-plugin--s2member-profile-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div>';
184
+ /**/
185
+ echo '<div class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' editfield">' . "\n";
186
+ echo '<label for="ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . '">' . "\n";
187
+ echo '<span' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . (($field["required"] === "yes") ? ' *' : '') . '</span></label>' . "\n";
188
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile");
189
+ echo '</div>' . "\n";
190
+ }
191
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
192
+ }
193
+ /**/
194
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
195
+ do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
196
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
197
+ }
198
+ }
199
+ /**/
200
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
201
+ do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
202
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
203
+ }
204
  /**/
205
  do_action ("ws_plugin__s2member_after_custom_profile_fields_4bp", get_defined_vars ());
206
  /**/
218
  */
219
  public static function custom_profile_field_items_4bp ()
220
  {
221
+ global $bp; /* Global BuddyPress object reference. */
222
  static $processed = false; /* Process this routine only one time. */
223
  /**/
224
  do_action ("ws_plugin__s2member_before_custom_profile_field_items_4bp", get_defined_vars ());
225
  /**/
226
  if (!$processed && in_array ("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
227
  if (apply_filters ("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars ()))
228
+ if (bp_is_user_profile () && !bp_is_profile_edit () && (int)bp_get_the_profile_group_id () === 1)
229
+ if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
230
+ if (($processed = true)) /* Mark as having been processed now. */
231
+ {
232
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
233
+ do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
234
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
235
+ /**/
236
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
237
+ if (($level = c_ws_plugin__s2member_user_access::user_access_level (new WP_User ($user_id))) >= 0)
238
+ if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level, "profile-view"))
239
+ {
240
+ $fields = get_user_option ("s2member_custom_fields", $user_id); /* Existing Custom Fields. */
241
+ /**/
242
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
243
+ {
244
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
245
+ do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
246
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
247
+ /**/
248
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
249
+ {
250
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
251
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
252
+ /**/
253
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
254
+ if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
255
+ {
256
+ if (!empty ($field["section"]) && $field["section"] === "yes") /* New section? */
257
+ {
258
+ echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
259
+ echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div></td>' . "\n";
260
+ echo '</tr>' . "\n";
261
+ }
262
+ /**/
263
+ echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . '">' . "\n";
264
+ echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' label"><span>' . $field["label"] . '</span></td>' . "\n";
265
+ echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile-view") . '</td>' . "\n";
266
+ echo '</tr>' . "\n";
267
+ }
268
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
269
+ }
270
+ /**/
271
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
272
+ do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
273
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
274
+ }
275
+ }
276
+ /**/
277
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
278
+ do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
279
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
280
+ }
281
  /**/
282
  do_action ("ws_plugin__s2member_after_custom_profile_field_items_4bp", get_defined_vars ());
283
  /**/
includes/classes/custom-reg-fields.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
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_custom_reg_fields"))
21
  {
@@ -48,13 +48,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
48
  */
49
  public static function custom_field_gen ($_function = FALSE, $_field = FALSE, $_name_prefix = FALSE, $_id_prefix = FALSE, $_classes = FALSE, $_styles = FALSE, $_tabindex = FALSE, $_attrs = FALSE, $_submission = FALSE, $_value = FALSE, $_editable_context = FALSE)
50
  {
51
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
  do_action ("ws_plugin__s2member_before_custom_field_gen", get_defined_vars ());
53
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
  /**/
55
  if (!($gen = "") && $_function && is_array ($field = $_field) && !empty ($field["type"]) && !empty ($field["id"]) && $_name_prefix && $_id_prefix)
56
  {
57
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
58
  do_action ("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars ());
59
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
60
  /**/
@@ -258,7 +258,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
258
  }
259
  }
260
  /**/
261
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
262
  do_action ("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars ());
263
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
  }
@@ -278,12 +278,12 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
278
  */
279
  public static function custom_fields_configured_at_level ($_level = "auto-detection", $_editable_context = FALSE)
280
  {
281
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
282
  do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
283
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
284
  /**/
285
  $level = ($_level === "auto-detection") ? c_ws_plugin__s2member_user_access::user_access_level () : $_level;
286
- if ($_level === "auto-detection" && $level < 0 && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_regex"], $item_number, $m) && !empty ($m[1]) && is_numeric ($m[1]))
287
  $level = $m[1]; /* A numeric Membership Level # . */
288
  /**/
289
  $level = ($level !== "any" && (!is_numeric ($level) || $level < 0)) ? 0 : $level; /* Default. */
@@ -291,7 +291,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
291
  if (($level === "any" || (is_numeric ($level) && $level >= 0)) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
292
  {
293
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
294
- if ($level === "any" || $field["levels"] === "all" || in_array ($level, preg_split ("/[;,]+/", preg_replace ("/[^0-9,]/", "", $field["levels"]))))
295
  if (empty ($_editable_context) || $_editable_context === "administrative" || ($_editable_context === "registration" && $field["editable"] !== "yes-invisible") || (($_editable_context === "profile" || $_editable_context === "profile-view") && $field["editable"] !== "no-invisible"))
296
  $configured[] = $field["id"]; /* Add this to the array. */
297
  }
@@ -322,7 +322,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
322
  /**/
323
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
324
  /**/
325
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
326
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
327
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
328
  /**/
@@ -330,7 +330,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
330
  {
331
  echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
332
  /**/
333
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
334
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
335
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
336
  /**/
@@ -338,11 +338,11 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
338
  echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
339
  echo '<br />' . "\n";
340
  /**/
341
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
342
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
343
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
  /**/
345
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
346
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
347
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
  /**/
@@ -350,7 +350,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
350
  echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
351
  echo '<br />' . "\n";
352
  /**/
353
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
354
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
355
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
356
  }
@@ -359,7 +359,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
359
  if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
360
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
361
  {
362
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
363
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
364
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
365
  /**/
@@ -368,7 +368,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
368
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
369
  $field_id_class = preg_replace ("/_/", "-", $field_var);
370
  /**/
371
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
372
  if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
373
  {
374
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -381,14 +381,14 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
381
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
382
  }
383
  /**/
384
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
385
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
386
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
387
  }
388
  /**/
389
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
390
  {
391
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
392
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
393
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
394
  /**/
@@ -398,17 +398,17 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
398
  echo '</label>' . "\n";
399
  echo '<br />' . "\n";
400
  /**/
401
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
402
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
403
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
404
  }
405
  /**/
406
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
407
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
408
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
409
  }
410
  /**/
411
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
412
  do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
413
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
414
  /**/
@@ -436,13 +436,13 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
436
  /**/
437
  $tabindex = 20; /* Incremented tabindex starting with 20. */
438
  /**/
439
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
440
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
441
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
442
  /**/
443
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
444
  {
445
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
446
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
447
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
448
  /**/
@@ -461,7 +461,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
461
  /**/
462
  echo '</p>' . "\n";
463
  /**/
464
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
465
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
466
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
467
  }
@@ -470,7 +470,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
470
  {
471
  echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
472
  /**/
473
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
474
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
475
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
476
  /**/
@@ -481,11 +481,11 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
481
  echo '</label>' . "\n";
482
  echo '</p>' . "\n";
483
  /**/
484
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
485
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
486
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
487
  /**/
488
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
489
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
490
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
491
  /**/
@@ -496,7 +496,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
496
  echo '</label>' . "\n";
497
  echo '</p>' . "\n";
498
  /**/
499
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
500
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
501
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
502
  }
@@ -505,7 +505,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
505
  if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
506
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
507
  {
508
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
509
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
510
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
511
  /**/
@@ -514,7 +514,7 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
514
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
515
  $field_id_class = preg_replace ("/_/", "-", $field_var);
516
  /**/
517
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
518
  if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
519
  {
520
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
@@ -529,14 +529,14 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
529
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
530
  }
531
  /**/
532
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
533
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
534
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
535
  }
536
  /**/
537
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
538
  {
539
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
540
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
541
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
542
  /**/
@@ -547,16 +547,16 @@ if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields"))
547
  echo '</label>' . "\n";
548
  echo '</p>' . "\n";
549
  /**/
550
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
551
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
552
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
553
  }
554
  /**/
555
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
556
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
557
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
558
  /**/
559
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
560
  do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
561
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
562
  /**/
15
  * @since 3.5
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_custom_reg_fields"))
21
  {
48
  */
49
  public static function custom_field_gen ($_function = FALSE, $_field = FALSE, $_name_prefix = FALSE, $_id_prefix = FALSE, $_classes = FALSE, $_styles = FALSE, $_tabindex = FALSE, $_attrs = FALSE, $_submission = FALSE, $_value = FALSE, $_editable_context = FALSE)
50
  {
51
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
  do_action ("ws_plugin__s2member_before_custom_field_gen", get_defined_vars ());
53
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
  /**/
55
  if (!($gen = "") && $_function && is_array ($field = $_field) && !empty ($field["type"]) && !empty ($field["id"]) && $_name_prefix && $_id_prefix)
56
  {
57
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
58
  do_action ("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars ());
59
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
60
  /**/
258
  }
259
  }
260
  /**/
261
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
262
  do_action ("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars ());
263
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
264
  }
278
  */
279
  public static function custom_fields_configured_at_level ($_level = "auto-detection", $_editable_context = FALSE)
280
  {
281
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
282
  do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
283
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
284
  /**/
285
  $level = ($_level === "auto-detection") ? c_ws_plugin__s2member_user_access::user_access_level () : $_level;
286
+ if ($_level === "auto-detection" && $level < 0 && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty ($m[1]) && is_numeric ($m[1]))
287
  $level = $m[1]; /* A numeric Membership Level # . */
288
  /**/
289
  $level = ($level !== "any" && (!is_numeric ($level) || $level < 0)) ? 0 : $level; /* Default. */
291
  if (($level === "any" || (is_numeric ($level) && $level >= 0)) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
292
  {
293
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
294
+ if ($level === "any" || $field["levels"] === "all" || in_array ($level, preg_split ("/[;,]+/", preg_replace ("/[^0-9;,]/", "", $field["levels"]))))
295
  if (empty ($_editable_context) || $_editable_context === "administrative" || ($_editable_context === "registration" && $field["editable"] !== "yes-invisible") || (($_editable_context === "profile" || $_editable_context === "profile-view") && $field["editable"] !== "no-invisible"))
296
  $configured[] = $field["id"]; /* Add this to the array. */
297
  }
322
  /**/
323
  echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
324
  /**/
325
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
326
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
327
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
328
  /**/
330
  {
331
  echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
332
  /**/
333
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
334
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
335
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
336
  /**/
338
  echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
339
  echo '<br />' . "\n";
340
  /**/
341
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
342
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
343
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
  /**/
345
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
346
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
347
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
  /**/
350
  echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_p["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
351
  echo '<br />' . "\n";
352
  /**/
353
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
354
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
355
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
356
  }
359
  if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
360
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
361
  {
362
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
363
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
364
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
365
  /**/
368
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
369
  $field_id_class = preg_replace ("/_/", "-", $field_var);
370
  /**/
371
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
372
  if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
373
  {
374
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
381
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
382
  }
383
  /**/
384
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
385
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
386
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
387
  }
388
  /**/
389
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
390
  {
391
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
392
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
393
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
394
  /**/
398
  echo '</label>' . "\n";
399
  echo '<br />' . "\n";
400
  /**/
401
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
402
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
403
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
404
  }
405
  /**/
406
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
407
  do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
408
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
409
  }
410
  /**/
411
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
412
  do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
413
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
414
  /**/
436
  /**/
437
  $tabindex = 20; /* Incremented tabindex starting with 20. */
438
  /**/
439
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
440
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
441
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
442
  /**/
443
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
444
  {
445
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
446
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
447
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
448
  /**/
461
  /**/
462
  echo '</p>' . "\n";
463
  /**/
464
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
465
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
466
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
467
  }
470
  {
471
  echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section"></div>' . "\n";
472
  /**/
473
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
474
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
475
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
476
  /**/
481
  echo '</label>' . "\n";
482
  echo '</p>' . "\n";
483
  /**/
484
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
485
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
486
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
487
  /**/
488
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
489
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
490
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
491
  /**/
496
  echo '</label>' . "\n";
497
  echo '</p>' . "\n";
498
  /**/
499
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
500
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
501
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
502
  }
505
  if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
506
  foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
507
  {
508
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
509
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
510
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
511
  /**/
514
  $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
515
  $field_id_class = preg_replace ("/_/", "-", $field_var);
516
  /**/
517
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
518
  if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
519
  {
520
  if (!empty ($field["section"]) && $field["section"] === "yes") /* Starts a new section? */
529
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
530
  }
531
  /**/
532
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
533
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
534
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
535
  }
536
  /**/
537
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
538
  {
539
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
540
  do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
541
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
542
  /**/
547
  echo '</label>' . "\n";
548
  echo '</p>' . "\n";
549
  /**/
550
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
551
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
552
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
553
  }
554
  /**/
555
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
556
  do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
557
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
558
  /**/
559
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
560
  do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
561
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
562
  /**/
includes/classes/files-in.inc.php CHANGED
@@ -45,10 +45,10 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
45
  {
46
  $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
47
  /**/
48
- if (! ($using_amazon_s3_storage = 0) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"])
49
  $using_amazon_s3_storage = true; /* Amazon® S3 storage has been configured! */
50
  /**/
51
- if (!$excluded && (empty ($_GET["s2member_file_download_key"]) || (!empty ($_GET["s2member_file_download_key"]) && ! ($file_download_key_is_valid = ($_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"]) || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], "ip-forever") || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], "universal"))))))
52
  {
53
  $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Trim slashes after Key comparison. */
54
  /**/
@@ -76,7 +76,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
76
  exit ("503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`.");
77
  }
78
  /**/
79
- else if (!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ( (is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || ! ($user_id = $user->ID))
80
  {
81
  if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $_GET["s2member_file_download"], $m))
82
  {
@@ -184,6 +184,9 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
184
  $amazon_s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("GET\n\n\n" . $amazon_s3_file_expires . "\n" . "/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . $amazon_s3_raw_file));
185
  /**/
186
  $amazon_s3_redirection_url = "http://" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . ".s3.amazonaws.com" . $amazon_s3_file;
 
 
 
187
  $amazon_s3_redirection_url .= "&AWSAccessKeyId=" . urlencode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"]);
188
  $amazon_s3_redirection_url .= "&Expires=" . urlencode ($amazon_s3_file_expires);
189
  $amazon_s3_redirection_url .= "&Signature=" . urlencode ($amazon_s3_signature);
@@ -252,7 +255,7 @@ if (!class_exists ("c_ws_plugin__s2member_files_in"))
252
  public static function amazon_s3_sign ($data = FALSE)
253
  {
254
  $key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
255
- $key = str_pad (( (strlen ($key) > 64) ? pack ('H*', sha1 ($key)) : $key), 64, chr (0x00));
256
  return pack ('H*', sha1 (($key ^ str_repeat (chr (0x5c), 64)) . pack ('H*', sha1 (($key ^ str_repeat (chr (0x36), 64)) . $data))));
257
  }
258
  /**
45
  {
46
  $excluded = apply_filters ("ws_plugin__s2member_check_file_download_access_excluded", false, get_defined_vars ());
47
  /**/
48
+ if (!($using_amazon_s3_storage = 0) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"])
49
  $using_amazon_s3_storage = true; /* Amazon® S3 storage has been configured! */
50
  /**/
51
+ if (!$excluded && (empty ($_GET["s2member_file_download_key"]) || (!empty ($_GET["s2member_file_download_key"]) && !($file_download_key_is_valid = ($_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"]) || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], "ip-forever") || $_GET["s2member_file_download_key"] === c_ws_plugin__s2member_files::file_download_key ($_GET["s2member_file_download"], "universal"))))))
52
  {
53
  $_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/"); /* Trim slashes after Key comparison. */
54
  /**/
76
  exit ("503: Sorry, File Downloads are NOT enabled yet. Please contact Support for assistance. If you are the site owner, please configure: `s2Member -> Download Options -> Basic Download Restrictions`.");
77
  }
78
  /**/
79
+ else if (!is_object ($user = apply_filters ("ws_plugin__s2member_check_file_download_access_user", ((is_user_logged_in ()) ? wp_get_current_user () : false), get_defined_vars ())) || !($user_id = $user->ID))
80
  {
81
  if (preg_match ("/^access[_\-]s2member[_\-]level([0-9]+)\//", $_GET["s2member_file_download"], $m))
82
  {
184
  $amazon_s3_signature = base64_encode (c_ws_plugin__s2member_files_in::amazon_s3_sign ("GET\n\n\n" . $amazon_s3_file_expires . "\n" . "/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . $amazon_s3_raw_file));
185
  /**/
186
  $amazon_s3_redirection_url = "http://" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . ".s3.amazonaws.com" . $amazon_s3_file;
187
+ if (strtolower ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"]) !== $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"])
188
+ $amazon_s3_redirection_url = "http://s3.amazonaws.com/" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"] . $amazon_s3_file;
189
+ /**/
190
  $amazon_s3_redirection_url .= "&AWSAccessKeyId=" . urlencode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"]);
191
  $amazon_s3_redirection_url .= "&Expires=" . urlencode ($amazon_s3_file_expires);
192
  $amazon_s3_redirection_url .= "&Signature=" . urlencode ($amazon_s3_signature);
255
  public static function amazon_s3_sign ($data = FALSE)
256
  {
257
  $key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
258
+ $key = str_pad (((strlen ($key) > 64) ? pack ('H*', sha1 ($key)) : $key), 64, chr (0x00));
259
  return pack ('H*', sha1 (($key ^ str_repeat (chr (0x5c), 64)) . pack ('H*', sha1 (($key ^ str_repeat (chr (0x36), 64)) . $data))));
260
  }
261
  /**
includes/classes/login-redirects.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
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_login_redirects"))
21
  {
@@ -40,7 +40,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
40
  */
41
  public static function login_redirect ($username = FALSE)
42
  {
43
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
  do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
45
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
  /**/
@@ -51,8 +51,11 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
51
  if (!get_user_option ("s2member_registration_ip", $user_id)) /* Have we got this yet? */
52
  update_user_option ($user_id, "s2member_registration_ip", $_SERVER["REMOTE_ADDR"]);
53
  /**/
 
 
 
54
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) /* Nag em? */
55
- delete_user_setting("default_password_nag") . update_user_option ($user_id, "default_password_nag", false, true);
56
  /**/
57
  $disable_login_ip_restrictions = apply_filters ("ws_plugin__s2member_disable_login_ip_restrictions", false, get_defined_vars ());
58
  /**/
@@ -65,25 +68,25 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
65
  /**/
66
  if (!$obey_redirect_to || empty ($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === "wp-admin/" || $_REQUEST["redirect_to"] === admin_url ())
67
  {
68
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
69
  do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
70
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
71
  /**/
72
  if ($redirect && is_string ($redirect)) /* Is this a string? */
73
- wp_redirect($redirect); /* Dynamic URL introduced by a Filter. */
74
  /**/
75
  else if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
76
- wp_redirect($special_redirection_url); /* Special Redirection URL configured with s2Member. */
77
  /**/
78
  else /* Else we use the Login Welcome Page configured for s2Member. */
79
- wp_redirect(get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
80
  /**/
81
  exit (); /* Clean exit. */
82
  }
83
  }
84
  }
85
  /**/
86
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
87
  do_action ("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
88
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
89
  /**/
@@ -101,7 +104,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
101
  */
102
  public static function login_redirection_url ($user = FALSE, $root_returns_false = FALSE)
103
  {
104
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
105
  do_action ("ws_plugin__s2member_before_login_redirection_url", get_defined_vars ());
106
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
107
  /**/
@@ -122,7 +125,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
122
  */
123
  public static function login_redirection_uri ($user = FALSE, $root_returns_false = FALSE)
124
  {
125
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
126
  do_action ("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
127
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
128
  /**/
@@ -144,7 +147,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
144
  */
145
  public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
146
  {
147
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
148
  do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
149
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
150
  /**/
@@ -158,12 +161,14 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
158
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
159
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
160
  $user_ccaps = (string)implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
 
161
  /**/
162
  $url = preg_replace ("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_login), $url);
163
  $url = preg_replace ("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $url);
164
  $url = preg_replace ("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_level), $url);
165
  $url = preg_replace ("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_role), $url);
166
  $url = preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ccaps), $url);
 
167
  /**/
168
  if ( /* Only if s2Member's fault » */$url !== $orig_url && (!($parse = @parse_url ($url)) || strpos ($parse["path"], "//") !== false))
169
  $url = site_url ("/"); /* Defaults to home page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. // ). */
15
  * @since 3.5
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_login_redirects"))
21
  {
40
  */
41
  public static function login_redirect ($username = FALSE)
42
  {
43
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
44
  do_action ("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
45
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
46
  /**/
51
  if (!get_user_option ("s2member_registration_ip", $user_id)) /* Have we got this yet? */
52
  update_user_option ($user_id, "s2member_registration_ip", $_SERVER["REMOTE_ADDR"]);
53
  /**/
54
+ if (($logins = (int)get_user_option ("s2member_login_counter", $user_id) + 1) >= 1 || ($logins = 1))
55
+ update_user_option ($user_id, "s2member_login_counter", $logins);
56
+ /**/
57
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) /* Nag em? */
58
+ delete_user_setting ("default_password_nag") . update_user_option ($user_id, "default_password_nag", false, true);
59
  /**/
60
  $disable_login_ip_restrictions = apply_filters ("ws_plugin__s2member_disable_login_ip_restrictions", false, get_defined_vars ());
61
  /**/
68
  /**/
69
  if (!$obey_redirect_to || empty ($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === "wp-admin/" || $_REQUEST["redirect_to"] === admin_url ())
70
  {
71
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
  do_action ("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
73
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
  /**/
75
  if ($redirect && is_string ($redirect)) /* Is this a string? */
76
+ wp_redirect ($redirect); /* Dynamic URL introduced by a Filter. */
77
  /**/
78
  else if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
79
+ wp_redirect ($special_redirection_url); /* Special Redirection URL configured with s2Member. */
80
  /**/
81
  else /* Else we use the Login Welcome Page configured for s2Member. */
82
+ wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
83
  /**/
84
  exit (); /* Clean exit. */
85
  }
86
  }
87
  }
88
  /**/
89
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
90
  do_action ("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
91
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
92
  /**/
104
  */
105
  public static function login_redirection_url ($user = FALSE, $root_returns_false = FALSE)
106
  {
107
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
108
  do_action ("ws_plugin__s2member_before_login_redirection_url", get_defined_vars ());
109
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
110
  /**/
125
  */
126
  public static function login_redirection_uri ($user = FALSE, $root_returns_false = FALSE)
127
  {
128
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
129
  do_action ("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
130
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
131
  /**/
147
  */
148
  public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
149
  {
150
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
151
  do_action ("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
152
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
153
  /**/
161
  $user_level = (string)c_ws_plugin__s2member_user_access::user_access_level ($user);
162
  $user_role = (string)c_ws_plugin__s2member_user_access::user_access_role ($user);
163
  $user_ccaps = (string)implode ("-", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
164
+ $user_logins = ($user) ? (string)(int)get_user_option ("s2member_login_counter", $user_id) : "-1";
165
  /**/
166
  $url = preg_replace ("/%%current_user_login%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_login), $url);
167
  $url = preg_replace ("/%%current_user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $url);
168
  $url = preg_replace ("/%%current_user_level%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_level), $url);
169
  $url = preg_replace ("/%%current_user_role%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_role), $url);
170
  $url = preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ccaps), $url);
171
+ $url = preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_logins), $url);
172
  /**/
173
  if ( /* Only if s2Member's fault » */$url !== $orig_url && (!($parse = @parse_url ($url)) || strpos ($parse["path"], "//") !== false))
174
  $url = site_url ("/"); /* Defaults to home page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. // ). */
includes/classes/option-forces.inc.php CHANGED
@@ -15,7 +15,7 @@
15
  * @since 3.5
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_option_forces"))
21
  {
@@ -131,7 +131,7 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
131
  {
132
  global $wpdb; /* Global database object reference */
133
  /**/
134
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
135
  do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
136
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
137
  /**/
@@ -167,13 +167,13 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
167
  global $wpdb; /* Global database object reference */
168
  global $current_site, $current_blog; /* For Multisite support. */
169
  /**/
170
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
171
  do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
172
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
173
  /**/
174
  $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
175
  /**/
176
- if (defined ("BP_VERSION") && is_multisite () && /* BP Multisite / but NOT offering Blogs? */ !c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
177
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = ((c_ws_plugin__s2member_option_forces::check_register_access ()) ? "user" : "none")), get_defined_vars ());
178
  /**/
179
  else if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || !is_main_site ()) /* Blog Farm? */
@@ -187,7 +187,7 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
187
  {
188
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
189
  }
190
- else if (!empty ($reg_cookies) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_regex"], $item_number, $m) && !empty ($m[1]) && is_numeric ($level = $m[1]))
191
  {
192
  if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level])) /* Blog(s)? */
193
  {
15
  * @since 3.5
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_option_forces"))
21
  {
131
  {
132
  global $wpdb; /* Global database object reference */
133
  /**/
134
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
135
  do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
136
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
137
  /**/
167
  global $wpdb; /* Global database object reference */
168
  global $current_site, $current_blog; /* For Multisite support. */
169
  /**/
170
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
171
  do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
172
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
173
  /**/
174
  $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
175
  /**/
176
+ if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && is_multisite () && /* BP Multisite / but NOT offering Blogs? */ !c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
177
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = ((c_ws_plugin__s2member_option_forces::check_register_access ()) ? "user" : "none")), get_defined_vars ());
178
  /**/
179
  else if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || !is_main_site ()) /* Blog Farm? */
187
  {
188
  return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
189
  }
190
+ else if (!empty ($reg_cookies) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty ($m[1]) && is_numeric ($level = $m[1]))
191
  {
192
  if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level])) /* Blog(s)? */
193
  {
includes/classes/paypal-notify-in-cart.inc.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_cart"))
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_cart
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 ("/^cart$/i", $paypal["txn_type"]))/**/
44
+ && (empty ($paypal["payment_status"]) || empty ($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
45
+ && (!empty ($paypal["txn_id"]))/**/)
46
+ {
47
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_cart", get_defined_vars ());
49
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
+ /**/
51
+ if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
52
+ {
53
+ $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `cart` ).";
54
+ /**/
55
+ $processing = $during = true; /* Yes, we ARE processing this. */
56
+ /**/
57
+ $paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
58
+ $paypal["s2member_log"][] = "s2Member Pro handles Cart events on-site, with an IPN proxy.";
59
+ /**/
60
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
61
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_cart", get_defined_vars ());
62
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
63
+ }
64
+ else /* Else, this is a duplicate IPN. Must stop here. */
65
+ {
66
+ $paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
67
+ $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `cart` ).";
68
+ $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
69
+ }
70
+ /**/
71
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_cart", get_defined_vars ());
73
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
+ /**/
75
+ return apply_filters ("c_ws_plugin__s2member_paypal_notify_in_cart", $paypal, get_defined_vars ());
76
+ }
77
+ else
78
+ return apply_filters ("c_ws_plugin__s2member_paypal_notify_in_cart", false, get_defined_vars ());
79
+ }
80
+ }
81
+ }
82
+ ?>
includes/classes/paypal-notify-in-express-checkout.inc.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_express_checkout"))
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_express_checkout
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 ("/^express_checkout$/i", $paypal["txn_type"]))/**/
44
+ && (empty ($paypal["payment_status"]) || empty ($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
45
+ && (!empty ($paypal["txn_id"]))/**/)
46
+ {
47
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_express_checkout", get_defined_vars ());
49
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
+ /**/
51
+ if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
52
+ {
53
+ $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `express_checkout` ).";
54
+ /**/
55
+ $processing = $during = true; /* Yes, we ARE processing this. */
56
+ /**/
57
+ $paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
58
+ $paypal["s2member_log"][] = "s2Member Pro handles Express Checkout events on-site, with an IPN proxy.";
59
+ /**/
60
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
61
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_express_checkout", get_defined_vars ());
62
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
63
+ }
64
+ else /* Else, this is a duplicate IPN. Must stop here. */
65
+ {
66
+ $paypal["s2member_log"][] = "Not processing. Duplicate IPN.";
67
+ $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `express_checkout` ).";
68
+ $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
69
+ }
70
+ /**/
71
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_express_checkout", get_defined_vars ());
73
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
+ /**/
75
+ return apply_filters ("c_ws_plugin__s2member_paypal_notify_in_express_checkout", $paypal, get_defined_vars ());
76
+ }
77
+ else
78
+ return apply_filters ("c_ws_plugin__s2member_paypal_notify_in_express_checkout", false, get_defined_vars ());
79
+ }
80
+ }
81
+ }
82
+ ?>
includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ eval('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 ($__refs, $__v); /* Unset defined __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
+ eval('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 ($__refs, $__v); /* Unset defined __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
+ eval('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 ($__refs, $__v); /* Unset defined __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
+ ?>
includes/classes/paypal-notify-in-send-money.inc.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_send_money"))
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_send_money
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 ("/^send_money$/i", $paypal["txn_type"]))/**/
44
+ && (empty ($paypal["payment_status"]) || empty ($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))/**/
45
+ && (!empty ($paypal["txn_id"]))/**/)
46
+ {
47
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_send_money", get_defined_vars ());
49
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
+ /**/
51
+ if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
52
+ {
53
+ $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `send_money` ).";
54
+ /**/
55
+ $processing = $during = true; /* Yes, we ARE processing this. */
56
+ /**/
57
+ $paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
58
+ /**/
59
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
60
+ do_action ("ws_plugin__s2member_during_paypal_notify_during_send_money", get_defined_vars ());
61
+ unset ($__refs, $__v); /* Unset defined __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 ( `send_money` ).";
67
+ $paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
68
+ }
69
+ /**/
70
+ eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
71
+ do_action ("ws_plugin__s2member_during_paypal_notify_after_send_money", get_defined_vars ());
72
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
73
+ /**/
74
+ return apply_filters ("c_ws_plugin__s2member_paypal_notify_in_send_money", $paypal, get_defined_vars ());
75
+ }
76
+ else
77
+ return apply_filters ("c_ws_plugin__s2member_paypal_notify_in_send_money", false, get_defined_vars ());
78
+ }
79
+ }
80
+ }
81
+ ?>
includes/classes/paypal-notify-in-sp-refund-reversal.inc.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_sp_refund_reversal"))
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_sp_refund_reversal
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
+ * @todo Optimize with ``empty()`` and ``isset()``.
40
+ */
41
+ public static function cp ($vars = array ()) /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
42
+ {
43
+ extract ($vars); /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */
44
+ /**/
45
+ if (/**/(/**/(!empty ($paypal["txn_type"]) && preg_match ("/^new_case$/i", $paypal["txn_type"]) && !empty ($paypal["case_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"]))/**/
46
+ || (!empty ($paypal["payment_status"]) && preg_match ("/^(refunded|reversed|reversal)$/i", $paypal["payment_status"])) /* The "txn_type" is irrelevant in these special situations. */)/**/
47
+ && ((!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"]["sp_access_item_number_regex"], $paypal["item_number"]))/**/
48
+ && (!empty ($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))/**/
49
+ && (!empty ($paypal["payer_email"])) && (!empty ($paypal["parent_txn_id"]))/**/)
50
+ {
51
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
+ do_action ("ws_plugin__s2member_during_paypal_notify_before_sp_refund_reversal", get_defined_vars ());
53
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
+ /**/
55
+ if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
56
+ {
57
+ $paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `[empty or irrelevant]` ) w/ `payment_status` ( `refunded|reversed|reversal` ) - or - `new_case` w/ `case_type` ( `chargeback` ).";
58
+ /**/
59
+ $paypal["ip"] = (preg_match ("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"]) ? $paypal["option_selection2"] : "";
60
+ $paypal["ip"] = (!$paypal["ip"] && preg_match ("/^[a-z0-9]+~[0-9\.]+$/i", $paypal["invoice"])) ? preg_replace ("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
61
+ /**/
62
+ $processing = $during = true; /* Yes, we ARE processing this. */
63
+ /*
64
+ Refunds and chargeback reversals. This is excluded from the processing check.
65
+ In other words, s2Member sends `Refund/Reversal` Notifications ANYTIME a Refund/Reversal occurs; even if s2Member did not process it otherwise.
66
+ Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
67
+ If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
68
+ */
69
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
70
+ {
71
+ foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"]) as $url)
72
+ /**/
73
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["parent_txn_id"])), $url)))
74
+ if (($url = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_number"])), $url)) && ($url = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["item_name"])), $url)))
75
+ if (($url = preg_replace ("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["mc_fee"])), $url)))
76
+ if (($url = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["first_name"])), $url)) && ($url = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["last_name"])), $url)))
77
+ if (($url = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"]))), $url)))
78
+ if (($url = preg_replace ("/%%payer_email%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["payer_email"])), $url)))
79
+ if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["ip"])), $url)))
80
+ /**/
81
+ if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
82
+ c_ws_plugin__s2member_utils_urls::remote ($url);
83
+ /**/
84
+ $paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.";
85
+ }
86
+ /**/
87
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
88
+ {
89
+ $msg = $sbj = "( s2Member / API Notification Email ) - Specific Post/Page ~ Refund/Reversal";
90
+ $msg .= "\n\n"; /* Spacing in the message body. */
91
+ /**/
92
+ $msg .= "parent_txn_id: %%parent_txn_id%%\n";
93
+ $msg .= "item_number: %%item_number%%\n";
94
+ $msg .= "item_name: %%item_name%%\n";
95
+ $msg .= "-amount: %%-amount%%\n";
96
+ $msg .= "-fee: %%-fee%%\n";
97
+ $msg .= "first_name: %%first_name%%\n";
98
+ $msg .= "last_name: %%last_name%%\n";
99
+ $msg .= "full_name: %%full_name%%\n";
100
+ $msg .= "payer_email: %%payer_email%%\n";
101
+ $msg .= "user_ip: %%user_ip%%\n";
102
+ /**/
103
+ $msg .= "cv0: %%cv0%%\n";
104
+ $msg .= "cv1: %%cv1%%\n";
105
+ $msg .= "cv2: %%cv2%%\n";
106
+ $msg .= "cv3: %%cv3%%\n";
107
+ $msg .= "cv4: %%cv4%%\n";
108
+ $msg .= "cv5: %%cv5%%\n";
109
+ $msg .= "cv6: %%cv6%%\n";
110
+ $msg .= "cv7: %%cv7%%\n";
111
+ $msg .= "cv8: %%cv8%%\n";
112
+ $msg .= "cv9: %%cv9%%";
113
+ /**/
114
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%parent_txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["parent_txn_id"]), $msg)))
115
+ if (($msg = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $msg)) && ($msg = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $msg)))
116
+ if (($msg = preg_replace ("/%%-amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $msg)) && ($msg = preg_replace ("/%%-fee%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_fee"]), $msg)))
117
+ if (($msg = preg_replace ("/%%first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["first_name"]), $msg)) && ($msg = preg_replace ("/%%last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["last_name"]), $msg)))
118
+ if (($msg = preg_replace ("/%%full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $msg)))
119
+